diff -u b/core/modules/system/system.module b/core/modules/system/system.module --- b/core/modules/system/system.module +++ b/core/modules/system/system.module @@ -852,18 +852,25 @@ * @see \Drupal\Core\Extension\ThemeHandlerInterface::rebuildThemeData() */ function system_get_info($type, $name = NULL) { + $info_static = &drupal_static(__FUNCTION__ . ':module'); $info = array(); + if ($type == 'module') { - if ($cache = \Drupal::cache()->get('system.module.data')) { - $data = $cache->data; + if (isset($info_static)) { + // Get info from static cache. + $info = $info_static; + } + elseif ($cache = \Drupal::cache()->get('system.module.info')) { + $info = $cache->data; } else { $data = system_rebuild_module_data(); - } - foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) { - if (isset($data[$module])) { - $info[$module] = $data[$module]->info; + foreach (\Drupal::moduleHandler()->getModuleList() as $module => $filename) { + if (isset($data[$module])) { + $info[$module] = $data[$module]->info; + } } + \Drupal::cache()->set('system.module.info', $info); } } else { @@ -1006,12 +1013,13 @@ // system_rebuild_module_data() to reset this key, such as when // listing modules, (un)installating modules, importing configuration, // updating the site and when flushing all caches. - \Drupal::cache()->set('system.module.data', $modules); $modules_cache = $modules; // Store filenames to allow drupal_get_filename() to // retrieve them without having to rebuild or scan the filesystem. \Drupal::state()->set('system.module.files', $files); + // Clear module info cache. + \Drupal::cache()->delete('system.module.info'); } return $modules_cache; }