public function SiteAuditCheckCodebaseSizeFiles::calculateScore in Site Audit 8.2
Same name and namespace in other branches
- 7 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');
$settings = \Drupal::service('settings');
$kernel = \Drupal::service('kernel');
exec('du -s -k -x ' . $drupal_root . '/' . $settings
->get('file_public_path', $kernel
->getSitePath() . '/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;
}