瀏覽代碼

Clean up vendor dir after a package was removed

Jordi Boggiano 13 年之前
父節點
當前提交
22a825fc07
共有 1 個文件被更改,包括 7 次插入0 次删除
  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);
+            }
+        }
     }
 
     /**