Index: modules/update_status/update_status.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/update_status/update_status.module,v retrieving revision 1.61 diff -u -p -r1.61 update_status.module --- modules/update_status/update_status.module 22 Jun 2007 04:59:10 -0000 1.61 +++ modules/update_status/update_status.module 22 Jun 2007 06:57:29 -0000 @@ -16,6 +16,9 @@ define('UPDATE_STATUS_NOT_CHECKED', 4); define('UPDATE_STATUS_CANT_CHECK', 5); define('UPDATE_STATUS_HAVE_NEWER', 6); +define('UPDATE_STATUS_WARNING_ALL', 1); +define('UPDATE_STATUS_WARNING_SECURITY', 2); + /** * Implementation of hook_help(). */ @@ -23,6 +26,11 @@ function update_status_help($section) { switch ($section) { case 'admin/logs/updates': return '
'. t('Here you can find information on the update status of your installed modules. Note that each module is part of a "project", which may have the same name as the module or may have a different name.') .'
'; + + case 'admin/logs/updates/settings': + return ''. t('Here you can configure what kinds of warnings and notifications you want to receive about available updates for your installed modules. The %warning_severity_level setting allows you to control what kinds of new releases are required before your site is marked out of date. You can select if you always want to be notified about newer releases, or only notified in case of security updates.', array('%warning_severity_level' => t('Warning severity level'))) .'
'. + ''. t('The table of project-specific settings allows you to control if a certain project, or even a specific release of that project, should be ignored by the available updates report. You can also specify a note to indicate why you are ignoring a specific module or version, and that will be displayed on the available updates report.') .'
'; + case 'admin/build/modules': $status = update_status_requirements('runtime'); if ($status['update_status']['severity'] == REQUIREMENT_ERROR) { @@ -103,6 +111,18 @@ function update_status_settings() { $form['data'] = array('#type' => 'value', '#value' => $data); $form['avail'] = array('#type' => 'value', '#value' => $avail); + $warning_options = array( + UPDATE_STATUS_WARNING_ALL => t('All newer releases'), + UPDATE_STATUS_WARNING_SECURITY => t('Only security updates'), + ); + $form['severity_warning'] = array( + '#type' => 'radios', + '#title' => t('Warning severity level'), + '#default_value' => variable_get('update_status_severity_warning', UPDATE_STATUS_WARNING_ALL), + '#options' => $warning_options, + '#description' => t('Select what kinds of new releases should be marked as a warning so that the !status_report and the !modules_page will indicate that new updates are required for your site to be up to date.', array('!status_report' => l(t('Status report'), 'admin/logs/status'), '!modules_page' => l(t('Modules page'), 'admin/build/modules'))), + ); + foreach ($data as $key => $project) { if (isset($avail[$key])) { if (!isset($values[$key])) { @@ -149,6 +169,9 @@ function theme_update_status_settings($f return drupal_render($form); } + $output = ''; + $output .= drupal_render($form['severity_warning']); + $header = array( array('data' => t('Project'), 'class' => 'project'), array('data' => t('Warn if out of date'), 'class' => 'status'), @@ -171,10 +194,15 @@ function theme_update_status_settings($f $rows[] = $row; } } - return theme('table', $header, $rows, array('class' => 'update-status-settings')) . drupal_render($form); + $output .= theme('table', $header, $rows, array('class' => 'update-status-settings')); + $output .= drupal_render($form); + return $output; } function update_status_settings_submit($form_id, $form_values) { + if ($form_values['severity_warning'] != UPDATE_STATUS_WARNING_ALL) { + variable_set('update_status_severity_warning', $form_values['severity_warning']); + } variable_set('update_status_settings', $form_values['projects']); drupal_set_message(t('Your changes have been saved.')); } @@ -578,12 +606,18 @@ function update_status_calculate_project continue; } - // Then, check based upon type. + // Then, check based upon type and site-wide warning severity setting. + $warning_level = variable_get('update_status_severity_warning', UPDATE_STATUS_WARNING_ALL); + switch ($projects[$project]['type']) { case 'official': if ($projects[$project]['existing_version'] == $projects[$project]['recommended'] || $projects[$project]['existing_version'] == $projects[$project]['latest_version']) { $projects[$project]['status'] = UPDATE_STATUS_CURRENT; } + elseif ($warning_level == UPDATE_STATUS_WARNING_SECURITY && empty($projects[$project]['security updates'])) { + $projects[$project]['status'] = UPDATE_STATUS_NOT_CHECKED; + $projects[$project]['reason'] = t('Not a security update'); + } else { $projects[$project]['status'] = UPDATE_STATUS_NOT_CURRENT; } @@ -599,6 +633,10 @@ function update_status_calculate_project else if (abs($latest_version['date'] - $projects[$project]['datestamp']) < 100) { $projects[$project]['status'] = UPDATE_STATUS_CURRENT; } + elseif ($warning_level == UPDATE_STATUS_WARNING_SECURITY && empty($projects[$project]['security updates'])) { + $projects[$project]['status'] = UPDATE_STATUS_NOT_CHECKED; + $projects[$project]['reason'] = t('Not a security update'); + } else { $projects[$project]['status'] = UPDATE_STATUS_NOT_CURRENT; }