RE: Deleting cache selectively
| From: | Thomas Pundt | Date: | Mon, 19 Nov 2001 09:35:29 +0000 |
| Subject: | RE: Deleting cache selectively | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-1942@lists.php.net to get a copy of this message | ||
On 16-Nov-01 Francesco Cipriani wrote:
| The problem is that I can determine the page/cacheid used by
| category.php but not by program.php, because program.php uses
| function calls like $tpl->display("program.tpl", $idprog)
| and I don't know in advance what the $idprog passed are.
| I don't want to clear all the cache, and I'm looking for a method to
| clear the cache produced only by program.php.
| I tried $tpl->clear_cache("program.tpl") but with no result.
Smarty-1.4.6 introduced a bug which made exactly this feature
stopping to work. I had to patch Smarty.class.php (attached).
Ciao,
Thomas
--
Thomas Pundt -------------------------- http://rp-online.de/
-----------------
RP-Online Verlagsgesellschaft mbH | pundt@rp-online.de
Blumenstrasse 28, D-40212 Duesseldorf | Schlossstrasse 42, D-40477 Duesseldorf
--- Smarty.class.php Mon Nov 12 12:54:22 2001 +++ /home/toor/Smarty-1.4.6-snap/Smarty.class.php Mon Nov 5 22:24:16 2001 @@ -413,7 +413,7 @@ Function: clear_cache() Purpose: clear cached content for the given template and cache id \*======================================================================*/ - function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null ) + function clear_cache($tpl_file = null, $cache_id = null, $compile_id) { return $this->_rm_auto($this->cache_dir, $tpl_file, $compile_id . $cach e_id); } @@ -1170,7 +1170,7 @@ if (!isset($auto_source)) { $res = $this->_rmdir($auto_base, 0); } else { - if (isset($auto_id) && strlen($auto_id)) { + if (isset($auto_id)) { $tname = $this->_get_auto_filename($auto_base, $auto_source, $a uto_id); $res = is_file($tname) && unlink( $tname); } else {
--- Smarty.class.php Mon Nov 12 12:54:22 2001 +++ /home/toor/Smarty-1.4.6-snap/Smarty.class.php Mon Nov 5 22:24:16 2001 @@ -413,7 +413,7 @@ Function: clear_cache() Purpose: clear cached content for the given template and cache id \*======================================================================*/ - function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null ) + function clear_cache($tpl_file = null, $cache_id = null, $compile_id) { return $this->_rm_auto($this->cache_dir, $tpl_file, $compile_id . $cach e_id); } @@ -1170,7 +1170,7 @@ if (!isset($auto_source)) { $res = $this->_rmdir($auto_base, 0); } else { - if (isset($auto_id) && strlen($auto_id)) { + if (isset($auto_id)) { $tname = $this->_get_auto_filename($auto_base, $auto_source, $a uto_id); $res = is_file($tname) && unlink( $tname); } else {