Minahito
minah****@users*****
2006年 10月 17日 (火) 00:36:26 JST
Index: xoops2jp/html/modules/stdCache/kernel/index.html diff -u xoops2jp/html/modules/stdCache/kernel/index.html:1.1.2.1 xoops2jp/html/modules/stdCache/kernel/index.html:removed --- xoops2jp/html/modules/stdCache/kernel/index.html:1.1.2.1 Mon Mar 27 11:41:58 2006 +++ xoops2jp/html/modules/stdCache/kernel/index.html Tue Oct 17 00:36:26 2006 @@ -1 +0,0 @@ - <script>history.go(-1);</script> \ No newline at end of file Index: xoops2jp/html/modules/stdCache/kernel/StdRenderCache.class.php diff -u xoops2jp/html/modules/stdCache/kernel/StdRenderCache.class.php:1.1.2.3.2.2 xoops2jp/html/modules/stdCache/kernel/StdRenderCache.class.php:removed --- xoops2jp/html/modules/stdCache/kernel/StdRenderCache.class.php:1.1.2.3.2.2 Thu Oct 5 18:10:47 2006 +++ xoops2jp/html/modules/stdCache/kernel/StdRenderCache.class.php Tue Oct 17 00:36:26 2006 @@ -1,90 +0,0 @@ -<?php -// $Id: StdRenderCache.class.php,v 1.1.2.3.2.2 2006/10/05 09:10:47 minahito Exp $ - -require_once XOOPS_ROOT_PATH . "/core/XCube_RenderCache.class.php"; - -/** - * This is standard render cache class. It makes cash by a group of a user. - * Therefore cash does not collide, but a cache file is made a lot. - * - * The processing should be limited so that this class gives standard. - * For example, this makes cash only for a guest with registered user. - */ -class StdRenderCache extends XCube_RenderCache -{ - var $mGroupIds = array(); - - function StdRenderCache() - { - parent::XCube_RenderCache(); - - $root =& XCube_Root::getSingleton(); - - $user =& $root->mContext->mXoopsUser; - - $groups = is_object($user) ? $user->getGroups() : XOOPS_GROUP_ANONYMOUS; - $this->_setGroupIds($groups); - } - - /** - * @return bool - */ - function isCache($cachetime = null) - { - if ($cachetime === 0) { - return false; - } - - if (!$this->enableCache()) { - return false; - } - - $filename = XOOPS_CACHE_PATH . "/" . $this->getCacheId() . ".cache.html"; - if (!file_exists($filename)) { - return false; - } - - if($cachetime === null) { - return true; - } - - // - // Check expire - // - $time = time() - filemtime($filename); - if ($time > $cachetime) { - return false; - } - - return true; - } - - function enableCache() - { - return (count($this->mGroupIds) == 1 && ($this->mGroupIds[0] == XOOPS_GROUP_USERS || $this->mGroupIds[0] == XOOPS_GROUP_ANONYMOUS)); - } - - function _setGroupIds($ids) - { - if (is_array($ids)) { - sort($ids); - $this->mGroupIds = $ids; - } - else { - $this->mGroupIds = array(); - $this->mGroupIds[] = $ids; - } - } - - function getCacheId() - { - return md5($this->mResourceName . implode("_", $this->mGroupIds)); - } - - function _getFileName() - { - return XOOPS_CACHE_PATH . "/" . $this->getCacheId() . ".cache.html"; - } -} - -?> \ No newline at end of file