More robust way to check if the folder is empty

This commit is contained in:
Robin Appelman 2014-03-17 17:03:32 +01:00
parent 332c14a878
commit 38b1529c2a

View 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) {