Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.901
diff -u -r1.901 system.module
--- modules/system/system.module	13 Mar 2010 06:55:50 -0000	1.901
+++ modules/system/system.module	17 Mar 2010 16:49:00 -0000
@@ -2017,6 +2017,10 @@
  */
 function system_update_files_database(&$files, $type) {
   $result = db_query("SELECT * FROM {system} WHERE type = :type", array(':type' => $type));
+  
+  // Remember if any module or theme is moved to a new filename so we can
+  // clear the system_list cache (in particular, the 'filepaths' subarray).
+  $filename_changed = FALSE;
 
   // Add all files that need to be deleted to a DatabaseCondition.
   $delete = db_or();
@@ -2047,6 +2051,10 @@
           ->fields($updated_fields)
           ->condition('filename', $old_filename)
           ->execute();
+
+        if (isset($updated_fields['filename'])) {
+          $filename_changed = TRUE;
+        }
       }
 
       // Indicate that the file exists already.
@@ -2055,6 +2063,7 @@
     else {
       // File is not found in file system, so delete record from the system table.
       $delete->condition('filename', $file->filename);
+      $filename_changed = TRUE;
     }
   }
 
@@ -2085,6 +2094,13 @@
     }
   }
   $query->execute();
+
+  // If any module or theme was moved to a new location, we need to reset the
+  // system_list cache or we will continue to load the old copy, look for DB
+  // schema updates in the wrong place, etc.
+  if ($filename_changed) {
+    system_list_reset();
+  }
 }
 
 /**
