Re: [SMARTY] Re: [SMARTY-DEV] SV: [SMARTY] RC2 released
| From: | Mark Rogers | Date: | Thu, 27 Mar 2003 14:14:12 +0000 |
| Subject: | Re: [SMARTY] Re: [SMARTY-DEV] SV: [SMARTY] RC2 released | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-8940@lists.php.net to get a copy of this message | ||
Hinrich Donner wrote:
> I have created a simple method for this.
Further to this, I have just put the following method into my custom Smarty
class, together with code to call it at the end of the constructor:
function _CheckSmartyVersion() {
$fn = $this->compile_dir.'smarty-release-'.$this->_version;
if (!file_exists($fn)) {
$this->clear_all_cache();
$this->clear_compiled_tpl();
touch($fn);
return FALSE;
}
return TRUE;
}
All it does is check for the existance of a file called smarty-release-2.4.1
(or whatever the current release is) in the Smarty compile directory. If it
is there the correct version of compiled code is assumed. If not, the cached
and compiled files are cleared and the file is created.
Seems to work (on my test site) - suggestions for improvements welcomed.
Perhaps something similar should go into Smarty itself?
Note that it has the added advantage of causing the cache to be cleared if
the file is not present, so deleting the smarty-release-x.x.x file is a
quick way to cause the compiled code to be cleared from the command line (or
from a cron job or whatever, for those who like to periodically delete the
files).
Mark Rogers,
Quarella (More Solutions) Ltd