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

main
Jordi Boggiano 4 years ago
parent 62fda2ed85
commit 7d3f45cf04
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC

@ -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);
}
}
}

Loading…
Cancel
Save