From 38b1529c2a24a0fc58ce78a444f918750442a8aa Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Mon, 17 Mar 2014 17:03:32 +0100 Subject: [PATCH] More robust way to check if the folder is empty --- apps/files_trashbin/lib/trashbin.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index dc38c339ec..62879b0ca8 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -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) {