You are here

protected static function ProjectInfoTrait::getInfos in Automatic Updates 7

Returns an array of info files information of available extensions.

Return value

array An associative array of extension information arrays, keyed by extension name.

3 calls to ProjectInfoTrait::getInfos()
InPlaceUpdate::checkModifiedFiles in ./InPlaceUpdate.php
Check if files are modified before applying updates.
MissingProjectInfo::missingProjectInfoCheck in ReadinessCheckers/MissingProjectInfo.php
Check for projects missing project info.
ModifiedFiles::modifiedFilesCheck in ReadinessCheckers/ModifiedFiles.php
Check if the site contains any modified code.

File

./ProjectInfoTrait.php, line 15

Class

ProjectInfoTrait
Provide a helper to get project info.

Code

protected static function getInfos() {
  $infos = [];

  // Find extensions.
  $extensions = drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\\.info$/', 'modules', $key = 'name', $min_depth = 1);
  $extensions = array_merge($extensions, drupal_system_listing('/^' . DRUPAL_PHP_FUNCTION_PATTERN . '\\.info$/', 'themes', $key = 'name', $min_depth = 1));
  foreach ($extensions as $extension) {
    if (file_exists($info_file = dirname($extension->uri) . '/' . $extension->name . '.info')) {

      // Get the .info file for the module or theme this file belongs to.
      $infos[$extension->name] = drupal_parse_info_file($info_file);
      $info =& $infos[$extension->name];
      $info['packaged'] = isset($info['project']) ? $info['project'] : FALSE;
      $info['install path'] = dirname($extension->uri);
      $info['project'] = self::getProjectName($extension->name, $info);
      $info['version'] = self::getExtensionVersion($info);
    }
  }
  $system = isset($infos['system']) ? $infos['system'] : NULL;
  $infos = array_filter($infos, static function (array $info, $project_name) {
    return $info && $info['project'] === $project_name;
  }, ARRAY_FILTER_USE_BOTH);
  if ($system) {
    $infos['drupal'] = $system;
  }
  return $infos;
}