User Tools

Site Tools


products:stewjob:start

stewjob

stewjob handles housekeeping for routine maintenance tasks.

It saves you doing all the boilerplate work to get some action from the fox.

You focus on your query to get some rows, and whatever processing you want to do with those rows.

We provide a few simple conventions and OOP does the rest. You can override as little or as much as your job requires.

Jobs

Features

* Fast development for quick fixes You can run a job interactively from the admin panel. Parameters can be tweaked and logs viewed until results are as desired.

* Preview vs Fix Each job can make a change, or just say what the changes will be. You can preview actions before doing them.

* Jobs have comprehensive industry standard logging. On each run you can clear the log or not, and set the PSR level (error,notice,info,warning,debug etc).

* Once you are happy with a job, it can be set as a cron job.

* Cron jobs are exported in standard unix crontab format. Cut and paste into your crontab.

* Jobs can be shared with others easily. A job is completely contained in a single script, so just drop it into the jobs folder and you are ready to run.

What's a job?

We said a job was self-contained in a single php file. Let's look at one now:

class MySweetFix
{
    public function getTitle()
    {
        return 'My Sweet Fix does something sweet!';
    }
    public function getRows()
    {
        return some rows from the database
    }
    public function processRow($row)
    {
        do something with one row
    }
}

That is as simple as we can make it. You focus on what needs to be done. stewjob handles paging, input parameters, logging and all the housekeeping details.

We write jobs to ….

* To update counters. Because stewjob runs way faster that the standard phpfox admincp. And because we have counters fox never dreamed of.

* To check data integrity. Ensure every message has a user, every comment has a post, every thumbnail has database entry etc.

* To fix data integrity (same as checking, but not in preview mode!). Our “fix” is usually to delete the orphaned or questionable entry.

* For mass updates. Send notification blah for every user in group blah. Archive activity points monthly. Upgrade memberships. Watermark photos.

* Out of curiosity. How many members in group X sent more than 20 messages in the last week of August? It's a quick n dirty way to query your database within the beast itself. A job runs in Phpfox so all services libraries etc are available to relate and massage the results.

* Tired but true: Sky is the limit! Jobs are limited only by your imagination

Job details

Job paging

Cron jobs

June 2015. In place but not yet tested and solid.

Jobs can be submitted to cron.

We provide the additional parameters you might normally use in a unix crontab editor, and we'll dump the whole file in crontab format so you can cut and paste into your system.

When you make a job into a cron job, we take a snapshot of your parameters and use them to start the run. The job will process as many rows as you specified then quit. When it is fired again it will resume where it left off. When it finds no more input it will start again at the beginning. So it can be constantly scanning your tables, updating your cache, or alerting you to errors…

Notes

products/stewjob/start.txt · Last modified: 2015/06/05 12:10 by steward