3 class OpportunisticQMPlugin extends Plugin {
5 public $secs_per_action = 1; // total seconds to run script per action
6 public $rel_to_pageload = true; // relative to pageload or queue start
9 public function onRouterInitialized($m)
11 $m->connect('main/runqueue', array('action' => 'runqueue'));
15 * When the page has finished rendering, let's do some cron jobs
16 * if we have the time.
18 public function onEndActionExecute(Action $action)
20 if ($action instanceof RunqueueAction) {
27 'qmkey' => common_config('opportunisticqm', 'qmkey'),
28 'max_execution_time' => $this->secs_per_action,
29 'started_at' => $this->rel_to_pageload ? $_startTime : null,
30 'verbosity' => $this->verbosity,
32 $qm = new OpportunisticQueueManager($args);
37 public function onPluginVersion(array &$versions)
39 $versions[] = array('name' => 'OpportunisticQM',
40 'version' => GNUSOCIAL_VERSION,
41 'author' => 'Mikael Nordfeldth',
42 'homepage' => 'http://www.gnu.org/software/social/',
44 // TRANS: Plugin description.
45 _m('Opportunistic queue manager plugin for background processing.'));