Minahito
minah****@users*****
2006年 10月 17日 (火) 00:11:58 JST
Index: xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php diff -u xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php:1.1.2.3 xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php:1.1.2.4 --- xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php:1.1.2.3 Mon Oct 16 16:39:20 2006 +++ xoops2jp/html/modules/legacy/kernel/Legacy_Controller.class.php Tue Oct 17 00:11:58 2006 @@ -67,17 +67,12 @@ /** * @var XCube_Delegate */ - var $mCheckEnableBlockCache = null; + var $mSetBlockCachePolicy = null; /** * @var XCube_Delegate */ - var $mCheckEnableModuleCache = null; - - /** - * @var XCube_Delegate - */ - var $mGetBlockCacheFilePath = null; + var $mSetModuleCachePolicy = null; /** * @var XCube_Delegate @@ -118,10 +113,8 @@ $this->mGetLanguageName =& new XCube_Delegate(); $this->mGetLanguageName->register("Legacy_Controller.GetLanguageName"); - $this->mCheckEnableBlockCache =& new XCube_Delegate(); - $this->mCheckEnableModuleCache =& new XCube_Delegate(); - $this->mGetModuleCacheFilePath =& new XCube_Delegate(); - $this->mGetBlockCacheFilePath =& new XCube_Delegate(); + $this->mSetBlockCachePolicy =& new XCube_Delegate(); + $this->mSetModuleCachePolicy =& new XCube_Delegate(); $this->mSetupDebugger =& new XCube_Delegate(); $this->mSetupDebugger->add('Legacy_DebuggerManager::createInstance'); @@ -280,7 +273,6 @@ // object in the foreach loop. // $context =& $this->mRoot->mContext; - $cacheInfo =& new Legacy_BlockCacheInformation(); foreach ($this->_mBlockChain as $blockProcedure) { // @@ -293,11 +285,10 @@ // // Reset the block cache information structure, and initialize. // - $cacheInfo->reset(); - $cacheInfo->setBlock($blockProcedure); //< FIXME - $this->mCheckEnableBlockCache->call(new XCube_Ref($cacheInfo)); - - $filepath = $this->getBlockCacheFilePath($cacheInfo); + $cacheInfo =& $blockProcedure->createCacheInfo(); + + $this->mSetBlockCachePolicy->call(new XCube_Ref($cacheInfo)); + $filepath = $cacheInfo->getCacheFilePath(); // // If caching is enable and the cache file exists, load and use. @@ -336,7 +327,7 @@ ); if ($this->isEnableCacheFeature() && $blockProcedure->getCacheTime() > 0 && $cacheInfo->isEnableCache()) { - $this->cacheRenderTarget($this->getBlockCacheFilePath($cacheInfo), $renderBuffer); + $this->cacheRenderTarget($cacheInfo->getCacheFilePath(), $renderBuffer); } } @@ -699,7 +690,7 @@ if ($this->mRoot->mContext->mModule != null && $this->isEnableCacheFeature()) { $cacheInfo =& $this->mRoot->mContext->mModule->createCacheInfo(); - $this->mCheckEnableModuleCache->call(new XCube_Ref($cacheInfo)); + $this->mSetModuleCachePolicy->call($cacheInfo); if ($this->mRoot->mContext->mModule->hasCacheConfig()) { // @@ -708,20 +699,20 @@ $xoopsModule =& $this->mRoot->mContext->mXoopsModule; $cachetime = $this->mRoot->mContext->mXoopsConfig['module_cache'][$xoopsModule->get('mid')]; - $filepath = $this->getModuleCacheFilePath($cacheInfo); + $filepath = $cacheInfo->getCacheFilePath(); // // Checks whether the active cache file exists. If it's OK, load // cache and do display. // if ($cacheInfo->isEnableCache() && $this->existActiveCacheFile($filepath, $cachetime)) { - $renderSystem =& $this->mRoot->getRenderSystem($this->mModule->getRenderSystemName()); + $renderSystem =& $this->mRoot->getRenderSystem($this->mRoot->mContext->mModule->getRenderSystemName()); $renderTarget =& $renderSystem->createRenderTarget(XCUBE_RENDER_TARGET_TYPE_MAIN); $renderTarget->setResult($this->loadCache($filepath)); $this->_executeViewTheme($renderTarget); - exit(0); + exit(); } } } @@ -772,7 +763,7 @@ // if ($this->isEnableCacheFeature() && $this->mRoot->mContext->mModule->hasCacheConfig()) { if ($this->mRoot->mContext->mModule->mCacheInfo->isEnableCache()) { - $this->cacheRenderTarget($this->getModuleCacheFilePath($this->mRoot->mContext->mModule->mCacheInfo), $renderTarget); + $this->cacheRenderTarget($this->mRoot->mContext->mModule->mCacheInfo->getCacheFilePath(), $renderTarget); } } else { @@ -1151,42 +1142,6 @@ } /** - * Gets a file path of a cache file for module contents. - * @param Legacy_ModuleCacheInformation $cacheInfo - * @return string - */ - function getModuleCacheFilePath(&$cacheInfo) - { - $filepath = null; - $this->mGetModuleCacheFilePath->call(new XCube_Ref($filepath), $cacheInfo); - - if (!$filepath) { - $id = md5(XOOPS_SALT . $cacheInfo->mURL . "(" . implode("_", $cacheInfo->mIdentityArr) . ")" . implode("_", $cacheInfo->mGroupArr)); - $filepath = XOOPS_CACHE_PATH . "/" . $id . ".cache.html"; - } - - return $filepath; - } - - /** - * Gets a file path of a cache file for module contents. - * @param Legacy_BlockCacheInformation $cacheInfo - * @return string - */ - function getBlockCacheFilePath(&$cacheInfo) - { - $filepath = null; - $this->mGetBlockCacheFilePath->call(new XCube_Ref($filepath), $cacheInfo); - - if (!$filepath) { - $id = md5(XOOPS_SALT . $cacheInfo->mBlock->get('bid') . "(" . implode("_", $cacheInfo->mIdentityArr) . ")" . implode("_", $cacheInfo->mGroupArr)); - $filepath = XOOPS_CACHE_PATH . "/" . $id . ".cache.html"; - } - - return $filepath; - } - - /** * Save the content of $renderTarget to $filepath. * @param string $filepath a file path of the cache file. * @param XCube_RenderTarget $renderBuffer