Sometimes it turns out that CRON in drupal requires a LOT of memory, often the problem comes up as a memory exhausted message in menu.inc
This turns out to be because the menu_rebuild is called many times when its actually is only needed to be called once.
This is my quick-fix and i know hacking drupal core isn't the way to go
--- includes/menu.inc.old 2015-02-11 11:01:12.411387934 +0000
+++ includes/menu.inc 2015-02-11 11:10:16.204995356 +0000
@@ -2717,6 +2717,16 @@
return FALSE;
}
+// ****************************
+// Added by arne@hortell.se
+// Found it in admin menus
+
+ $was_flushed = &drupal_static(__FUNCTION__, array());
+ if (isset($was_flushed[$uid])) {
+ return FALSE;
+ }
+// *****************************
+
$transaction = db_transaction();
try {
@@ -2727,6 +2737,11 @@
menu_cache_clear_all();
_menu_clear_page_cache();
+// ****************************
+// Added by arne@hortell.se
+ $was_flushed[$uid] = TRUE;
+// *****************************
+
if (defined('MAINTENANCE_MODE')) {
variable_set('menu_rebuild_needed', TRUE);
}
Comments
Thank you for this. However,
Thank you for this. However, this is the forum section, so you will probably need to create an issue in Drupal core 7.x issue queue.
What's new and changing in PHP 8
Now in core issues
Thanks for pointing that out.
Drupal core page
Nothing is impossible, the impossible just takes a little more time
$uid not known issue
After running the patch above at some sites with good results, it turned out one site (with a lots of logging) complained that variable $uid was unknown.
Therefore i fixed it by adding global $user and changed $uid to $user->hid like this
Sometimes it turns out that CRON in drupal requires a LOT of memory, often the problem comes up as a memory exhausted message in menu.inc
This turns out to be because the menu_rebuild is called many times when its actually is only needed to be called once.
This is my quick-fix and i know hacking drupal core isn't the way to go
--- includes/menu.inc.old 2015-02-11 11:01:12.411387934 +0000
+++ includes/menu.inc 2015-02-11 11:10:16.204995356 +0000
@@ -2717,6 +2717,16 @@
return FALSE;
}
+// ****************************
+// Added by arne@hortell.se
+// Found it in admin menus
+
+ $was_flushed = &drupal_static(__FUNCTION__, array());
+ global $user;
+ if (isset($was_flushed[$user->uid])) {
+ return FALSE;
+ }
+// *****************************
+
$transaction = db_transaction();
try {
@@ -2727,6 +2737,11 @@
menu_cache_clear_all();
_menu_clear_page_cache();
+// ****************************
+// Added by arne@hortell.se
+ global $user;
+ $was_flushed[$user->uid] = TRUE;
+// *****************************
+
if (defined('MAINTENANCE_MODE')) {
variable_set('menu_rebuild_needed', TRUE);
}
Nothing is impossible, the impossible just takes a little more time