Index: modules/update_status/update_status.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.module,v retrieving revision 1.57 diff -u -p -r1.57 update_status.module --- modules/update_status/update_status.module 20 Jun 2007 20:50:43 -0000 1.57 +++ modules/update_status/update_status.module 20 Jun 2007 22:58:43 -0000 @@ -28,6 +28,9 @@ function update_status_help($section) { if ($status['update_status']['severity'] == REQUIREMENT_ERROR) { drupal_set_message(t('There are updates available for one or more of your modules. To ensure the security of your server, you should update immediately. See the !available_updates page for more information', array('!available_updates' => l(t('available updates'), 'admin/logs/updates'))), 'error'); } + elseif ($status['update_status']['severity'] == REQUIREMENT_WARNING) { + drupal_set_message($status['update_status']['description']); + } return '

'. t('See the !available_updates page for information on any modules listed below that have newer versions released.', array('!available_updates' => l(t('available updates'), 'admin/logs/updates'))) .'

'; } } @@ -82,7 +85,7 @@ function update_status_status() { return theme('update_status_report', $data); } else { - return theme('update_status_report', t('No update data is available. To fetch data, you may need to !run_cron.', array('!run_cron' => l(t('run cron'), 'admin/logs/status/run-cron', NULL, drupal_get_destination())))); + return theme('update_status_report', _update_status_no_data()); } } @@ -133,7 +136,7 @@ function update_status_settings() { } else { $form['error'] = array( - '#value' => theme('update_status_report', t('No update data is available. To fetch data, you may need to !run_cron.', array('!run_cron' => l(t('run cron'), 'admin/logs/status/run-cron', NULL, 'destination=' . url('admin/logs/updates'))))) + '#value' => theme('update_status_report', _update_status_no_data()) ); } @@ -207,10 +210,10 @@ function update_status_requirements($pha } } else { - $requirements['update_status']['value'] = t('Update status is unavailable, cron may need to be run.'); - $requirements['update_status_drupal']['value'] = t('Update status is unavailable, cron may need to be run.'); + $requirements['update_status']['value'] = t('No available update data'); + $requirements['update_status']['severity'] = REQUIREMENT_WARNING; + $requirements['update_status']['description'] = _update_status_no_data(); } - return $requirements; } } @@ -254,6 +257,16 @@ function update_status_force_status() { } /** + * Prints a warning message when there is no data about available updates. + */ +function _update_status_no_data() { + return t('No information about potential new releases for your currently installed modules is available. To check for updates, you may need to !run_cron or you can !check_manually. Please note that checking for available updates can take a long time, so please be patient.', array( + '!run_cron' => l(t('run cron'), 'admin/logs/status/run-cron', NULL, drupal_get_destination()), + '!check_manually' => l(t('check manually'), 'admin/logs/updates/force-check', NULL, drupal_get_destination()), + )); +} + +/** * Fetch an array of installed and enabled projects. * * This is only responsible for generating an array of projects (taking into @@ -790,14 +803,18 @@ function update_status_refresh() { /** * Internal helper to try to get the update information from the cache * if possible, and to refresh the cache when necessary. + * + * @param $refresh + * Boolean to indicate if this method should refresh the cache automatically + * if there's no data. */ -function update_status_get_available() { +function update_status_get_available($refresh = FALSE) { $avail = array(); if (($cache = cache_get('update_status_info', 'cache')) && $cache->expire > time()) { $avail = unserialize($cache->data); } - else { + elseif ($refresh) { $avail = update_status_refresh(); } return $avail;