Commit 933bc804 authored by Dries's avatar Dries

- Patch #931284 by dww: update status admin UI shouldn't rely on hook_help().

parent f85a37c3
......@@ -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');
}
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment