MissingProjectInfo.php in Automatic Updates 8
File
src/ReadinessChecker/MissingProjectInfo.php
View source
<?php
namespace Drupal\automatic_updates\ReadinessChecker;
use Drupal\automatic_updates\IgnoredPathsTrait;
use Drupal\automatic_updates\ProjectInfoTrait;
use Drupal\Core\Extension\ExtensionList;
use Drupal\Core\StringTranslation\StringTranslationTrait;
class MissingProjectInfo implements ReadinessCheckerInterface {
use IgnoredPathsTrait;
use ProjectInfoTrait;
use StringTranslationTrait;
protected $modules;
protected $profiles;
protected $themes;
public function __construct(ExtensionList $modules, ExtensionList $profiles, ExtensionList $themes) {
$this->modules = $modules;
$this->profiles = $profiles;
$this->themes = $themes;
}
public function run() {
return $this
->missingProjectInfoCheck();
}
protected function missingProjectInfoCheck() {
$messages = [];
foreach ($this
->getExtensionsTypes() as $extension_type) {
foreach ($this
->getInfos($extension_type) as $info) {
if ($this
->isIgnoredPath($info['install path'])) {
continue;
}
if (!$info['version']) {
$messages[] = $this
->t('The project "@extension" can not be updated because its version is either undefined or a dev release.', [
'@extension' => $info['name'],
]);
}
}
}
return $messages;
}
protected function getExtensionsTypes() {
return [
'modules',
'profiles',
'themes',
];
}
}