Re: [SMARTY-DEV] clear_compiled_tpl() bug or missing feature
| From: | Monte Ohrt | Date: | Fri, 07 Nov 2003 20:06:56 +0000 |
| Subject: | Re: [SMARTY-DEV] clear_compiled_tpl() bug or missing feature | ||
| References: | 1 2 3 4 | Groups: | php.smarty.dev |
| Request: | Send a blank email to php-smarty-dev+get-1920@lists.php.net to get a copy of this message | ||
This function would have to be run manually after an upgrade of smarty,
I'm not sure what advantage this has over just removing the files from
template_c and cache files.
On Thu, 2003-11-06 at 10:00, Jan Rosier / Interstroom wrote:
> Monte Ohrt <monte@ispi.net> wrote:
> > As long as testing for template versions does not take a performance
> > hit, I'd be for it. I wonder if we should integrate the version number
> > into the template filename creation process. This way when you
> > upgrade,
> > new compiled files (and cache files) will get created. This leaves old
> > versions of template files around, but does not add version testing
> > logic.
> >
> > And of course, we should make the version value more granular so this
> > is usable.
> >
> > Monte
> >
>
> I like the idea of adding the version value into the filename.
>
> To prevent bulky cache and compile dirs a function like the one below could
> be added. This function must be call after the compile_dir is set.
>
> /**
> * This method check the current version of Smarty. On different
> * versions the compiled and cached templates are deleted.
> *
> * @access public
> */
> function clear_invalid_files()
> {
> $fname = $this->compile_dir . DIRECTORY_SEPARATOR . '.version-' .
> $this->_version;
> if (!file_exists($fname)) {
> $this->clear_all_cache();
> $this->clear_compiled_tpl();
> touch($fname);
> }
> }
>
>
> Greetings,
> Jan Rosier
>
> * The greatest lesson in life is to know that even fools are right
> sometimes. - Sir Winston Leonard Spencer Churchill *