1
0
Fork 0

Merge pull request #9616 from clxmstaab/fast-first

Filesystem: use fast operation first in emptyDirectory()
pull/9618/head
Jordi Boggiano 2021-01-17 15:01:05 +01:00 committed by GitHub
commit c800db04d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ class Filesystem
public function emptyDirectory($dir, $ensureDirectoryExists = true) public function emptyDirectory($dir, $ensureDirectoryExists = true)
{ {
if (file_exists($dir) && is_link($dir)) { if (is_link($dir) && file_exists($dir)) {
$this->unlink($dir); $this->unlink($dir);
} }
@ -108,7 +108,7 @@ class Filesystem
return unlink($directory); return unlink($directory);
} }
if (!file_exists($directory) || !is_dir($directory)) { if (!is_dir($directory) || !file_exists($directory)) {
return true; return true;
} }