public function SiteAuditCheckExtensionsUpdate::calculateScore in Site Audit 7
Implements \SiteAudit\Check\Abstract\calculateScore().
Overrides SiteAuditCheckAbstract::calculateScore
File
- Check/
Extensions/ Update.php, line 86 - Contains \SiteAudit\Check\Extensions\Update.
Class
- SiteAuditCheckExtensionsUpdate
- Class SiteAuditCheckExtensionsUpdate.
Code
public function calculateScore() {
$this->registry['projects_update'] = $this->registry['projects_security'] = array();
$updatestatus_options = array(
'check-disabled' => TRUE,
'lock' => FALSE,
'lock-message' => FALSE,
'security-only' => FALSE,
'unlock' => FALSE,
);
$backend_options = array(
'integrate' => FALSE,
);
$values = drush_invoke_process('@self', 'pm-updatestatus', func_get_args(), $updatestatus_options, $backend_options);
$update_info = $values['object'];
// Only show updatable projects.
foreach ($update_info as $name => $project) {
if (!isset($project['updateable']) || !$project['updateable']) {
unset($update_info[$name]);
}
}
// Build only useful data.
foreach ($update_info as $project_name => $project_data) {
$short_info = array(
'existing_version' => $project_data['existing_version'],
'candidate_version' => $project_data['candidate_version'],
'status_msg' => $project_data['status_msg'],
'label' => $project_data['label'],
);
if (stripos($short_info['status_msg'], 'security') !== FALSE) {
$this->registry['projects_security'][$project_name] = $short_info;
}
else {
$this->registry['projects_update'][$project_name] = $short_info;
}
}
if (!empty($this->registry['projects_update'])) {
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN;
}
return SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS;
}