diff options
author | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2014-04-13 13:47:08 +0100 |
---|---|---|
committer | Robin McCorkell <rmccorkell@karoshi.org.uk> | 2014-04-13 13:49:04 +0100 |
commit | fa8814902e9012880179e61ea846a7d85e3079f8 (patch) | |
tree | 623cb467d092396f0a3b502750f47152ec97da24 /apps | |
parent | 9de3c1b59d808b9725e728a2956f66b1d02274fe (diff) | |
download | nextcloud-server-fa8814902e9012880179e61ea846a7d85e3079f8.tar.gz nextcloud-server-fa8814902e9012880179e61ea846a7d85e3079f8.zip |
Adjust logic for deciding if trashbin empty
Any error in opening the trashbin directory returns 'true' for isEmpty.
An error is prevented by checking if the directory exists before trying to
open it.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_trashbin/lib/trashbin.php | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 7b14a4ec081..bf8d465e5de 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -921,13 +921,11 @@ class Trashbin { public static function isEmpty($user) { $view = new \OC\Files\View('/' . $user . '/files_trashbin'); - $dh = $view->opendir('/files'); - if (!$dh) { - return false; - } - while ($file = readdir($dh)) { - if ($file !== '.' and $file !== '..') { - return false; + if ($view->is_dir('/files') && $dh = $view->opendir('/files')) { + while ($file = readdir($dh)) { + if ($file !== '.' and $file !== '..') { + return false; + } } } return true; |