Commit 416ac0c5 authored by webchick's avatar webchick
Browse files

Issue #1798760 by ACF, alexpott: Convert menu_masks() to the state system.

parent 6d3b3264
...@@ -319,10 +319,10 @@ function menu_get_ancestors($parts) { ...@@ -319,10 +319,10 @@ function menu_get_ancestors($parts) {
$ancestors = array(); $ancestors = array();
$length = $number_parts - 1; $length = $number_parts - 1;
$end = (1 << $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 // 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 // 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 // default value of the menu.masks variable to avoid building such a big
// array. // array.
if (!$masks) { if (!$masks) {
$masks = range(511, 1); $masks = range(511, 1);
...@@ -453,7 +453,7 @@ function menu_get_item($path = NULL, $router_item = NULL) { ...@@ -453,7 +453,7 @@ function menu_get_item($path = NULL, $router_item = NULL) {
if (!isset($router_items[$path])) { if (!isset($router_items[$path])) {
// Rebuild if we know it's needed, or if the menu masks are missing which // 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. // 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(); menu_router_rebuild();
} }
$original_map = arg(NULL, $path); $original_map = arg(NULL, $path);
...@@ -3784,7 +3784,7 @@ function _menu_router_save($menu, $masks) { ...@@ -3784,7 +3784,7 @@ function _menu_router_save($menu, $masks) {
// Insert any remaining records. // Insert any remaining records.
$insert->execute(); $insert->execute();
// Store the masks. // Store the masks.
variable_set('menu_masks', $masks); state()->set('menu.masks', $masks);
return $menu; return $menu;
} }
......
...@@ -423,7 +423,7 @@ function testMenuHidden() { ...@@ -423,7 +423,7 @@ function testMenuHidden() {
* Test menu_get_item() with empty ancestors. * Test menu_get_item() with empty ancestors.
*/ */
function testMenuGetItemNoAncestors() { function testMenuGetItemNoAncestors() {
variable_set('menu_masks', array()); state()->set('menu.masks', array());
$this->drupalGet(''); $this->drupalGet('');
} }
......
...@@ -2154,6 +2154,14 @@ function system_update_8027() { ...@@ -2154,6 +2154,14 @@ function system_update_8027() {
update_variable_del('javascript_parsed'); update_variable_del('javascript_parsed');
} }
/**
* Remove the 'menu_masks' configuration variable.
*/
function system_update_8028() {
// 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". * @} End of "defgroup updates-7.x-to-8.x".
* The next series of updates should start at 9000. * The next series of updates should start at 9000.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment