14 public $_mFilePath =
null;
18 $this->_mFilePath = XOOPS_CACHE_PATH .
'/' . md5(XOOPS_SALT) .
'.cache.html';
19 return parent::prepare();
22 public function execute()
24 $root =& XCube_Root::getSingleton();
26 if (!$root->mController->isEnableCacheFeature()) {
33 $options = explode(
'|', $this->_mBlock->get(
'options'));
34 if (!file_exists($this->_mFilePath)) {
38 if (filemtime($this->_mFilePath) < time() - (
int)$options[0] * 60) {
39 if ($handler = opendir(XOOPS_CACHE_PATH)) {
40 while (
false !== ($file = readdir($handler))) {
41 if (preg_match(
"/\w+\.cache\.html$/", $file, $matches)) {
42 @unlink(XOOPS_CACHE_PATH .
'/' . $matches[0]);
52 public function updateTimer()
54 $fp = fopen($this->_mFilePath,
'wb');
65 $options = explode(
'|', $this->_mBlock->get(
'options'));
67 $root =& XCube_Root::getSingleton();
68 $renderSystem =& $root->getRenderSystem(
'Legacy_AdminRenderSystem');
69 $renderTarget =& $renderSystem->createRenderTarget();
71 $renderTarget->setAttribute(
'legacy_module',
'stdCache');
72 $renderTarget->setTemplateName(
'block_cacheclear_option.html');
73 $renderTarget->setAttribute(
'timer', $options[0]);
75 $renderSystem->render($renderTarget);
76 return $renderTarget->getResult();