NEW: Adding queued jobs functionality
This commit is contained in:
parent
8753c9337a
commit
7602816d78
11
README.md
11
README.md
|
@ -26,6 +26,17 @@ The external links module is a task and ModelAdmin to track and to report on bro
|
|||
4. Place this directory in your sites root directory. This is the one with framework and cms in it.
|
||||
5. Run in your browser - `/dev/build` to rebuild the database.
|
||||
6. You should see a new menu called *Broken Ext. Links*
|
||||
7. Run the following task *http://path.to.silverstripe/dev/tasks/CheckExternalLinks*
|
||||
|
||||
## Dev task ##
|
||||
|
||||
Run the following task *http://path.to.silverstripe/dev/tasks/CheckExternalLinks* to check your site for external
|
||||
broken links.
|
||||
If you have the queuedjobs module installed you can set the task to be run every so ofter
|
||||
Add the following code to the mysite config to run the job every 24 hours (86400 seconds)
|
||||
|
||||
`Config::inst()->update('CheckExternalLinks', 'QueuedJob', 86400);`
|
||||
|
||||
|
||||
## Disable the Broken external link menu
|
||||
|
||||
|
|
|
@ -63,11 +63,12 @@ class CheckExternalLinks extends BuildTask {
|
|||
}
|
||||
}
|
||||
|
||||
// run this again in 24 hours if queued jobs exists
|
||||
if (class_exists('QueuedJobService')) {
|
||||
// run this again if queued jobs exists and is a valid int
|
||||
$queuedJob = Config::inst()->get('CheckExternalLinks', 'QueuedJob');
|
||||
if (isset($queuedJob) && is_int($queuedJob) && class_exists('QueuedJobService')) {
|
||||
$checkLinks = new CheckExternalLinksJob();
|
||||
singleton('QueuedJobService')
|
||||
->queueJob($checkLinks, date('Y-m-d H:i:s', time() + 86400));
|
||||
->queueJob($checkLinks, date('Y-m-d H:i:s', time() + $queuedJob));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue