Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
416ac0c5
Commit
416ac0c5
authored
Oct 13, 2012
by
Angie Byron
Browse files
Issue
#1798760
by ACF, alexpott: Convert menu_masks() to the state system.
parent
6d3b3264
Changes
3
Hide whitespace changes
Inline
Side-by-side
core/includes/menu.inc
View file @
416ac0c5
...
...
@@ -319,10 +319,10 @@ function menu_get_ancestors($parts) {
$ancestors
=
array
();
$length
=
$number_parts
-
1
;
$end
=
(
1
<<
$number_parts
)
-
1
;
$masks
=
variable_
get
(
'menu
_
masks'
);
// If the optimized menu
_
masks array is not available use brute force to get
$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
// default value of the menu
.
masks variable to avoid building such a big
// array.
if
(
!
$masks
)
{
$masks
=
range
(
511
,
1
);
...
...
@@ -453,7 +453,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
);
...
...
@@ -3784,7 +3784,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
;
}
...
...
core/modules/system/lib/Drupal/system/Tests/Menu/RouterTest.php
View file @
416ac0c5
...
...
@@ -423,7 +423,7 @@ function testMenuHidden() {
* Test menu_get_item() with empty ancestors.
*/
function
testMenuGetItemNoAncestors
()
{
variable_
set
(
'menu
_
masks'
,
array
());
state
()
->
set
(
'menu
.
masks'
,
array
());
$this
->
drupalGet
(
''
);
}
...
...
core/modules/system/system.install
View file @
416ac0c5
...
...
@@ -2154,6 +2154,14 @@ function system_update_8027() {
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".
* The next series of updates should start at 9000.
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment