Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r10516 -r10580 --- branches/RC/core/kernel/application.php (.../application.php) (revision 10516) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 10580) @@ -176,6 +176,13 @@ * @var unknown_type */ var $CurrentNTag = null; + + /** + * Memcache object pointer + * + * @var Memcache + */ + var $Memcached = null; /** * Returns kApplication instance anywhere in the script. @@ -211,7 +218,21 @@ } return $instance; } + + function InitMemcached() + { + $memcached_servers = 'localhost:11211'; // $this->Application->ConfigValue('MemcachedServers'); + if ($memcached_servers && class_exists('Memcache')) { + $this->Memcached = new Memcache(); + $servers = explode(';', $memcached_servers); + foreach ($servers as $server) { + list ($server, $port) = strpos($server, ':') !== false ? explode(':', $server, 2) : Array ($server, 11211); + $this->Memcached->addServer($server, $port); + } + } + } + /** * Initializes the Application * @@ -224,7 +245,9 @@ function Init() { if($this->InitDone) return false; - + +// $this->InitMemcached(); + if (!constOn('SKIP_OUT_COMPRESSION')) { ob_start(); // collect any output from method (other then tags) into buffer } @@ -253,26 +276,55 @@ $this->RegisterDefaultBuildEvents(); $this->SetDefaultConstants(); + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('Before UnitConfigReader'); + } + $this->UnitConfigReader =& $this->recallObject('kUnitConfigReader'); $this->UnitConfigReader->scanModules(MODULES_PATH); $this->registerModuleConstants(); + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('After UnitConfigReader'); + } + $rewrite_on = $this->ConfigValue('UseModRewrite'); // admin=1 - when front is browsed using admin session $admin_on = getArrayValue($_REQUEST, 'admin') || $this->IsAdmin(); define('MOD_REWRITE', $rewrite_on && !$admin_on ? 1 : 0); $this->HttpQuery =& $this->recallObject('HTTPQuery'); + + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('Processed HTTPQuery initial'); + } + $this->Session =& $this->recallObject('Session'); + + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('Processed Session'); + } $this->HttpQuery->AfterInit(); + + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('Processed HTTPQuery AfterInit'); + } $this->LoadCache(); $this->InitConfig(); $this->Phrases->Init('phrases'); + + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('Loaded cache and phrases'); + } $this->UnitConfigReader->AfterConfigRead(); + + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { + $this->Debugger->appendTimestamp('Processed AfterConfigRead'); + } /*// Module items are recalled during url parsing & PhrasesCache is needed already there, @@ -302,7 +354,7 @@ $this->ValidateLogin(); - if($this->isDebugMode()) { + if( defined('DEBUG_MODE') && $this->isDebugMode() ) { $this->Debugger->profileFinish('kernel4_startup'); } @@ -421,10 +473,8 @@ $theme_id = $this->GetVar('m_theme'); if (!$theme_id) { - $theme_id = $this->GetDefaultThemeId(1); //1 to force front-end mode! - if (!$theme_id) { - return false; - } +// $theme_id = $this->GetDefaultThemeId(1); //1 to force front-end mode! + $theme_id = 'default'; } $this->SetVar('m_theme', $theme_id); $this->SetVar('theme.current_id', $theme_id ); // KOSTJA: this is to fool theme' getPassedId @@ -632,12 +682,12 @@ * @param int $key key name to add to cache * @param mixed $value value of chached record */ - function setCache($cache_name, $key, $value) + function setCache($cache_name, $key, $value, $expiration=3600) { $cache =& $this->recallObject('Cache'); /* @var $cache kCache */ - $cache->setCache($cache_name, $key, $value); + return $cache->setCache($cache_name, $key, $value, $expiration); } /**