Save Expand icon

Ron Valstar
front-end developer

Cronfaker plugin

You might have noticed: this plugin has been discontinued.

Cron jobs are a Unix way executing files at scheduled times. If you don’t have acces to them there are ways to fake it. I figured out a long time ago that letting certain hits trigger the executions works just as well. It’s less punctual than a real cron job but I don’t care.
The thing to keep in mind is that some jobs, like heavy duty image creation or sql queries, can take up a noticable amount of time (and I’m not all that when it comes to fast queries). Now I don’t want to scare of people with a long download time just because I want to execute some fake cron job. And here’s the good news: humans are not the only ones to visit web sites. The web is teeming with automated programs that roam the web for information. These bots, spiders, crawlers and whateverthingies are not as easily scared away as humans are, so why not let them trigger the cron jobs.

This plugin I wrote is quite simple.
You can easily invoke it from your own plugins like so:

register_cronfaker(name:string, interval:integer, function:string);

When running the server will detect wether the visiting entity is a bot or not. When it is it will check if your plugin is due for execution by comparing it to a large delimited string in the options table that contains the name and last timestamp of your execution.
So the intervals are variable. Functions with identical intervals do not nescesarily execute at the same time. It is possible that different functions execute at the same time but who cares, the’re bots.

So, in short, the following:

register_cronfaker('sparkline', 60*60, 'sjtspkl_create');

means that the function sjtspkl_create() is executed roughly every 3600 seconds and identified by the name ‘sparkline’. I can’t make it any easier than that.

download

version size date download
1.1 2KB 2007 01 31 download

changelog

version date changes
1.1 2007 02 12
  • made it faster

installation

Unzip and place the folder in your plugins directory. Press ‘activate’ from the plugins menu.