The code in hook_flush_caches() was run on every cron invocation on older D7 versions:

But even then re-building the menu router an be quite costly and if no theme has breakpoints there is no need to clear the menu cache.

diff --git a/sites/all/modules/contrib/breakpoints/breakpoints.module b/sites/all/modules/contrib/breakpoints/breakpoints
index 68e9ee0..e76fddc 100644
--- a/sites/all/modules/contrib/breakpoints/breakpoints.module
+++ b/sites/all/modules/contrib/breakpoints/breakpoints.module
@@ -59,6 +59,8 @@ function breakpoints_enable() {
  * Do not use breakpoints_breakpoints_group_reload_from_theme as is clears the cache.
  */
 function breakpoints_themes_enabled($theme_list) {
+  $menu_rebuild_needed = FALSE;
+
   $themes = list_themes();
   foreach ($theme_list as $theme_key) {
     if (isset($themes[$theme_key]->info['breakpoints'])) {
@@ -97,9 +99,14 @@ function breakpoints_themes_enabled($theme_list) {
         '!grouplink' => l(t('a new group is created'), 'admin/config/media/breakpoints/groups/' . $theme_key),
       ));
       drupal_set_message($message, 'status');
+
+      $menu_rebuild_needed = TRUE;
     }
   }
-  menu_rebuild();
+
+  if ($menu_rebuild_needed) {
+    variable_set('menu_rebuild_needed', TRUE);
+  }
 }
 
 /**

fixes the problem.

It is also a good idea to just set the variable instead of clearing the cache directly.

Comments

Fabianx created an issue. See original summary.

Fabianx’s picture

Status: Active » Needs review
attiks’s picture

Something similar is already in the dev branch

oadaeh’s picture

Status: Needs review » Fixed

I think this can be closed, since the code is now in 7.x-1.6.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.