Re: [SMARTY-DEV] Clear templates and cache
[email protected] (pete M)
| Newsgroups | php.smarty.dev |
|---|---|
| Message-ID | <[email protected]> |
Mark Rogers wrote: > pete M writes: > > >>Following on from the opcode posting.... >> >>One of the little niggles in upgrading Smarty is having to clear the >>templates_c and cache directories. >> >>The following postings by boots and Jan Rosier seem to resolve the >>problem. Could this not go in the official Smarty ?? > > > This first (to my recollection) came up on the general list just over a year > ago (I posted some code to do this on the 27th March 2003). I have been > using this method ever since. > > The argument against adding it to Smarty as a default action is that it > requires an extra filesystem call on each page load. Do you mean what boots mentioned >>> >>>In my custom Smarty class, for example, I have it track the >>> version of the files in the cache/compiled directories by writing a >>> version file and comparing it to the running version of Smarty. It >>> will clear the directory on a mismatch (and then rewrite the version >>> file). This has never been a > problem to me, and the code has been extremely helpful. (Also, each project > on my server has a local copy of Smarty which is a symlink into an archive > of various versions of Smarty, so to change from one version to another I > simply replace the symlink and everything else is automatic, although I do > now need to investigate the op-code caching issues Monte raised.) Being able > to quickly delete the complete compiled file cache simply by deleting the > version check file is somthing else I find very hand on occassion (this is a > useful side effect of the way the code works). > > My personal view is that the default install should do this, but with an > easy (documented) way to turn it off. Anyone planning to use Smarty in a > serious environment (ie where the overhead of an extra filesystem call per > page is significant) would be a fool if they did so without reading the > documentation! On the other hand, I can well understand that new users do > not read and digest everything when they first dip their toe into Smarty > waters, and this kind of problem helps to limit the accessibility of Smarty > to new users (which I think to be a bad thing). Like this idea ;-) $smarty->version_flush = true; Pete M >