public function ExtensionsUnrecommended::calculateScore in Site Audit 8.3
.
Overrides SiteAuditCheckBase::calculateScore
File
- src/
Plugin/ SiteAuditCheck/ ExtensionsUnrecommended.php, line 86
Class
- ExtensionsUnrecommended
- Provides the ExtensionsUnrecommended Check.
Namespace
Drupal\site_audit\Plugin\SiteAuditCheckCode
public function calculateScore() {
$this->registry->extensions_unrec = [];
if (!isset($this->registry->extensions)) {
$this
->checkInvokeCalculateScore('extensions_count');
}
$extension_info = $this->registry->extensions;
// uasort($extension_info, '_drush_pm_sort_extensions');.
$unrecommended_extensions = $this
->getExtensions();
foreach ($extension_info as $extension) {
$row = [];
$machine_name = $extension
->getName();
// Not in the list of known unrecommended modules.
if (!array_key_exists($machine_name, $unrecommended_extensions)) {
continue;
}
// Name.
$row[] = $extension->label;
// Reason.
$row[] = $unrecommended_extensions[$machine_name];
$this->registry->extensions_unrec[$machine_name] = $row;
}
if (!empty($this->registry->extensions_unrec)) {
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_FAIL;
}
return SiteAuditCheckBase::AUDIT_CHECK_SCORE_PASS;
}