Monday 02 February 2004 6:33:05 am
To make a cron job update this page is a good idèa. The simplest way of doing this would be to use apache rewrite rules to something like:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} !^POST$
RewriteCond /home/bf/public_html/3.3/static$1/index.html -f
RewriteRule ^(.*)$ /eznostatic$1/index.html [L]
RewriteRule !\.(gif|css|jpg|png|jar|ico|js)$ /index.php
This rewrite rule will check if a static version of the page exists in the folder static/ under the eZ publish root ( /home/bf/public_html/3.3/ ). If it's found it serves the static page. To regenerate this page you could simply do a wget to the file and store it in that directory. E.g. the url www.example.com/myfolder/article would look for a static file in static/myfolder/article/index.html. So this could be generated by doing a "wget www.example.com/myfolder/article" which would store the content in static/myfolder/article/index.html. This could then be run e.g. every 5/10/30 minutes. Also see that sitecopy contribution from Denis, which does a setup like this. Note: you need to have a different virtualhost without this rewriterule which is used for the cron job to do the wget ( since the normal site will only serve the cached static version of the page ). Note2: this only works if you don't have different content for every user. E.g. a login box with username. If you don't want to use rewrite rules you still can run the cronjob, However the page will only be fetched and the eZ publish internal cache will be stored. If a user requests this page before the cronjob he will still get the slow page. 3.4 will support caching on publishing, but this is not yet available. I hope this answered your question. --bård
Documentation: http://ez.no/doc
|