diff --git a/core/includes/menu.inc b/core/includes/menu.inc index f21bd1f..3527f39 100644 --- a/core/includes/menu.inc +++ b/core/includes/menu.inc @@ -318,7 +318,7 @@ function menu_get_ancestors($parts) { $ancestors = array(); $length = $number_parts - 1; $end = (1 << $number_parts) - 1; - $masks = variable_get('menu_masks'); + $masks = state()->get('menu_masks'); // If the optimized menu_masks array is not available use brute force to get // the correct $ancestors and $placeholders returned. Do not use this as the // default value of the menu_masks variable to avoid building such a big @@ -451,7 +451,7 @@ function menu_get_item($path = NULL, $router_item = NULL) { if (!isset($router_items[$path])) { // Rebuild if we know it's needed, or if the menu masks are missing which // occurs rarely, likely due to a race condition of multiple rebuilds. - if (state()->get('menu_rebuild_needed') || !variable_get('menu_masks', array())) { + if (state()->get('menu_rebuild_needed') || !state()->get('menu_masks')) { menu_router_rebuild(); } $original_map = arg(NULL, $path); @@ -3776,7 +3776,7 @@ function _menu_router_save($menu, $masks) { // Insert any remaining records. $insert->execute(); // Store the masks. - variable_set('menu_masks', $masks); + state()->set('menu_masks', $masks); return $menu; } diff --git a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php index 9483261..68353fd 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php @@ -423,7 +423,7 @@ class RouterTest extends WebTestBase { * Test menu_get_item() with empty ancestors. */ function testMenuGetItemNoAncestors() { - variable_set('menu_masks', array()); + state()->set('menu_masks', array()); $this->drupalGet(''); } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index 05459d0..b5b0115 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -2102,6 +2102,14 @@ function system_update_8022() { } /** + * Remove the 'menu_masks' configuration variable. + */ +function system_update_8023() { + // No upgrade path needed since the menu router will be rebuilt during d7 to d8 upgrade. + update_variable_del('menu_masks'); +} + +/** * @} End of "defgroup updates-7.x-to-8.x". * The next series of updates should start at 9000. */