Templates not getting recompiled
| From: | Peter Bowen | Date: | Tue, 29 Oct 2002 04:42:12 +0000 |
| Subject: | Templates not getting recompiled | ||
| Groups: | php.smarty.dev | ||
| Request: | Send a blank email to php-smarty-dev+get-302@lists.php.net to get a copy of this message | ||
I've been using smarty for a few months, and have found it to work
really well. However, I have seen a situation where a template is
updated, yet smarty doesn't detect the change and recompile it.
After some research, it turns out the problem is that smarty compares
the template's mtime to the compiled template's mtime. This works, as
long at the updated template has a newer mtime than the compiled
version. This assumes that every time a template is updated, its mtime
changes to the current time. Unfortunately, in our case, this isn't
always true.
Our development group writes the software and packages it using RPM.
Then QA tests it and finally production updates the public servers.
When the packages are installed, the files have the mtime of when the
developers last changed the templates, not when they were installed on
the public servers. This occasionally results in the template mtime
being older than the latest compile mtime.
The attached patch fixes this by setting the mtime of the compiled
version to the mtime of the original file.
Thanks.
Peter
Attachment: [text/x-patch] Smarty-2.3.0-mtime.patch
Attachment: [text/x-patch] Smarty-2.3.0-mtime.patch