diff options
author | Vincent Petry <pvince81@owncloud.com> | 2016-08-25 18:06:13 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-08-29 10:59:19 +0200 |
commit | c195ee678dd1c4efb3dc6fe99155c3a029f3a607 (patch) | |
tree | e426cd389c1c13631926a20f2239303b1f697834 | |
parent | 1b558ae2015da0645cc8cf0657e55c55c23cf2d6 (diff) | |
download | nextcloud-server-c195ee678dd1c4efb3dc6fe99155c3a029f3a607.tar.gz nextcloud-server-c195ee678dd1c4efb3dc6fe99155c3a029f3a607.zip |
Prevent error with orphaned shares when updating user mount cache
-rw-r--r-- | apps/files_sharing/lib/SharedMount.php | 7 | ||||
-rw-r--r-- | apps/files_sharing/lib/sharedstorage.php | 5 | ||||
-rw-r--r-- | lib/private/Files/Config/UserMountCache.php | 3 |
3 files changed, 12 insertions, 3 deletions
diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index daddccf15d4..c2942d90bdd 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -240,6 +240,11 @@ class SharedMount extends MountPoint implements MoveableMount { ->from('filecache') ->where($query->expr()->eq('fileid', $query->createNamedParameter($this->getStorageRootId()))); - return $query->execute()->fetchColumn(); + $result = $query->execute(); + $row = $result->fetch(); + if ($row) { + return $row['storage']; + } + return -1; } } diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php index 08fdc80fb33..36983c87d00 100644 --- a/apps/files_sharing/lib/sharedstorage.php +++ b/apps/files_sharing/lib/sharedstorage.php @@ -38,6 +38,7 @@ use OCP\Files\Cache\ICacheEntry; use OCP\Files\Storage\IStorage; use OCP\Lock\ILockingProvider; use OC\Files\Storage\FailedStorage; +use OCP\Files\NotFoundException; /** * Convert target path to source path and pass the function call to the correct storage provider @@ -104,7 +105,9 @@ class Shared extends \OC\Files\Storage\Wrapper\Jail implements ISharedStorage { } catch (\Exception $e) { $this->sourceStorage = new FailedStorage(['exception' => $e]); - $this->logger->logException($e); + if (!$e instanceof NotFoundException) { + $this->logger->logException($e); + } } $this->storage = $this->sourceStorage; } diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index bc6ad1b34f0..7ef73739c9e 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -143,7 +143,8 @@ class UserMountCache implements IUserMountCache { 'mount_point' => $mount->getMountPoint() ], ['root_id', 'user_id']); } else { - $this->logger->error('Error getting storage info for mount at ' . $mount->getMountPoint()); + // in some cases this is legitimate, like orphaned shares + $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); } } |