public function SiteAuditCheckExtensionsUnused::calculateScore in Unused Modules 7
Same name and namespace in other branches
- 8 unused_modules.site_audit.inc \SiteAuditCheckExtensionsUnused::calculateScore()
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- ./
unused_modules.site_audit.inc, line 77 - Contains \SiteAudit\Check\Extensions\Unused.
Class
- SiteAuditCheckExtensionsUnused
- @file Contains \SiteAudit\Check\Extensions\Unused.
Code
public function calculateScore() {
$this->registry['unused_projects'] = array();
$extensions = _unused_modules_get_modules_by_project();
foreach ($extensions as $extension_data) {
if (!$extension_data->project_has_enabled_modules) {
$whitelisted_extensions = array(
// Intentional stub.
'views_export',
);
$whitelisted_paths = array(
// Sample.
'sites/all/modules/coder/coder_upgrade/tests/new/samples',
);
if (!in_array($extension_data->project, $whitelisted_extensions) && !in_array($extension_data->module_path, $whitelisted_paths)) {
$this->registry['unused_projects'][$extension_data->project] = $extension_data->project_path;
}
}
}
if (!empty($this->registry['unused_projects'])) {
ksort($this->registry['unused_projects']);
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}