| 1 | <?php |
| 2 | /* |
| 3 | +--------------------------------------------------------------------+ |
| 4 | | Copyright CiviCRM LLC. All rights reserved. | |
| 5 | | | |
| 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 | |
| 9 | +--------------------------------------------------------------------+ |
| 10 | */ |
| 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 |
| 17 | * @copyright CiviCRM LLC https://civicrm.org/licensing |
| 18 | */ |
| 19 | |
| 20 | require_once 'CRM/Core/I18n.php'; |
| 21 | |
| 22 | /** |
| 23 | * Class CRM_Queue_Menu |
| 24 | */ |
| 25 | class CRM_Queue_Menu { |
| 26 | |
| 27 | /** |
| 28 | * @param string $path |
| 29 | * The path for which we are trying to locate the route. |
| 30 | * @param array $menuPath |
| 31 | * The route. |
| 32 | */ |
| 33 | public static function alter($path, &$menuPath) { |
| 34 | switch ($path) { |
| 35 | case 'civicrm/queue/runner': |
| 36 | case 'civicrm/upgrade/queue/runner': |
| 37 | $menuPath['path'] = $path; |
| 38 | $menuPath['title'] = 'Queue Runner'; |
| 39 | $menuPath['page_callback'] = 'CRM_Queue_Page_Runner'; |
| 40 | $menuPath['access_arguments'][0][] = 'access CiviCRM'; |
| 41 | $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu']; |
| 42 | break; |
| 43 | |
| 44 | case 'civicrm/queue/ajax/runNext': |
| 45 | case 'civicrm/upgrade/queue/ajax/runNext': |
| 46 | $menuPath['path'] = $path; |
| 47 | $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'runNext']; |
| 48 | $menuPath['access_arguments'][0][] = 'access CiviCRM'; |
| 49 | $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu']; |
| 50 | break; |
| 51 | |
| 52 | case 'civicrm/queue/ajax/skipNext': |
| 53 | case 'civicrm/upgrade/queue/ajax/skipNext': |
| 54 | $menuPath['path'] = $path; |
| 55 | $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'skipNext']; |
| 56 | $menuPath['access_arguments'][0][] = 'access CiviCRM'; |
| 57 | $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu']; |
| 58 | break; |
| 59 | |
| 60 | case 'civicrm/queue/ajax/onEnd': |
| 61 | case 'civicrm/upgrade/queue/ajax/onEnd': |
| 62 | $menuPath['path'] = $path; |
| 63 | $menuPath['page_callback'] = ['CRM_Queue_Page_AJAX', 'onEnd']; |
| 64 | $menuPath['access_arguments'][0][] = 'access CiviCRM'; |
| 65 | $menuPath['access_callback'] = ['CRM_Core_Permission', 'checkMenu']; |
| 66 | break; |
| 67 | |
| 68 | default: |
| 69 | // unrecognized |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | } |