diff options
author | Dries Buytaert <dries@buytaert.net> | 2010-10-04 18:04:52 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2010-10-04 18:04:52 +0000 |
commit | 933bc80411b70b298ddc66d4f742a96a9fcf2fab (patch) | |
tree | 16bd054487f8a825252181dc9ebefde493565014 /modules/update | |
parent | f85a37c3076a3145aa291439b713e33825adfd83 (diff) | |
download | brdo-933bc80411b70b298ddc66d4f742a96a9fcf2fab.tar.gz brdo-933bc80411b70b298ddc66d4f742a96a9fcf2fab.tar.bz2 |
- Patch #931284 by dww: update status admin UI shouldn't rely on hook_help().
Diffstat (limited to 'modules/update')
-rw-r--r-- | modules/update/update.module | 61 |
1 files changed, 33 insertions, 28 deletions
diff --git a/modules/update/update.module b/modules/update/update.module index 1704fdfff..42aacc374 100644 --- a/modules/update/update.module +++ b/modules/update/update.module @@ -79,22 +79,6 @@ function update_help($path, $arg) { case 'admin/reports/updates': return '<p>' . t('Here you can find information about available updates for your installed modules and themes. Note that each module or theme is part of a "project", which may or may not have the same name, and might include multiple modules or themes within it.') . '</p>'; - case 'admin/appearance': - case 'admin/modules': - module_load_install('update'); - $status = update_requirements('runtime'); - foreach (array('core', 'contrib') as $report_type) { - $type = 'update_' . $report_type; - if (isset($status[$type]['severity'])) { - if ($status[$type]['severity'] == REQUIREMENT_ERROR) { - drupal_set_message($status[$type]['description'], 'error'); - } - elseif ($status[$type]['severity'] == REQUIREMENT_WARNING) { - drupal_set_message($status[$type]['description'], 'warning'); - } - } - } - case 'admin/appearance/update': case 'admin/appearance/install': case 'admin/modules/update': @@ -128,23 +112,44 @@ function update_help($path, $arg) { } $output .= '</dl>'; return $output; + } +} - default: - // Otherwise, if we're on *any* admin page and there's a security - // update missing, print an error message about it. - if (arg(0) == 'admin' && strpos($path, '#') === FALSE - && user_access('administer site configuration')) { - module_load_install('update'); - $status = update_requirements('runtime'); - foreach (array('core', 'contrib') as $report_type) { - $type = 'update_' . $report_type; - if (isset($status[$type]) - && isset($status[$type]['reason']) - && $status[$type]['reason'] === UPDATE_NOT_SECURE) { +/** + * Implements hook_init(). + */ +function update_init() { + if (arg(0) == 'admin' && user_access('administer site configuration')) { + module_load_install('update'); + $status = update_requirements('runtime'); + + // If we are on the appearance or modules list, display a detailed report + // of the update status. + if (arg(1) == 'appearance' || arg(1) == 'modules') { + foreach (array('core', 'contrib') as $report_type) { + $type = 'update_' . $report_type; + if (isset($status[$type]['severity'])) { + if ($status[$type]['severity'] == REQUIREMENT_ERROR) { drupal_set_message($status[$type]['description'], 'error'); } + elseif ($status[$type]['severity'] == REQUIREMENT_WARNING) { + drupal_set_message($status[$type]['description'], 'warning'); + } } } + } + else { + // Otherwise, if we're on *any* admin page and there's a security + // update missing, print an error message about it. + foreach (array('core', 'contrib') as $report_type) { + $type = 'update_' . $report_type; + if (isset($status[$type]) + && isset($status[$type]['reason']) + && $status[$type]['reason'] === UPDATE_NOT_SECURE) { + drupal_set_message($status[$type]['description'], 'error'); + } + } + } } } |