Start session automatically if an addon uses the session and exits

This commit is contained in:
Kijin Sung 2015-07-12 20:12:28 +09:00
parent 90c014678a
commit 237f731e02
2 changed files with 4 additions and 1 deletions

View file

@ -361,6 +361,7 @@ class Context
{ {
$this->isSessionStarted = FALSE; $this->isSessionStarted = FALSE;
$this->setCacheControl(-1, true); $this->setCacheControl(-1, true);
register_shutdown_function(array($this, 'checkSessionStatus'));
$_SESSION = array(); $_SESSION = array();
} }
@ -459,7 +460,7 @@ class Context
{ {
return; return;
} }
if(count($_SESSION)) if(count($_SESSION) && !headers_sent())
{ {
$tempSession = $_SESSION; $tempSession = $_SESSION;
session_start(); session_start();

View file

@ -80,6 +80,7 @@ class addonController extends addon
{ {
// Add-on module for use in creating the cache file // Add-on module for use in creating the cache file
$buff = array('<?php if(!defined("__XE__")) exit();', '$_m = Context::get(\'mid\');'); $buff = array('<?php if(!defined("__XE__")) exit();', '$_m = Context::get(\'mid\');');
$buff[] = 'ob_start();';
$oAddonModel = getAdminModel('addon'); $oAddonModel = getAdminModel('addon');
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype); $addon_list = $oAddonModel->getInsertedAddons($site_srl, $gtype);
foreach($addon_list as $addon => $val) foreach($addon_list as $addon => $val)
@ -135,6 +136,7 @@ class addonController extends addon
$buff[] = '$addon_time_log->called_extension = "' . $addon . '";'; $buff[] = '$addon_time_log->called_extension = "' . $addon . '";';
$buff[] = 'writeSlowlog("addon",$after_time-$before_time,$addon_time_log);'; $buff[] = 'writeSlowlog("addon",$after_time-$before_time,$addon_time_log);';
} }
$buff[] = 'ob_end_flush();';
$addon_path = _XE_PATH_ . 'files/cache/addons/'; $addon_path = _XE_PATH_ . 'files/cache/addons/';
FileHandler::makeDir($addon_path); FileHandler::makeDir($addon_path);
$addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php'; $addon_file = $addon_path . ($gtype == 'site' ? $site_srl : '') . $type . '.acivated_addons.cache.php';