NobuNobu
nobun****@users*****
2006年 7月 8日 (土) 11:20:47 JST
Index: xoops2jp/html/modules/legacyRender/preload/Cacheclear.class.php diff -u /dev/null xoops2jp/html/modules/legacyRender/preload/Cacheclear.class.php:1.1.2.1 --- /dev/null Sat Jul 8 11:20:47 2006 +++ xoops2jp/html/modules/legacyRender/preload/Cacheclear.class.php Sat Jul 8 11:20:47 2006 @@ -0,0 +1,25 @@ +<?php +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class legacyRender_Cacheclear extends XCube_ActionFilter { + function preBlockFilter() + { + $this->mController->mRoot->mEventManager->add('Module.Legacy.ModuleInstall.Success', new XCube_Delegate("legacyRender_Cacheclear", "callback")); + $this->mController->mRoot->mEventManager->add('Module.Legacy.ModuleUpdate.Success', new XCube_Delegate("legacyRender_Cacheclear", "callback")); + } + + function callback(&$action, &$module) + { + $handler =& xoops_getmodulehandler('tplfile', 'legacyRender'); + + $criteria =& new Criteria('tpl_module', $module->get('dirname')); + $tplfileArr = $handler->getObjects($criteria); + + $xoopsTpl =& new XoopsTpl(); + foreach (array_keys($tplfileArr) as $key) { + $xoopsTpl->clear_cache('db:' . $tplfileArr[$key]->get('tpl_file')); + $xoopsTpl->clear_compiled_tpl('db:' . $tplfileArr[$key]->get('tpl_file')); + } + } +} +?>