function hook_status

Reports status information which each module is aware of, visible on admin/config/status.

This allows modules to let the user know about requirements which are not being met, or simply to let them know that someting is working successfully.

For example, you may want to let the user know that a nightly job failed to run the night before.

2 functions implement hook_status()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

system_status in modules/system/system.module
Implementation of hook_status Expected return is array( "severity" => "normal" or "warning" or "alert", "status" => "A message to display to the user.", );
update_status_status in modules/update_status/update_status.module
Implementation of hook_status.

File

includes/hook.api.php, line 55
Lists all available hooks within FlightPath's core code.

Code

function hook_status() {
  // Example from system.module, reporting on if Cron has run recently:
  $rtn = array();
  $rtn ["severity"] = "normal";
  // Check on the last time cron was run; make sure it's working properly.
  $last_run = variable_get("cron_last_run", 0);

  if ($last_run < strtotime("-2 DAY")) {
    $rtn ["severity"] = "alert";
    $rtn ["status"] .= t("Cron hasn't run in over 2 days.  For your installation of FlightPath
               to function properly, cron.php must be accessed routinely. At least once per day is recommended.");
  }
  else {
    $rtn ["status"] .= t("Cron was last run on %date", array("%date" => format_date($last_run)));
  }

  $rtn ["status"] .= "<p style='font-size: 0.8em;'>" . t("Your site's cron URL is:");
  $rtn ["status"] .= "<br>&nbsp; &nbsp; <i>" . $GLOBALS ["fp_system_settings"]["base_url"] . "/cron.php?t=" . $GLOBALS ["fp_system_settings"]["cron_security_token"] . "</i>
                        <br>" . t("Example linux cron command:") . "&nbsp; <i>wget -O - -q -t 1 http://ABOVE_URL</i>";
  $rtn ["status"] .= "</p>";


  return $rtn;
}