Re: [SMARTY-DEV] clear_compiled_tpl() bug or missing feature

From: Date: Thu, 06 Nov 2003 16:00:08 +0000
Subject: Re: [SMARTY-DEV] clear_compiled_tpl() bug or missing feature
References: 1 2 3  Groups: php.smarty.dev 
Request: Send a blank email to php-smarty-dev+get-1914@lists.php.net to get a copy of this message
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 *

« previous php.smarty.dev (#1914) next »