Merge remote-tracking branch 'tot-ra/patch-2'
Conflicts: src/Composer/Downloader/ArchiveDownloader.phppull/976/merge
commit
ebc0f8884f
|
@ -47,18 +47,23 @@ abstract class ArchiveDownloader extends FileDownloader
|
||||||
if (1 === count($contentDir)) {
|
if (1 === count($contentDir)) {
|
||||||
$contentDir = $contentDir[0];
|
$contentDir = $contentDir[0];
|
||||||
|
|
||||||
// Rename the content directory to avoid error when moving up
|
if (is_file($contentDir)) {
|
||||||
// a child folder with the same name
|
$this->filesystem->rename($contentDir, $path . '/' . basename($contentDir));
|
||||||
$temporaryName = md5(time().rand());
|
} else {
|
||||||
$this->filesystem->rename($contentDir, $temporaryName);
|
// Rename the content directory to avoid error when moving up
|
||||||
$contentDir = $temporaryName;
|
// a child folder with the same name
|
||||||
|
$temporaryName = md5(time().rand());
|
||||||
|
$this->filesystem->rename($contentDir, $temporaryName);
|
||||||
|
$contentDir = $temporaryName;
|
||||||
|
|
||||||
foreach (array_merge(glob($contentDir . '/.*'), glob($contentDir . '/*')) as $file) {
|
foreach (array_merge(glob($contentDir . '/.*'), glob($contentDir . '/*')) as $file) {
|
||||||
if (trim(basename($file), '.')) {
|
if (trim(basename($file), '.')) {
|
||||||
$this->filesystem->rename($file, $path . '/' . basename($file));
|
$this->filesystem->rename($file, $path . '/' . basename($file));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rmdir($contentDir);
|
||||||
}
|
}
|
||||||
rmdir($contentDir);
|
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
// clean up
|
// clean up
|
||||||
|
|
Loading…
Reference in New Issue