Ver Fonte

Clean up vendor dir after a package was removed

Jordi Boggiano há 13 anos atrás
pai
commit
22a825fc07
1 ficheiros alterados com 7 adições e 0 exclusões
  1. 7 0
      src/Composer/Installer/LibraryInstaller.php

+ 7 - 0
src/Composer/Installer/LibraryInstaller.php

@@ -127,6 +127,13 @@ class LibraryInstaller implements InstallerInterface
         $this->downloadManager->remove($package, $downloadPath);
         $this->removeBinaries($package);
         $repo->removePackage($package);
+
+        if (strpos($package->getName(), '/')) {
+            $packageVendorDir = dirname($downloadPath);
+            if (is_dir($packageVendorDir) && !glob($packageVendorDir.'/*')) {
+                @rmdir($packageVendorDir);
+            }
+        }
     }
 
     /**