cvs diff: Diffing modules/update
Index: modules/update/update.manager.inc
===================================================================
RCS file: /Users/wright/drupal/local_repo/drupal/modules/update/update.manager.inc,v
retrieving revision 1.26
diff -u -p -r1.26 update.manager.inc
--- modules/update/update.manager.inc	20 Nov 2010 09:40:34 -0000	1.26
+++ modules/update/update.manager.inc	25 Nov 2010 17:51:24 -0000
@@ -654,6 +654,18 @@ function update_manager_archive_extract(
   if (!$archiver) {
     throw new Exception(t('Cannot extract %file, not a valid archive.', array ('%file' => $file)));
   }
+
+  // Remove the directory if it exists, otherwise it might contain a mixture of
+  // old files mixed with the new files (e.g. in cases where files were removed
+  // from a later release).
+  $files = $archiver->listContents();
+  // Unfortunately, we can only use the directory name for this. :(
+  $project = drupal_substr($files[0], 0, -1);
+  $extract_location = $directory . '/' . $project;
+  if (file_exists($extract_location)) {
+    file_unmanaged_delete_recursive($extract_location);
+  }
+
   $archiver->extract($directory);
   return $archiver;
 }
cvs diff: Diffing modules/update/tests
