Re: [SMARTY] cache cron job
| From: | messju mohr | Date: | Wed, 19 Feb 2003 14:46:45 +0000 |
| Subject: | Re: [SMARTY] cache cron job | ||
| References: | 1 2 3 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7881@lists.php.net to get a copy of this message | ||
On Wed, Feb 19, 2003 at 09:29:05AM -0500, Paul Lockaby wrote:
> messju mohr wrote:
> >On Wed, Feb 19, 2003 at 01:32:58AM -0500, Paul Lockaby wrote:
> >
> >>I searched through the old mailing list to find information on running a
> >>cron job to periodically and transparently clear the cache and compiled
> >>templates. I found what I was looking for in this article:
> >>
>
> >>>>http://marc.theaimsgroup.com/?l=smarty-general&m=104093908820181&w=2
> >>
> >>But, if I don't have root access on my box, the cache files are written
> >>as nobody:nobody, and the only user I have access to is paul:paul, how
> >>do I clear the cache without having to call a PHP script? Not possible,
> >>I would imagine, but I have to wonder how the rest of you do it.
> >
> >
> >make the templates_c directory group-sticky and own it to group paul.
> >then all files created in that directory will not be group-owned by
> >the primary group of the process (nobody), but by the group of the
> >directory (paul)
> >
> >chown nobody.paul templates_c # you may need your admin for that
> >chmod 771 templates_c
> >chmod g+s templates_c
> >
> >and set
> >
> >$smarty->_file_perms = 0664
> >$smarty->_dir_perms = 02771 // the 2 is sticky group
> >
> >then the files are owned by nobody, but paul has (due to
> >group-permissions) permission to remove them.
> >
> >HTH
> >messju
> >
> >
>
> Hi,
>
> Thank you for the suggestion. I tried it out on a test machine and
> needed root access to execute all of the commands, and then when I was
> done, I still couldn't do anything with the files as user paul.
1. sorry, i intermixed templates_c and cache i think. but with the cache-
directory it should work the same.
2. you have to delete all the old cache-files that belonged to group
nobody, before. only newly created files have the correct permissions/
ownership.
3. you also have to set "umask(0002);" in your php-file that creates the
files. sorry, i think i overlooked that, too.
> Anyone have any different suggestions? Seriously, how do you people run
> scripts to clear out the cache/compile directories?
serously, sometimes the way i suggested above. but more often with
$smarty->clear_cache() . i don't insist in *not* running a php-script
for that task. i think smarty is the one who created the cache-files
and so it is the one who knows best, how to get rid of them.
HTH
messju
> ~Paul