Skip to content

Commit

Permalink
Merge pull request #11781 from colemanw/MenuHacks
Browse files Browse the repository at this point in the history
Remove hacks from CRM_Core_Menu for old unsupported versions
  • Loading branch information
eileenmcnaughton authored Mar 13, 2018
2 parents 0c17132 + 99a2c00 commit 1811919
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions CRM/Core/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,6 @@ public static function store($truncate = TRUE) {

self::build($menuArray);

$config = CRM_Core_Config::singleton();
$daoFields = CRM_Core_DAO_Menu::fields();

foreach ($menuArray as $path => $item) {
Expand Down Expand Up @@ -673,8 +672,6 @@ public static function get($path) {
// return null if menu rebuild
$config = CRM_Core_Config::singleton();

$params = array();

$args = explode('/', $path);

$elements = array();
Expand All @@ -687,22 +684,13 @@ public static function get($path) {

$queryString = implode(', ', $elements);
$domainID = CRM_Core_Config::domainID();
$domainWhereClause = " AND domain_id = $domainID ";
if ($config->isUpgradeMode() &&
!CRM_Core_DAO::checkFieldExists('civicrm_menu', 'domain_id')
) {
//domain_id wouldn't be available for earlier version of
//3.0 and therefore can't be used as part of query for
//upgrade case
$domainWhereClause = "";
}

$query = "
(
SELECT *
FROM civicrm_menu
WHERE path in ( $queryString )
$domainWhereClause
AND domain_id = $domainID
ORDER BY length(path) DESC
LIMIT 1
)
Expand All @@ -714,7 +702,7 @@ public static function get($path) {
SELECT *
FROM civicrm_menu
WHERE path IN ( 'navigation' )
$domainWhereClause
AND domain_id = $domainID
)
";
}
Expand Down Expand Up @@ -752,12 +740,6 @@ public static function get($path) {
}
}

// *FIXME* : hack for 2.1 -> 2.2 upgrades.
if ($path == 'civicrm/upgrade') {
$menuPath['page_callback'] = 'CRM_Upgrade_Page_Upgrade';
$menuPath['access_arguments'][0][] = 'administer CiviCRM';
$menuPath['access_callback'] = array('CRM_Core_Permission', 'checkMenu');
}
// *FIXME* : hack for 4.1 -> 4.2 upgrades.
if (preg_match('/^civicrm\/(upgrade\/)?queue\//', $path)) {
CRM_Queue_Menu::alter($path, $menuPath);
Expand Down

0 comments on commit 1811919

Please sign in to comment.