public function SiteAuditCheckBestPracticesSitesSuperfluous::calculateScore in Site Audit 7
Same name and namespace in other branches
- 8.2 Check/BestPractices/SitesSuperfluous.php \SiteAuditCheckBestPracticesSitesSuperfluous::calculateScore()
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
BestPractices/ SitesSuperfluous.php, line 64 - Contains \SiteAudit\Check\BestPractices\SitesSuperfluous.
Class
- SiteAuditCheckBestPracticesSitesSuperfluous
- Class SiteAuditCheckBestPracticesSitesSuperfluous.
Code
public function calculateScore() {
$drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
$handle = opendir($drupal_root . '/sites/');
$this->registry['superfluous'] = array();
while (FALSE !== ($entry = readdir($handle))) {
if (!in_array($entry, array(
'.',
'..',
'default',
'all',
'example.sites.php',
'README.txt',
'.DS_Store',
))) {
if (is_file($drupal_root . '/sites/' . $entry)) {
// Support multi-site directory aliasing for non-Pantheon sites.
if ($entry != 'sites.php' || drush_get_option('vendor') == 'pantheon') {
$this->registry['superfluous'][] = $entry;
}
}
}
}
closedir($handle);
if (!empty($this->registry['superfluous'])) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}