Merge pull request #15644 from civicrm/5.19
[civicrm-core.git] / CRM / Queue / Menu.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
fee14197 4 | CiviCRM version 5 |
6a488035 5 +--------------------------------------------------------------------+
6b83d5bd 6 | Copyright CiviCRM LLC (c) 2004-2019 |
6a488035
TO
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
9 | |
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. |
13 | |
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. |
18 | |
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 +--------------------------------------------------------------------+
d25dd0ee 26 */
6a488035
TO
27
28/**
29 * This file hard-codes the path entries for the queueing UI, which
30 * allows us to use these paths during upgrades.
31 *
32 * @package CRM
6b83d5bd 33 * @copyright CiviCRM LLC (c) 2004-2019
6a488035
TO
34 * $Id$
35 *
36 */
37
38require_once 'CRM/Core/I18n.php';
28518c90
EM
39
40/**
41 * Class CRM_Queue_Menu
42 */
6a488035
TO
43class CRM_Queue_Menu {
44
e0ef6999 45 /**
4523a2f5
TO
46 * @param string $path
47 * The path for which we are trying to locate the route.
48 * @param array $menuPath
49 * The route.
e0ef6999 50 */
4523a2f5 51 public static function alter($path, &$menuPath) {
6a488035
TO
52 switch ($path) {
53 case 'civicrm/queue/runner':
54 case 'civicrm/upgrade/queue/runner':
55 $menuPath['path'] = $path;
56 $menuPath['title'] = 'Queue Runner';
57 $menuPath['page_callback'] = 'CRM_Queue_Page_Runner';
58 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 59 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
60 break;
61
62 case 'civicrm/queue/ajax/runNext':
63 case 'civicrm/upgrade/queue/ajax/runNext':
64 $menuPath['path'] = $path;
be2fb01f 65 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'runNext'];
6a488035 66 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 67 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
68 break;
69
70 case 'civicrm/queue/ajax/skipNext':
71 case 'civicrm/upgrade/queue/ajax/skipNext':
72 $menuPath['path'] = $path;
be2fb01f 73 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'skipNext'];
6a488035 74 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 75 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
76 break;
77
78 case 'civicrm/queue/ajax/onEnd':
79 case 'civicrm/upgrade/queue/ajax/onEnd':
80 $menuPath['path'] = $path;
be2fb01f 81 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'onEnd'];
6a488035 82 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 83 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
84 break;
85
86 default:
87 // unrecognized
88 }
89 }
96025800 90
6a488035 91}