Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3338541
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3338541
Commits
8895f5cd
Commit
8895f5cd
authored
12 years ago
by
catch
Browse files
Options
Downloads
Patches
Plain Diff
Issue
#916388
by Berdir: Follow-up, improve menu_rebuild() performance.
parent
ba89738c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php
+7
-9
7 additions, 9 deletions
...u_link/lib/Drupal/menu_link/MenuLinkStorageController.php
with
7 additions
and
9 deletions
core/modules/menu_link/lib/Drupal/menu_link/MenuLinkStorageController.php
+
7
−
9
View file @
8895f5cd
...
...
@@ -331,7 +331,7 @@ public function loadModuleAdminTasks() {
*/
protected
function
updateParentalStatus
(
EntityInterface
$entity
,
$exclude
=
FALSE
)
{
// If plid == 0, there is nothing to update.
if
(
$entity
->
plid
&&
(
$parent_entity
=
$this
->
load
(
array
(
$entity
->
plid
)))
)
{
if
(
$entity
->
plid
)
{
// Check if at least one visible child exists in the table.
$query
=
entity_query
(
$this
->
entityType
);
$query
...
...
@@ -345,9 +345,10 @@ protected function updateParentalStatus(EntityInterface $entity, $exclude = FALS
}
$parent_has_children
=
((
bool
)
$query
->
execute
())
?
1
:
0
;
$parent_entity
=
reset
(
$parent_entity
);
$parent_entity
->
has_children
=
$parent_has_children
;
$parent_entity
->
save
();
db_update
(
'menu_links'
)
->
fields
(
array
(
'has_children'
=>
$parent_has_children
))
->
condition
(
'mlid'
,
$entity
->
plid
)
->
execute
();
}
}
...
...
@@ -416,8 +417,6 @@ protected function findParent(EntityInterface $entity, array $parent_candidates
$parent
=
FALSE
;
$parent_path
=
substr
(
$parent_path
,
0
,
strrpos
(
$parent_path
,
'/'
));
// @todo Return to the previous method of cloning the entity query when
// http://drupal.org/node/1829942 is fixed.
$query
=
entity_query
(
$this
->
entityType
);
$query
->
condition
(
'mlid'
,
$entity
->
id
(),
'<>'
)
...
...
@@ -427,10 +426,9 @@ protected function findParent(EntityInterface $entity, array $parent_candidates
->
condition
(
'menu_name'
,
$entity
->
menu_name
)
->
condition
(
'link_path'
,
$parent_path
);
$
count_query
=
clone
$query
;
$
result
=
$query
->
execute
()
;
// Only valid if we get a unique result.
if
(
$count_query
->
count
()
->
execute
()
==
1
)
{
$result
=
$query
->
execute
();
if
(
count
(
$result
)
==
1
)
{
$parent
=
$this
->
load
(
$result
);
$parent
=
reset
(
$parent
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment