public function ContribModuleVersionRequirement::verify in Acquia Content Hub 8
Verify no untested module versions are installed.
Overrides ContentHubRequirementBase::verify
File
- acquia_contenthub_diagnostic/
src/ Plugin/ ContentHubRequirement/ ContribModuleVersionRequirement.php, line 26
Class
- ContribModuleVersionRequirement
- Requirement to verify no untested module versions are installed.
Namespace
Drupal\acquia_contenthub_diagnostic\Plugin\ContentHubRequirementCode
public function verify() {
$issues_found = [];
foreach (static::MODULE_VERSIONS as $module => $recommended_version) {
if ($this->moduleHandler
->moduleExists($module)) {
$current_version = \Drupal::service('extension.list.module')
->getAllInstalledInfo()['acquia_contenthub']['version'];
if ($current_version !== $recommended_version) {
$name = $this->moduleHandler
->getName($module);
$issues_found[] = $this
->t('@name @current_version (Recommended @recommended_version)', [
'@name' => $name,
'@current_version' => $current_version,
'@recommended_version' => $recommended_version,
]);
}
}
}
if (empty($issues_found)) {
return REQUIREMENT_OK;
}
$this
->setValue($this
->t('Untested module versions active'));
$this
->setDescription($this
->t('The following untested module versions were found: @module_list', [
'@module_list' => implode(', ', $issues_found),
]));
return REQUIREMENT_WARNING;
}