Index: modules/system/system.module
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/system/system.module,v
retrieving revision 1.876
diff -u -p -r1.876 system.module
--- modules/system/system.module	13 Jan 2010 23:03:31 -0000	1.876
+++ modules/system/system.module	14 Jan 2010 02:10:32 -0000
@@ -2038,6 +2038,10 @@ function system_get_files_database(&$fil
 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();
   foreach ($result as $file) {
@@ -2067,6 +2071,10 @@ function system_update_files_database(&$
           ->fields($updated_fields)
           ->condition('filename', $old_filename)
           ->execute();
+
+        if (isset($updated_fields['filename'])) {
+          $filename_changed = TRUE;
+        }
       }
 
       // Indiciate that the file exists already.
@@ -2075,6 +2083,7 @@ function system_update_files_database(&$
     else {
       // File is not found in file system, so delete record from the system table.
       $delete->condition('filename', $file->filename);
+      $filename_changed = TRUE;
     }
   }
 
@@ -2105,6 +2114,13 @@ function system_update_files_database(&$
     }
   }
   $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();
+  }
 }
 
 /**
