Skip to content

Commit

Permalink
[5.2] Optimize Filesystem moveDirectory (#14362)
Browse files Browse the repository at this point in the history
* Optimize Filesystem moveDirectory

* Remove redundant code
  • Loading branch information
bepsvpt authored and taylorotwell committed Jul 21, 2016
1 parent d80cb8e commit be43de2
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/Illuminate/Filesystem/Filesystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -401,13 +401,9 @@ public function makeDirectory($path, $mode = 0755, $recursive = false, $force =
public function moveDirectory($from, $to, $overwrite = false)
{
if ($overwrite && $this->isDirectory($to)) {
$this->deleteDirectory($to);

$this->copyDirectory($from, $to);

$this->deleteDirectory($from);

return true;
if (! $this->deleteDirectory($to)) {
return false;
}
}

return @rename($from, $to) === true;
Expand Down

0 comments on commit be43de2

Please sign in to comment.