From fa8814902e9012880179e61ea846a7d85e3079f8 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Sun, 13 Apr 2014 13:47:08 +0100 Subject: [PATCH 1/4] 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. --- apps/files_trashbin/lib/trashbin.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index 7b14a4ec08..bf8d465e5d 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; From 869e7a51f0ed5b24c1ee0714112edb71e7dd1b62 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Sun, 13 Apr 2014 14:46:37 +0100 Subject: [PATCH 2/4] Prevent error in files_trashbin `glob` can return FALSE when the directory is empty, instead of an empty array, causing an error at `foreach`. "Note: On some systems it is impossible to distinguish between empty match and an error." See http://www.php.net/manual/en/function.glob.php -> Return Values --- apps/files_trashbin/lib/trashbin.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/apps/files_trashbin/lib/trashbin.php b/apps/files_trashbin/lib/trashbin.php index bf8d465e5d..9b931333b7 100644 --- a/apps/files_trashbin/lib/trashbin.php +++ b/apps/files_trashbin/lib/trashbin.php @@ -824,13 +824,15 @@ class Trashbin { $matches = glob($escapedVersionsName . '*'); } - foreach ($matches as $ma) { - if ($timestamp) { - $parts = explode('.v', substr($ma, 0, $offset)); - $versions[] = (end($parts)); - } else { - $parts = explode('.v', $ma); - $versions[] = (end($parts)); + if (is_array($matches)) { + foreach ($matches as $ma) { + if ($timestamp) { + $parts = explode('.v', substr($ma, 0, $offset)); + $versions[] = (end($parts)); + } else { + $parts = explode('.v', $ma); + $versions[] = (end($parts)); + } } } return $versions; From eeee9eacea333035e22ef3ed938e36f56bc762cd Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Sun, 13 Apr 2014 16:17:13 +0100 Subject: [PATCH 3/4] Prevent error from cache update on deleted files --- lib/private/files/storage/local.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/files/storage/local.php b/lib/private/files/storage/local.php index 571bf7f97c..ff2949d33b 100644 --- a/lib/private/files/storage/local.php +++ b/lib/private/files/storage/local.php @@ -305,7 +305,11 @@ if (\OC_Util::runningOnWindows()) { * @return bool */ public function hasUpdated($path, $time) { - return $this->filemtime($path) > $time; + if ($this->file_exists($path)) { + return $this->filemtime($path) > $time; + } else { + return true; + } } /** From 8bb003868c9f319e387bf464a035a3b2fd123531 Mon Sep 17 00:00:00 2001 From: Robin McCorkell Date: Sun, 13 Apr 2014 16:49:23 +0100 Subject: [PATCH 4/4] Fix user_ldap default setting value --- apps/user_ldap/templates/settings.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/user_ldap/templates/settings.php b/apps/user_ldap/templates/settings.php index 0a111225a7..03f2b8db09 100644 --- a/apps/user_ldap/templates/settings.php +++ b/apps/user_ldap/templates/settings.php @@ -37,7 +37,7 @@

-

+

t('Special Attributes'));?>