. */ if (!defined('GNUSOCIAL')) { exit(1); } class RunqueueAction extends Action { protected $qm = null; protected function prepare(array $args = []) { parent::prepare($args); $args = []; if ($this->arg('qmkey') !== null) { $args['qmkey'] = $this->arg('qmkey'); } try { $this->qm = new OpportunisticQueueManager($args); } catch (RunQueueBadKeyException $e) { return false; } header('Content-type: text/plain; charset=utf-8'); return true; } protected function handle() { // We don't need any of the parent functionality from parent::handle() here. // runQueue is a loop that works until limits have passed or there is no more work if ($this->qm->runQueue() === true) { // We don't have any more work $this->text('0'); } else { // There were still items left in queue when we aborted $this->text('1'); } } }