cvs: pear /Cache/Container file.php
| From: | Christian Stocker | Date: | Mon, 25 Feb 2002 02:34:28 +0000 |
| Subject: | cvs: pear /Cache/Container file.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-2604@lists.php.net to get a copy of this message | ||
chregu Sun Feb 24 21:34:28 2002 EDT
Modified files:
/pear/Cache/Container file.php
Log:
Make list of existing group dirs a class attribute, not only a static variable.
(Otherwise flushing of groups and saving to them afterwards produced errors,
'cause class thought directory does still exists...)
Index: pear/Cache/Container/file.php
diff -u pear/Cache/Container/file.php:1.3 pear/Cache/Container/file.php:1.4
--- pear/Cache/Container/file.php:1.3 Sat Feb 23 13:33:08 2002
+++ pear/Cache/Container/file.php Sun Feb 24 21:34:28 2002
@@ -16,7 +16,7 @@
// | Sebastian Bergmann <sb@sebastian-bergmann.de> |
// +----------------------------------------------------------------------+
//
-// $Id: file.php,v 1.3 2002/02/23 18:33:08 mj Exp $
+// $Id: file.php,v 1.4 2002/02/25 02:34:28 chregu Exp $
require_once('Cache/Container.php');
@@ -24,7 +24,7 @@
* Stores cache contents in a file.
*
* @author Ulf Wendel <ulf.wendel@phpdoc.de>
-* @version $Id: file.php,v 1.3 2002/02/23 18:33:08 mj Exp $
+* @version $Id: file.php,v 1.4 2002/02/25 02:34:28 chregu Exp $
*/
class Cache_Container_file extends Cache_Container {
@@ -94,6 +94,7 @@
mkdir($this->cache_dir, 0755);
}
$this->entries = array();
+ $this->group_dirs = array();
} // end func contructor
@@ -174,6 +175,7 @@
$dir = ($group) ? $this->cache_dir . $group . '/' : $this->cache_dir;
$num_removed = $this->deleteDir($dir);
+ unset($this->group_dirs[$group]);
clearstatcache();
return $num_removed;
@@ -282,10 +284,9 @@
* @access public
*/
function getFilename($id, $group) {
- static $group_dirs = array();
- if (isset($group_dirs[$group]))
- return $group_dirs[$group] . $this->filename_prefix . $id;
+ if (isset($this->group_dirs[$group]))
+ return $this->group_dirs[$group] . $this->filename_prefix . $id;
$dir = $this->cache_dir . $group . '/';
if (!file_exists($dir)) {
@@ -293,7 +294,7 @@
clearstatcache();
}
- $group_dirs[$group] = $dir;
+ $this->group_dirs[$group] = $dir;
return $dir . $this->filename_prefix . $id;
} // end func getFilename