[Typo3-dev] caching, CLI, and IMG_RESOURCE
Bernhard Kraft
kraftb at mokka.at
Sun Jan 9 01:39:25 CET 2005
Hi Zach,
Zach Davis wrote:
> Here's the problem: every now and then the client needs to crawl the
> gallery and cache every image. It's very time consuming and CPU
> intensive, so my preference is to make it something that can be run via
> cron or, even better, from the command line. It's easy to write a view
> for the extension that goes through the table and calls cObj->image on
> each record to generate the cached file, but it takes too long and it
> times out.
If your php.ini allows it (safe_mode = off) you could use the function
set_time_limit(0);
to let your script run for as long as it needs.
it is possible that apache times out the tcp connection before ...
to let this not happen you could run your script
from the commandline wit php-cgi or php-cli (debian sarge).
you would just have to slightly modify index.php (create a modified
copy of it) - if your script runs as FE-plugin of course
the only thing you would have to do is
change the first lines of the index.php where the PATHS
are defined.
because you will have to get the PATHS in a different way
if php gets started from the commandline
for an example of an commandline php script take a look at
TYPO3ROOT/typo3/ext/direct_mail/mod/dmailer.phpcron
in the dmailer extension
PS:
Instead of calling set_time_limit(0); once you could
repadetly call
set_time_limit(60);
after each image.
this will allow each image to take 60 seconds to generate.
greets,
bernhard
greets,
Bernhard
More information about the TYPO3-dev
mailing list