(NFC) (dev/core#878) Simplify '@copyright' annotation
[civicrm-core.git] / CRM / Queue / Menu.php
1 <?php
2 /*
3 +--------------------------------------------------------------------+
4 | CiviCRM version 5 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2020 |
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 +--------------------------------------------------------------------+
26 */
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
33 * @copyright CiviCRM LLC https://civicrm.org/licensing
34 * $Id$
35 *
36 */
37
38 require_once 'CRM/Core/I18n.php';
39
40 /**
41 * Class CRM_Queue_Menu
42 */
43 class CRM_Queue_Menu {
44
45 /**
46 * @param string $path
47 * The path for which we are trying to locate the route.
48 * @param array $menuPath
49 * The route.
50 */
51 public static function alter($path, &$menuPath) {
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';
59 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
60 break;
61
62 case 'civicrm/queue/ajax/runNext':
63 case 'civicrm/upgrade/queue/ajax/runNext':
64 $menuPath['path'] = $path;
65 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'runNext'];
66 $menuPath['access_arguments'][0][] = 'access CiviCRM';
67 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
68 break;
69
70 case 'civicrm/queue/ajax/skipNext':
71 case 'civicrm/upgrade/queue/ajax/skipNext':
72 $menuPath['path'] = $path;
73 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'skipNext'];
74 $menuPath['access_arguments'][0][] = 'access CiviCRM';
75 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
76 break;
77
78 case 'civicrm/queue/ajax/onEnd':
79 case 'civicrm/upgrade/queue/ajax/onEnd':
80 $menuPath['path'] = $path;
81 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'onEnd'];
82 $menuPath['access_arguments'][0][] = 'access CiviCRM';
83 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
84 break;
85
86 default:
87 // unrecognized
88 }
89 }
90
91 }