1
0
Fork 0

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

pull/2415/merge
Jordi Boggiano 2014-06-29 12:49:11 +02:00
parent 8881cec174
commit 24ef869815
1 changed files with 8 additions and 0 deletions

View File

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