conditional execution of a script on mod times

#1
What I would like is, in the webserver context, ie at webserver execution speed, to compare the mod time (or existance of a static file) and a 'flag' file.

I want to leverage the speed of 'up to date' static pages, but to be able to regenerate 'old' or missing pages from database content using scripts - at run time.

The idea is that a CMS modifies an internal version of a page part (eg a title page) and, at the same time, touches some 'well known' filename. The webserver comes along and compares the mod time of the file and the 'well known' (or 'flag') filename. If that 'flag' file is newer, then a page regeneration script is run and a redirect sent after the new version is (re)generated.

A hierarchy would be good...

Obviously one can do this in the FCGI entity of your choice, but that slows the whole site down.

I have large sites where parts are not looked at from one month to the next, but detail changes are made to the look and feel in other parts. The sites are otherwise static - with no *runtime* dynamic content (although the actual content is operated on by the CMS and stored in databases of various kinds).

Does this make sense? I know that if a .html is missing mod_rewrite can be persuaded to regenerate it, but, AFAIK there is no facility to compare the modtimes of two files in mod_rewrite.
 

mistwang

LiteSpeed Staff
#2
I understand. I think it is better to do it in more generic way.
Looks like what you want is something like SSI + Cache. Those are on our to do list, SSI will be implemented soon, but cache will not be available for a while.

I think what you want can be archived now with mod_rewirte + some backend cron jobs.

Are you able to do this with Apache now?

George
 
#3
No you can't do it with apache (AFAIK).

And I don't want a cache. I can do caches :)

This sort of feature (which could be made part of mod_rewrite) would be generally very useful.

The whole point of this is to make static sites, just that; but with the advantages of easy global change and 'lazy' regeneration.

To re-iterate, SSI doesn't give me what I require (eg looking at databases) and caches simply moves the problem, but doesn't solve it: I only want to run a script if a page needs to be regenerated. I don't want to go *near* a (F)CGI interface unless I really need to.
 

mistwang

LiteSpeed Staff
#4
Then what you need is to use a backend job to remove outdated files, and use a rewrite rule to detect missing files and forward request to a script to generate the file on the fly.

Our SSI will allow you to include output from a (F)CGI, so content could be dynamic generated from DB. Dynamic content could be cached if it does not change frequently.

LiteSpeed SSI + Cache could be the most scalable solution for web pages with partial dyanmic content that don't change very often. :)
 
Top