function drush_prod_check_status in Production check & Production monitor 6
Same name and namespace in other branches
- 7 prod_check.drush.inc \drush_prod_check_status()
Status page callback
1 string reference to 'drush_prod_check_status'
- prod_check_drush_command in ./
prod_check.drush.inc - Implementation of hook_drush_command().
File
- ./
prod_check.drush.inc, line 30
Code
function drush_prod_check_status() {
// Map error codes to shell colours.
$severity = array(
PROD_CHECK_REQUIREMENT_INFO => '1',
PROD_CHECK_REQUIREMENT_OK => '1;32',
PROD_CHECK_REQUIREMENT_WARNING => '1;33',
PROD_CHECK_REQUIREMENT_ERROR => '1;31',
);
$error = 0;
$functions = _prod_check_functions();
// Not needed here.
unset($functions['prod_mon']);
unset($functions['perf_data']);
foreach ($functions as $set => $data) {
$rows[] = array(
'',
);
$rows[] = array(
"\33[1m" . dt($data['title']) . "\33[0m",
);
foreach ($data['functions'] as $function => $title) {
$result = call_user_func($function);
$func = ltrim($function, '_');
if (is_array($result) && !empty($result)) {
$rows[] = array(
$result[$func]['title'],
"\33[" . $severity[$result[$func]['severity']] . 'm' . strip_tags($result[$func]['value']) . "\33[0m",
);
if ($error < $result[$func]['severity']) {
$error = $result[$func]['severity'];
}
}
}
}
drush_print("\33[1m" . dt('Production Check status') . "\33[0m", 1);
drush_print_table($rows);
if ($error > 0) {
// Would be cool if we could prefix the admin path with http://<host>/ so it
// will become a clickable link in some terminals. Any ideas?
drush_print("\33[1m" . dt('Some errors were reported!') . "\33[0m " . dt('Check the full status page on') . " \33[1m" . 'admin/reports/prod-check' . "\33[0m " . dt('for details.'));
}
}