1
0
Fork 0

Avoid errors in cleanup, fixes #8766, fixes #8764

pull/8780/head
Jordi Boggiano 2020-04-13 12:15:17 +02:00
parent 62fda2ed85
commit 7d3f45cf04
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 11 additions and 8 deletions

View File

@ -239,14 +239,17 @@ class FileDownloader implements DownloaderInterface, ChangeReportInterface
if (file_exists($fileName)) {
$this->filesystem->unlink($fileName);
}
if (is_dir($path) && $this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
$this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
}
if (is_dir($path) && $this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
$this->filesystem->removeDirectory($this->config->get('vendor-dir'));
}
if (is_dir($path) && $this->filesystem->isDirEmpty($path)) {
$this->filesystem->removeDirectory($path);
$dirsToCleanUp = array(
$this->config->get('vendor-dir').'/composer/',
$this->config->get('vendor-dir'),
$path,
);
foreach ($dirsToCleanUp as $dir) {
if (is_dir($dir) && $this->filesystem->isDirEmpty($dir)) {
$this->filesystem->removeDirectory($dir);
}
}
}