You are here

public function SiteAuditCheckBestPracticesMultisite::calculateScore in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/BestPractices/Multisite.php \SiteAuditCheckBestPracticesMultisite::calculateScore()

Implements \SiteAudit\Check\Abstract\calculateScore().

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/BestPractices/Multisite.php, line 66
Contains \SiteAudit\Check\BestPractices\Multisite.

Class

SiteAuditCheckBestPracticesMultisite
Class SiteAuditCheckBestPracticesMultisite.

Code

public function calculateScore() {
  $drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
  $handle = opendir($drupal_root . '/sites/');
  $this->registry['multisites'] = array();
  while (FALSE !== ($entry = readdir($handle))) {
    if (!in_array($entry, array(
      '.',
      '..',
      'default',
      'all',
      'example.sites.php',
      'README.txt',
      '.svn',
      '.DS_Store',
    ))) {
      if (is_dir($drupal_root . '/sites/' . $entry)) {
        $this->registry['multisites'][] = $entry;
      }
    }
  }
  closedir($handle);
  if (!empty($this->registry['multisites'])) {
    if (drush_get_option('vendor') == 'pantheon') {
      return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
    }
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
  }
  return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}