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(); ob_start();
$this->setCacheControl(-1, true); $this->setCacheControl(-1, true);
register_shutdown_function(array($this, 'checkSessionStatus'));
$_SESSION = array(); $_SESSION = array();
} }
register_shutdown_function('Context::close');
// set authentication information in Context and session // set authentication information in Context and session
if(self::isInstalled()) if(self::isInstalled())
@ -411,7 +411,7 @@ class Context
{ {
if(self::getSessionStatus()) if(self::getSessionStatus())
{ {
return; return true;
} }
if($force_start || (count($_SESSION) && !headers_sent())) if($force_start || (count($_SESSION) && !headers_sent()))
{ {
@ -419,7 +419,9 @@ class Context
unset($_SESSION); unset($_SESSION);
session_start(); session_start();
$_SESSION = $tempSession; $_SESSION = $tempSession;
return true;
} }
return false;
} }
/** /**
@ -429,7 +431,19 @@ class Context
*/ */
public static function close() public static function close()
{ {
session_write_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();
}
} }
/** /**

View file

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

View file

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

View file

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