]> source.dussan.org Git - nextcloud-server.git/commitdiff
More robust way to check if the folder is empty
authorRobin Appelman <icewind@owncloud.com>
Mon, 17 Mar 2014 16:03:32 +0000 (17:03 +0100)
committerRobin Appelman <icewind@owncloud.com>
Mon, 17 Mar 2014 16:03:32 +0000 (17:03 +0100)
apps/files_trashbin/lib/trashbin.php

index dc38c339ecba858c89e45bfc500a9fd44324824c..62879b0ca853b2114a4be78e8afae71bef822346 100644 (file)
@@ -922,9 +922,12 @@ class Trashbin {
 
                $view = new \OC\Files\View('/' . $user . '/files_trashbin');
                $dh = $view->opendir('/files');
-               readdir($dh); //'..'
-               readdir($dh); //'.'
-               return readdir($dh) === false;
+               while ($file = readdir($dh)) {
+                       if($file !== '.' and $file !== '..'){
+                               return false;
+                       }
+               }
+               return true;
        }
 
        public static function preview_icon($path) {