You are here

public function SiteAuditCheckCodebaseSizeFiles::calculateScore in Site Audit 7

Same name and namespace in other branches
  1. 8.2 Check/Codebase/SizeFiles.php \SiteAuditCheckCodebaseSizeFiles::calculateScore()

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

Overrides SiteAuditCheckAbstract::calculateScore

File

Check/Codebase/SizeFiles.php, line 65
Contains \SiteAudit\Check\Codebase\SizeFiles.

Class

SiteAuditCheckCodebaseSizeFiles
Class SiteAuditCheckCodebaseSizeFiles.

Code

public function calculateScore() {
  $drupal_root = drush_get_context('DRUSH_SELECTED_DRUPAL_ROOT');
  exec('du -s -k -x ' . $drupal_root . '/' . variable_get('file_public_path', conf_path() . '/files') . '/', $result);
  $size_files_kb_exploded = explode("\t", trim($result[0]));
  $this->registry['size_files_kb'] = $size_files_kb_exploded[0];
  if (!$this->registry['size_files_kb']) {
    $this->abort = TRUE;
    return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL;
  }
  return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO;
}