diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-12-01 00:23:36 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2010-12-01 00:23:36 +0000 |
commit | 9f5cd5395a9bae17fbbacf11da5bb1e90fda82a6 (patch) | |
tree | 0961b4fd416bf22236517894b982bdbe017141db /modules/update | |
parent | 5c3fdc3ee1635b06a4136e7accc0a7f360840e92 (diff) | |
download | brdo-9f5cd5395a9bae17fbbacf11da5bb1e90fda82a6.tar.gz brdo-9f5cd5395a9bae17fbbacf11da5bb1e90fda82a6.tar.bz2 |
#609772 by dww, JacobSingh, ksenzee: Fixed Impossible to extend the FileTransfer class system in contrib
Diffstat (limited to 'modules/update')
-rw-r--r-- | modules/update/update.manager.inc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/update/update.manager.inc b/modules/update/update.manager.inc index efc2d281e..1bc3ce586 100644 --- a/modules/update/update.manager.inc +++ b/modules/update/update.manager.inc @@ -654,6 +654,18 @@ function update_manager_archive_extract($file, $directory) { 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; } |