public function SiteAuditCheckExtensionsRedundant::calculateScore in Site Audit 7
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
Extensions/ Redundant.php, line 87 - Contains \SiteAudit\Check\Extensions\Redundant.
Class
- SiteAuditCheckExtensionsRedundant
- Class SiteAuditCheckExtensionsRedundant.
Code
public function calculateScore() {
$this->registry['extensions_redundant'] = array();
$extension_info = $this->registry['extensions'];
uasort($extension_info, '_drush_pm_sort_extensions');
$redundant_extensions = $this
->getExtensions();
foreach ($extension_info as $extension) {
$row = array();
// Not in the list of known redundant modules.
if (!array_key_exists($extension->name, $redundant_extensions)) {
continue;
}
$in_profile = strpos($extension->filename, 'profiles/') === 0;
$status = drush_get_extension_status($extension);
// If in profiles and disabled, ignore.
if ($in_profile && $status != 'enabled') {
continue;
}
// Name.
$row[] = $extension->label;
// Reason.
$row[] = $redundant_extensions[$extension->name];
$this->registry['extensions_redundant'][$extension->name] = $row;
}
if (!empty($this->registry['extensions_redundant'])) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}