Browse Source

Remove symlinks instead of recursing into them when deleting, fixes #3050

Jordi Boggiano 10 years ago
parent
commit
24ef869815
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/Composer/Util/Filesystem.php

+ 8 - 0
src/Composer/Util/Filesystem.php

@@ -61,6 +61,10 @@ class Filesystem
 
     public function emptyDirectory($dir, $ensureDirectoryExists = true)
     {
+        if (file_exists($dir) && is_link($dir)) {
+            unlink($dir);
+        }
+
         if ($ensureDirectoryExists) {
             $this->ensureDirectoryExists($dir);
         }
@@ -89,6 +93,10 @@ class Filesystem
      */
     public function removeDirectory($directory)
     {
+        if (file_exists($dir) && is_link($directory)) {
+            return unlink($directory);
+        }
+
         if (!is_dir($directory)) {
             return true;
         }