3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2015 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 require_once 'CRM/Core/Page.php';
32 * The queue-runner page provides an interactive, web-based system
33 * running the tasks in a queue and monitoring its progression.
35 * Do not link or redirect to this page directly -- go through
36 * CRM_Queue_Runner::runAllViaWeb().
38 * Note: The queue runner only requires 'access CiviCRM' permission.
39 * To ensure that malicious parties don't use this feature to
40 * run queues on the wrong schedule, the queue-runner has an
41 * extra authorization step: it checks for a session variable named
42 * $_SESSION['queueRunners][$qrid]. This variable is properly setup
43 * if you use the CRM_Queue_Runner::runAllViaWeb() interface.
45 class CRM_Queue_Page_Runner
extends CRM_Core_Page
{
49 * POST Param 'qrid': string, usually the name of the queue
51 public function run() {
52 $qrid = CRM_Utils_Request
::retrieve('qrid', 'String', $this, TRUE);
53 $runner = CRM_Queue_Runner
::instance($qrid);
54 if (!is_object($runner)) {
55 CRM_Core_Error
::fatal('Queue runner must be configured before execution.');
58 CRM_Utils_System
::setTitle($runner->title
);
59 $this->assign('queueRunnerData', array(
60 'qrid' => $runner->qrid
,
61 'runNextAjax' => CRM_Utils_System
::url($runner->pathPrefix
. '/ajax/runNext', NULL, FALSE, NULL, FALSE),
62 'skipNextAjax' => CRM_Utils_System
::url($runner->pathPrefix
. '/ajax/skipNext', NULL, FALSE, NULL, FALSE),
63 'onEndAjax' => CRM_Utils_System
::url($runner->pathPrefix
. '/ajax/onEnd', NULL, FALSE, NULL, FALSE),
65 'numberOfItems' => $runner->queue
->numberOfItems(),
66 'buttons' => $runner->buttons
,
69 if ($runner->isMinimal
) {
71 if (!defined('CIVICRM_UF_HEAD') && $region = CRM_Core_Region
::instance('html-header', FALSE)) {
72 CRM_Utils_System
::addHTMLHead($region->render(''));
74 $smarty = CRM_Core_Smarty
::singleton();
75 $content = $smarty->fetch('CRM/Queue/Page/Runner.tpl');
76 echo CRM_Utils_System
::theme($content, $this->_print
, TRUE);