cvs: smarty / NEWS /libs Smarty.class.php
| From: | Messju Mohr | Date: | Fri, 21 Mar 2003 15:39:30 +0000 |
| Subject: | cvs: smarty / NEWS /libs Smarty.class.php | ||
| Groups: | php.smarty.cvs | ||
| Request: | Send a blank email to php-smarty-cvs+get-492@lists.php.net to get a copy of this message | ||
messju Fri Mar 21 10:39:30 2003 EDT
Modified files:
/smarty NEWS
/smarty/libs Smarty.class.php
Log:
renamed $localvars to $_localvars in cache-file-handling-functions,
added _get_auto_id()-function
Index: smarty/NEWS
diff -u smarty/NEWS:1.325 smarty/NEWS:1.326
--- smarty/NEWS:1.325 Fri Mar 21 04:07:56 2003
+++ smarty/NEWS Fri Mar 21 10:39:29 2003
@@ -1,3 +1,5 @@
+ - renamed $localvars to $_localvars in cache-file-handling-functions,
+ added _get_auto_id()-function (messju)
- swapped compile_id and cache_id in read_cache_file and write_cache_file
(messju)
- reverted patch for cache-file-handling (messju)
Index: smarty/libs/Smarty.class.php
diff -u smarty/libs/Smarty.class.php:1.368 smarty/libs/Smarty.class.php:1.369
--- smarty/libs/Smarty.class.php:1.368 Fri Mar 21 04:36:16 2003
+++ smarty/libs/Smarty.class.php Fri Mar 21 10:39:29 2003
@@ -911,18 +911,13 @@
if (!isset($compile_id))
$compile_id = $this->compile_id;
- if (isset($cache_id))
- $auto_id = (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id;
- elseif(isset($compile_id))
- $auto_id = $compile_id;
- else
- $auto_id = null;
+ $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
if (!empty($this->cache_handler_func)) {
- $funcname = $this->cache_handler_func;
- return $funcname('clear', $this, $dummy, $tpl_file, $cache_id, $compile_id);
+ $_funcname = $this->cache_handler_func;
+ return $_funcname('clear', $this, $dummy, $tpl_file, $cache_id, $compile_id);
} else {
- return $this->_rm_auto($this->cache_dir, $tpl_file, $auto_id, $exp_time);
+ return $this->_rm_auto($this->cache_dir, $tpl_file, $_auto_id, $exp_time);
}
}
@@ -2280,19 +2275,13 @@
if (!empty($this->cache_handler_func)) {
// use cache_handler function
- $funcname = $this->cache_handler_func;
- return $funcname('write', $this, $results, $tpl_file, $cache_id,
$compile_id);
+ $_funcname = $this->cache_handler_func;
+ return $_funcname('write', $this, $results, $tpl_file, $cache_id,
$compile_id);
} else {
// use local cache file
- if (isset($cache_id))
- $auto_id = (isset($compile_id)) ? $cache_id . '|' . $compile_id :
$cache_id;
- elseif(isset($compile_id))
- $auto_id = $compile_id;
- else
- $auto_id = null;
-
- $cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $auto_id);
- $this->_write_file($cache_file, $results, true);
+ $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
+ $_cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $_auto_id);
+ $this->_write_file($_cache_file, $results, true);
return true;
}
}
@@ -2322,19 +2311,13 @@
if (!empty($this->cache_handler_func)) {
// use cache_handler function
- $funcname = $this->cache_handler_func;
- $funcname('read', $this, $results, $tpl_file, $cache_id, $compile_id);
+ $_funcname = $this->cache_handler_func;
+ $_funcname('read', $this, $results, $tpl_file, $cache_id, $compile_id);
} else {
// use local cache file
- if (isset($cache_id))
- $auto_id = (isset($compile_id)) ? $cache_id . '|' . $compile_id :
$cache_id;
- elseif(isset($compile_id))
- $auto_id = $compile_id;
- else
- $auto_id = null;
-
- $cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $auto_id);
- $results = $this->_read_file($cache_file);
+ $_auto_id = $this->_get_auto_id($cache_id, $compile_id);
+ $_cache_file = $this->_get_auto_filename($this->cache_dir, $tpl_file, $_auto_id);
+ $results = $this->_read_file($_cache_file);
}
if (empty($results)) {
@@ -2385,7 +2368,16 @@
return true;
}
-
+
+ function _get_auto_id($cache_id=null, $compile_id=null) {
+ if (isset($cache_id))
+ return (isset($compile_id)) ? $cache_id . '|' . $compile_id : $cache_id;
+ elseif(isset($compile_id))
+ return $compile_id;
+ else
+ return null;
+ }
+
/**
* get filepath of requested plugin
*