function update_status_status

7.x update_status.module update_status_status()
6.x update_status.module update_status_status()
4.x update_status.module update_status_status()
5.x update_status.module update_status_status()

Implementation of hook_status.

File

modules/update_status/update_status.module, line 111
The update status module file.

Code

function update_status_status() {
  $rtn = array();

  fp_add_css(fp_get_module_path("update_status") . "/css/update_status.css");

  $status = "";
  // Check the data we have for modules, to see if any of them could use an update.
  $updates = variable_get("update_status_need_updates_modules", array());
  $releases = variable_get("update_status_need_updates_release_types", array());

  if (!is_array($updates)) {
    $updates = array(); // just set to empty array if for some reason its null.
  }
  if (!is_array($releases)) {
    $releases = array();
  }


  $release_desc = array(
    "other" => "Other",
    "bug_features" => "Bug fixes & new features",
    "new_features" => "New features",
    "bug_fixes" => "Bug fixes",
    "security" => "Security - High Priority!",
  );


  ksort($updates);

  if (count($updates)) {
    $status .= t("The following packages have available updates:");
    $status .= "<table border='0' cellpadding='3' width='100%' class='update-status-status-table'>
                  <tr>
                    <th>" . t("Package") . "</th>
                    <th>" . t("Your Version") . "</th>
                    <th>" . t("Latest Version") . "</th>
                    <th>" . t("Release type") . "</th>
                  </tr>";
    foreach ($updates as $module => $version) {
      $release_type = fp_get_machine_readable($releases [$module]);

      $display_name = $module;
      $module_details = fp_get_module_details($module);
      if ($module_details ["info"]["name"] != "") {
        $display_name = $module_details ["info"]["name"];
      }

      $your_version = $module_details ["version"];

      if ($your_version == "%FP_VERSION%") {
        // This means you are using a version not downloaded from getflightpath.com.  Probably directly from a git repository.
        $your_version = "GitRepo";
      }


      $status .= "<tr class='release-row release-row-$release_type'>
                  <td valign='top' class='update-status-status-module'>
                    <a href='http://getflightpath.com/project/$module' target='_blank'>$display_name</a></td>
                  <td valign='top' class='update-status-status-your-version'>$your_version</td>
                  <td valign='top' class='update-status-status-version'>$version</td>
                  <td valign='top' class='update-status-status-type'>{$release_desc [$releases [$module]]}</td>
                  
                  </tr>";
    }
    $status .= "</table>";
  }
  else {
    $status .= t("All modules are up to date.");
  }

  $check_link = "";
  if (user_has_permission("run_cron")) {
    $check_link = l(t("Check now?"), "update-status-check-now");
  }


  $last_run = variable_get("update_status_last_run", 0);
  if ($last_run > 0) {
    $status .= "<p>" . t("Last check on %date.", array("%date" => format_date($last_run))) . "  $check_link</p>";
  }
  else {
    $status .= "<p><b><span style='color:red;'>*</span>
                </b>" . t("Module status has never been checked.  Please make sure you have a correctly configured cron job.") . "  $check_link</p>";
  }



  $rtn ["status"] = $status;

  return $rtn;
}