You are here

protected function ProjectInfoTrait::getInfos in Automatic Updates 8

Returns an array of info files information of available extensions.

Parameters

string $extension_type: The extension type.

Return value

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

4 calls to ProjectInfoTrait::getInfos()
InPlaceUpdate::checkModifiedFiles in src/Services/InPlaceUpdate.php
Check if files are modified before applying updates.
MissingProjectInfo::missingProjectInfoCheck in src/ReadinessChecker/MissingProjectInfo.php
Check for projects missing project info.
ModifiedFiles::modifiedFilesCheck in src/ReadinessChecker/ModifiedFiles.php
Check if the site contains any modified code.
ModifiedFilesController::modified in tests/modules/test_automatic_updates/src/Controller/ModifiedFilesController.php
Test modified files service.
1 method overrides ProjectInfoTrait::getInfos()
TestMissingProjectInfo::getInfos in tests/src/Kernel/ReadinessChecker/MissingProjectInfoTest.php
Returns an array of info files information of available extensions.

File

src/ProjectInfoTrait.php, line 39

Class

ProjectInfoTrait
Provide a helper to get project info.

Namespace

Drupal\automatic_updates

Code

protected function getInfos($extension_type) {
  $file_paths = $this
    ->getExtensionList($extension_type)
    ->getPathnames();
  $infos = $this
    ->getExtensionList($extension_type)
    ->getAllAvailableInfo();
  array_walk($infos, function (array &$info, $key) use ($file_paths) {
    $info['packaged'] = isset($info['datestamp']) ? $info['datestamp'] : FALSE;
    $info['install path'] = $file_paths[$key] ? dirname($file_paths[$key]) : '';
    $info['project'] = $this
      ->getProjectName($key, $info);
    $info['version'] = $this
      ->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;

    // From 8.8.0 onward, always use packaged for core because non-packaged
    // will no longer make any sense.
    if (version_compare(\Drupal::VERSION, '8.8.0', '>=')) {
      $infos['drupal']['packaged'] = TRUE;
    }
  }
  return $infos;
}