You are here

function prod_check_execute_check in Production check & Production monitor 6

Same name and namespace in other branches
  1. 7 prod_check.module \prod_check_execute_check()

Function that gives status feedback on requirements.

Parameters

checks an associative array of associative arrays consisting of the: following keys: #title: the title to be displayed in the status table #state: true or false, see examples on how to use this #severity: the severity when the check fails #value_ok: value to show when check will pass #value_nok: to show when check will fail #description_ok: description to show when check will pass #description_nok: description to show when check will fail

Return value

array result array that can be themed with the 'status_report' theme.

32 calls to prod_check_execute_check()
_prod_check_admin_username in ./prod_check.module
Simple check to ensure the admin username is not easily guessable by a robot.
_prod_check_anonymous_rights in ./prod_check.module
_prod_check_apc_opc in ./prod_check.module
_prod_check_block_cache in ./prod_check.module
_prod_check_boost in ./prod_check.module

... See full list

File

./prod_check.module, line 440

Code

function prod_check_execute_check($checks, $caller, $compatibility = 'all') {
  $result = array();
  if (is_array($checks) && $compatibility == 'all') {
    foreach (element_children($checks) as $key) {
      if (!$checks[$key]['#state']) {

        // Check failed
        switch ($caller) {
          case 'internal':
          case 'xmlrpc':
            $result[$key] = array(
              'title' => $checks[$key]['#title'],
              'value' => $checks[$key]['#value_nok'],
              'severity' => $checks[$key]['#severity'],
              'description' => $checks[$key]['#description_nok'],
            );
            break;
          case 'nagios':
            $result[$checks[$key]['#nagios_key']] = array(
              'status' => $checks[$key]['#severity'],
              'type' => $checks[$key]['#nagios_type'],
              'text' => strip_tags($checks[$key]['#description_nok']),
            );
            break;
        }
      }
      else {

        // Check passed
        switch ($caller) {
          case 'internal':
          case 'xmlrpc':
            $result[$key] = array(
              'title' => $checks[$key]['#title'],
              'value' => $checks[$key]['#value_ok'],
              'severity' => PROD_CHECK_REQUIREMENT_OK,
              'description' => $checks[$key]['#description_ok'],
            );
            break;
          case 'nagios':
            $result[$checks[$key]['#nagios_key']] = array(
              'status' => NAGIOS_STATUS_OK,
              'type' => $checks[$key]['#nagios_type'],
              'text' => strip_tags($checks[$key]['#description_ok']),
            );
            break;
        }
      }
    }
  }
  elseif (is_array($checks) && $compatibility == 'prod_mon') {
    $result = $checks;
  }
  return $result;
}