You are here

public function SiteAuditCheckSecurityHacked::calculateScore in Hacked! 7.2

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

Overrides SiteAuditCheckAbstract::calculateScore

File

./hacked.site_audit.inc, line 78
Contains \SiteAudit\Check\Codebase\Hacked.

Class

SiteAuditCheckSecurityHacked
@file Contains \SiteAudit\Check\Codebase\Hacked.

Code

public function calculateScore() {
  $result = drush_invoke_process('@self', 'hacked-list-projects', array(), array(
    '--include-unchanged=0',
    '--strict=0',
  ), FALSE);
  if ($result === FALSE) {
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
  }
  $rows = array();
  foreach ($result['object'] as $info) {
    if ($info['counts']['different'] != 0) {
      $rows[] = array(
        'project_name' => $info['project_name'],
        'project_title' => $info['title'],
        'project_version' => $info['existing_version'],
        'lines_different' => $info['counts']['different'],
      );
    }
  }
  $this->registry['hacked'] = $result;
  if (empty($result['object'])) {
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
  }
  else {
    if (!empty($rows)) {
      $this->registry['hacked'] = $rows;
      return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
    }
    else {
      return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
    }
  }
}