/** * Implements \SiteAudit\Check\Abstract\calculateScore(). */ public function calculateScore() { $where = core_watchdog_query('php', NULL, NULL); $this->registry['php_counts'] = array(); $this->registry['php_count_total'] = 0; $rsc = drush_db_select('watchdog', '*', $where['where'], $where['args'], 0, NULL, 'wid', 'DESC'); while ($result = drush_db_fetch_object($rsc)) { $row = core_watchdog_format_result($result); if (!isset($this->registry['php_counts'][$row->severity])) { $this->registry['php_counts'][$row->severity] = 0; } $this->registry['php_counts'][$row->severity]++; $this->registry['php_count_total']++; } $this->registry['percent_php'] = 0; if (!$this->registry['php_count_total']) { $this->abort = TRUE; return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS; } $this->registry['percent_php'] = round($this->registry['php_count_total'] / $this->registry['count_entries'] * 100, 2); if ($this->registry['percent_php'] >= 10) { return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN; } return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_INFO; }
/** * Returns a list of enabled modules. * * This is a simplified version of core's module_list(). */ protected function module_list() { $enabled = array(); $rsc = drush_db_select('system', 'name', 'type=:type AND status=:status', array(':type' => 'module', ':status' => 1)); while ($row = drush_db_result($rsc)) { $enabled[$row] = $row; } return $enabled; }