cvs diff: Diffing modules/update
Index: modules/update/update.module
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.module,v
retrieving revision 1.69
diff -u -p -r1.69 update.module
--- modules/update/update.module	5 Oct 2010 02:11:00 -0000	1.69
+++ modules/update/update.module	5 Oct 2010 23:09:34 -0000
@@ -79,18 +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/update':
-    case 'admin/appearance/install':
-    case 'admin/modules/update':
-    case 'admin/modules/install':
-    case 'admin/reports/updates/update':
-    case 'admin/reports/updates/install':
-    case 'admin/reports/updates/settings':
-    case 'admin/reports/status':
-    case 'admin/update/ready':
-      // These pages don't need additional nagging.
-      break;
-
     case 'admin/help#update':
       $output = '';
       $output .= '<h3>' . t('About') . '</h3>';
@@ -120,27 +108,31 @@ function update_help($path, $arg) {
  */
 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');
+      if (arg(2) == NULL) {
+        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');
+            }
           }
         }
       }
     }
-    else {
+    // Don't add additional nagging on Update manager and Update status pages.
+    elseif (!(arg(1) == 'reports' && (arg(2) == 'updates' || arg(2) == 'status')) && (!arg(1) == 'update' && arg(2) == 'ready')) {
       // Otherwise, if we're on *any* admin page and there's a security
       // update missing, print an error message about it.
+      module_load_install('update');
+      $status = update_requirements('runtime');
       foreach (array('core', 'contrib') as $report_type) {
         $type = 'update_' . $report_type;
         if (isset($status[$type])
Index: modules/update/update.test
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.test,v
retrieving revision 1.18
diff -u -p -r1.18 update.test
--- modules/update/update.test	5 Oct 2010 02:17:44 -0000	1.18
+++ modules/update/update.test	5 Oct 2010 22:57:34 -0000
@@ -181,6 +181,24 @@ class UpdateCoreTestCase extends UpdateT
     $this->assertText(t('Checked available update data for one project.'));
     $this->assertNoText(t('There are updates available for your version of Drupal.'));
     $this->assertText(t('There is a security update available for your version of Drupal.'));
+
+    // Make sure admin/appearance warns you you're missing a security update.
+    $this->drupalGet('admin/appearance');
+    $this->assertNoText(t('There are updates available for your version of Drupal.'));
+    $this->assertText(t('There is a security update available for your version of Drupal.'));
+
+    // Make sure duplicate messages don't appear on Update status pages.
+    $this->drupalGet('admin/reports/status');
+    // We're expecting "There is a security update..." inside the status report
+    // itself, but the drupal_set_message() appears as an li so we can prefix
+    // with that and search for the raw HTML.
+    $this->assertNoRaw('<li>' . t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/reports/updates');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/reports/updates/settings');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
   }
 
   protected function setSystemInfo7_0() {
@@ -604,4 +622,45 @@ class UpdateTestUploadCase extends Updat
     // Make sure it didn't clobber the first option from core.
     $this->assertPattern('/archive extensions are supported:.*zip/', t("Found 'zip' extension"));
   }
+
+  /**
+   * Check the messages on Update manager pages when missing a security update.
+   */
+  function testUpdateManagerCoreSecurityUpdateMessages() {
+    $setting = array(
+      '#all' => array(
+        'version' => '7.0',
+      ),
+    );
+    variable_set('update_test_system_info', $setting);
+    variable_set('update_fetch_url', url('update-test', array('absolute' => TRUE)));
+    variable_set('update_test_xml_map', array('drupal' => '2-sec'));
+    // Initialize the update status.
+    $this->drupalGet('admin/reports/updates');
+
+    // Now, make sure none of the Update manager pages have duplicate messages
+    // about core missing a security update.
+
+    $this->drupalGet('admin/modules/install');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/modules/update');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/appearance/install');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/appearance/update');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/reports/updates/install');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/reports/updates/update');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+
+    $this->drupalGet('admin/update/ready');
+    $this->assertNoText(t('There is a security update available for your version of Drupal.'));
+  }
+
 }
cvs diff: Diffing modules/update/tests
