function system_rebuild_module_data

Rebuild, save, and return data about all currently available modules.

Return value

Array of all available modules and their data.

21 calls to system_rebuild_module_data()
BareMinimalUpgradePathTest::testBasicMinimalUpgrade in drupal/core/modules/system/lib/Drupal/system/Tests/Upgrade/BareMinimalUpgradePathTest.php
Tests a successful major version release upgrade.
drupal_flush_all_caches in drupal/core/includes/common.inc
Flushes all persistent caches, resets all variables, and rebuilds all data structures.
EnableDisableTest::testEnableDisable in drupal/core/modules/system/lib/Drupal/system/Tests/Module/EnableDisableTest.php
Tests that all core modules can be enabled, disabled and uninstalled.
field_ui_fields_list in drupal/core/modules/field_ui/field_ui.admin.inc
Page callback: Lists all defined fields for quick reference.
HelpController::helpLinksAsList in drupal/core/modules/help/lib/Drupal/help/Controller/HelpController.php
Provides a formatted list of available help topics.

... See full list

2 string references to 'system_rebuild_module_data'
ModuleApiTest::testDependencyResolution in drupal/core/modules/system/lib/Drupal/system/Tests/Module/ModuleApiTest.php
Test dependency resolution.
system_list_reset in drupal/core/includes/module.inc
Resets all system_list() caches.

File

drupal/core/modules/system/system.module, line 2879
Configuration system that lets administrators modify the workings of the site.

Code

function system_rebuild_module_data() {
  $modules_cache =& drupal_static(__FUNCTION__);

  // Only rebuild once per request. $modules and $modules_cache cannot be
  // combined into one variable, because the $modules_cache variable is reset by
  // reference from system_list_reset() during the rebuild.
  if (!isset($modules_cache)) {
    $modules = _system_rebuild_module_data();
    $files = array();
    ksort($modules);

    // Add name, status, weight, and schema version.
    $enabled_modules = (array) config('system.module')
      ->get('enabled');
    $disabled_modules = (array) config('system.module.disabled')
      ->get();
    $all_modules = $enabled_modules + $disabled_modules;
    foreach ($modules as $module => $record) {
      $record->name = $module;
      $record->weight = isset($all_modules[$module]) ? $all_modules[$module] : 0;
      $record->status = (int) isset($enabled_modules[$module]);
      $record->schema_version = SCHEMA_UNINSTALLED;
      $files[$module] = $record->filename;
    }
    $modules = Drupal::moduleHandler()
      ->buildModuleDependencies($modules);
    $modules_cache = $modules;

    // Store filenames to allow system_list() and drupal_get_filename() to
    // retrieve them without having to rebuild or scan the filesystem.
    Drupal::state()
      ->set('system.module.files', $files);
  }
  return $modules_cache;
}