Merge pull request #17569 from JMAConsulting/core-1805
[civicrm-core.git] / CRM / Queue / Menu.php
CommitLineData
6a488035 1<?php
6a488035
TO
2/*
3 +--------------------------------------------------------------------+
bc77d7c0 4 | Copyright CiviCRM LLC. All rights reserved. |
6a488035 5 | |
bc77d7c0
TO
6 | This work is published under the GNU AGPLv3 license with some |
7 | permitted exceptions and without any warranty. For full license |
8 | and copyright information, see https://civicrm.org/licensing |
6a488035 9 +--------------------------------------------------------------------+
d25dd0ee 10 */
6a488035
TO
11
12/**
13 * This file hard-codes the path entries for the queueing UI, which
14 * allows us to use these paths during upgrades.
15 *
16 * @package CRM
ca5cec67 17 * @copyright CiviCRM LLC https://civicrm.org/licensing
6a488035
TO
18 * $Id$
19 *
20 */
21
22require_once 'CRM/Core/I18n.php';
28518c90
EM
23
24/**
25 * Class CRM_Queue_Menu
26 */
6a488035
TO
27class CRM_Queue_Menu {
28
e0ef6999 29 /**
4523a2f5
TO
30 * @param string $path
31 * The path for which we are trying to locate the route.
32 * @param array $menuPath
33 * The route.
e0ef6999 34 */
4523a2f5 35 public static function alter($path, &$menuPath) {
6a488035
TO
36 switch ($path) {
37 case 'civicrm/queue/runner':
38 case 'civicrm/upgrade/queue/runner':
39 $menuPath['path'] = $path;
40 $menuPath['title'] = 'Queue Runner';
41 $menuPath['page_callback'] = 'CRM_Queue_Page_Runner';
42 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 43 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
44 break;
45
46 case 'civicrm/queue/ajax/runNext':
47 case 'civicrm/upgrade/queue/ajax/runNext':
48 $menuPath['path'] = $path;
be2fb01f 49 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'runNext'];
6a488035 50 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 51 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
52 break;
53
54 case 'civicrm/queue/ajax/skipNext':
55 case 'civicrm/upgrade/queue/ajax/skipNext':
56 $menuPath['path'] = $path;
be2fb01f 57 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'skipNext'];
6a488035 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/onEnd':
63 case 'civicrm/upgrade/queue/ajax/onEnd':
64 $menuPath['path'] = $path;
be2fb01f 65 $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'onEnd'];
6a488035 66 $menuPath['access_arguments'][0][] = 'access CiviCRM';
be2fb01f 67 $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu'];
6a488035
TO
68 break;
69
70 default:
71 // unrecognized
72 }
73 }
96025800 74
6a488035 75}