1
0
Fork 0

Avoid failing cleanup when a package gets uninstalled

pull/8729/head
Jordi Boggiano 2020-03-28 20:50:49 +01:00
parent 6e45a53e76
commit 800491175b
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 3 additions and 3 deletions

View File

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