Call common.flushDebugInfo automatically on shutdown

This commit is contained in:
Kijin Sung 2016-02-16 11:12:01 +09:00
parent 516479cf20
commit 191fa7c0c1
4 changed files with 18 additions and 7 deletions

View file

@ -331,9 +331,9 @@ class Context
{
ob_start();
$this->setCacheControl(-1, true);
register_shutdown_function(array($this, 'checkSessionStatus'));
$_SESSION = array();
}
register_shutdown_function('Context::close');
// set authentication information in Context and session
if(self::isInstalled())
@ -411,7 +411,7 @@ class Context
{
if(self::getSessionStatus())
{
return;
return true;
}
if($force_start || (count($_SESSION) && !headers_sent()))
{
@ -419,7 +419,9 @@ class Context
unset($_SESSION);
session_start();
$_SESSION = $tempSession;
return true;
}
return false;
}
/**
@ -428,9 +430,21 @@ class Context
* @return void
*/
public static function close()
{
// Flush the slow query/trigger/widget log.
static $flushed = false;
if (!$flushed && config('debug.enabled'))
{
ModuleHandler::triggerCall('common.flushDebugInfo', 'after', new stdClass);
$flushed = true;
}
// Check session status and close it if open.
if (self::checkSessionStatus())
{
session_write_close();
}
}
/**
* set Cache-Control header

View file

@ -78,7 +78,7 @@ class DisplayHandler extends Handler
}
// Start the session if $_SESSION was touched
Context::getInstance()->checkSessionStatus();
Context::checkSessionStatus();
// header output
$httpStatusCode = $oModule->getHttpStatusCode();

View file

@ -884,7 +884,6 @@ class ModuleHandler extends Handler
if($_SESSION['XE_VALIDATOR_RETURN_URL'])
{
Context::getInstance()->checkSessionStatus();
header('location:' . $_SESSION['XE_VALIDATOR_RETURN_URL']);
return;
}

View file

@ -59,7 +59,5 @@ if($oContext->checkSSO())
}
}
$oContext->close();
/* End of file index.php */
/* Location: ./index.php */