You are here

public function SiteAuditCheckExtensionsMissing::calculateScore in Site Audit 7

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

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/Extensions/Missing.php, line 64
Contains \SiteAudit\Check\Extensions\Missing.

Class

SiteAuditCheckExtensionsMissing
Class SiteAuditCheckExtensionsMissing.

Code

public function calculateScore() {
  $this->registry['extensions_missing'] = array();
  $drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
  $result = db_select('system')
    ->fields('system', array(
    'name',
    'filename',
  ))
    ->condition('status', '1', '=')
    ->execute();
  foreach ($result as $row) {
    if (!file_exists($drupal_root . '/' . $row->filename)) {
      $this->registry['extensions_missing'][] = $row->name;
    }
  }
  if (!empty($this->registry['extensions_missing'])) {
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
  }
  return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}