You are here

function _update_status_message_text in Update Status 5.2

Helper function to return the appropriate message text when the site is out of date or missing a security update.

These error messages are shared by both update_status_requirements() for the site-wide status report at admin/logs/status and in the body of the notification emails generated by update_status_cron().

Parameters

$msg_type: String to indicate what kind of message to generate. Can be either 'core' or 'contrib'.

$msg_reason: Integer constant specifying why message is generated. Can be any of the UPDATE_STATUS_* constants from the top of this file.

$report_link: Boolean that controls if a link to the updates report should be added.

Return value

The properly translated error message for the given key.

2 calls to _update_status_message_text()
_update_status_cron_notify in ./update_status.module
Perform any notifications that should be done once cron fetches new data.
_update_status_requirement_check in ./update_status.module
Private helper method to fill in the requirements array.

File

./update_status.module, line 600

Code

function _update_status_message_text($msg_type, $msg_reason, $report_link = FALSE) {
  $text = '';
  switch ($msg_reason) {
    case UPDATE_STATUS_NOT_SECURE:
      if ($msg_type == 'core') {
        $text = t('There is a security update available for your version of Drupal. To ensure the security of your server, you should update immediately!');
      }
      else {
        $text = t('There are security updates available for one or more of your modules. To ensure the security of your server, you should update immediately!');
      }
      break;
    case UPDATE_STATUS_REVOKED:
      if ($msg_type == 'core') {
        $text = t('Your version of Drupal has been revoked and is no longer available for download. Upgrading is strongly recommended!');
      }
      else {
        $text = t('The installed version of at least one of your modules or themes has been revoked and is no longer available for download. Upgrading or disabling is strongly recommended!');
      }
      break;
    case UPDATE_STATUS_NOT_SUPPORTED:
      if ($msg_type == 'core') {
        $text = t('Your version of Drupal is no longer supported. Upgrading is strongly recommended!');
      }
      else {
        $text = t('The installed version of at least one of your modules or themes is no longer supported. Upgrading or disabling is strongly recommended! Please see the project homepage for more details.');
      }
      break;
    case UPDATE_STATUS_NOT_CURRENT:
      if ($msg_type == 'core') {
        $text = t('There are updates available for your version of Drupal. To ensure the proper functioning of your site, you should update as soon as possible.');
      }
      else {
        $text = t('There are updates available for one or more of your modules. To ensure the proper functioning of your site, you should update as soon as possible.');
      }
      break;
    case UPDATE_STATUS_UNKNOWN:
    case UPDATE_STATUS_NOT_CHECKED:
    case UPDATE_STATUS_NOT_FETCHED:
      if ($msg_type == 'core') {
        $text = t('There was a problem determining the status of available updates for your version of Drupal.');
      }
      else {
        $text = t('There was a problem determining the status of available updates for one or more of your modules or themes.');
      }
      break;
  }
  if ($report_link) {
    $text .= ' ' . t('See the <a href="@available_updates">available updates</a> page for more information.', array(
      '@available_updates' => url('admin/logs/updates'),
    ));
  }
  return $text;
}