You are here

function SystemList::systemListBootstrap in X Autoload 7.5

Replicates system_list('bootstrap')

Return value

array|null

See also

system_list()

File

tests/src/VirtualDrupal/SystemList.php, line 93

Class

SystemList

Namespace

Drupal\xautoload\Tests\VirtualDrupal

Code

function systemListBootstrap() {
  $lists =& $this->drupalStatic
    ->get('system_list');

  // For bootstrap modules, attempt to fetch the list from cache if possible.
  // if not fetch only the required information to fire bootstrap hooks
  // in case we are going to serve the page from cache.
  if (isset($lists['bootstrap'])) {
    return $lists['bootstrap'];
  }
  if ($cached = $this->cache
    ->cacheGet('bootstrap_modules', 'cache_bootstrap')) {
    $bootstrap_list = $cached->data;
  }
  else {
    $bootstrap_list = $this->systemListLoader
      ->fetchBootstrapSystemList();
    $this->cache
      ->cacheSet('bootstrap_modules', $bootstrap_list, 'cache_bootstrap');
  }

  // To avoid a separate database lookup for the filepath, prime the
  // drupal_get_filename() static cache for bootstrap modules only.
  // The rest is stored separately to keep the bootstrap module cache small.
  foreach ($bootstrap_list as $module) {
    $this->drupalGetFilename
      ->drupalSetFilename('module', $module->name, $module->filename);
  }

  // We only return the module names here since module_list() doesn't need
  // the filename itself.
  return $lists['bootstrap'] = array_keys($bootstrap_list);
}