mirror of
https://github.com/nextcloud/server.git
synced 2024-08-13 14:11:10 +02:00
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.
This commit is contained in:
parent
9de3c1b59d
commit
fa8814902e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user