From c4f303d19c1b94b62a5054947e364fdb4b6673df Mon Sep 17 00:00:00 2001 From: Vincent Petry Date: Thu, 25 Aug 2016 18:06:13 +0200 Subject: [PATCH] Prevent error with orphaned shares when updating user mount cache --- apps/files_sharing/lib/SharedMount.php | 7 ++++++- lib/private/Files/Config/UserMountCache.php | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/files_sharing/lib/SharedMount.php b/apps/files_sharing/lib/SharedMount.php index 2b562c4b4f..c83a28d4c5 100644 --- a/apps/files_sharing/lib/SharedMount.php +++ b/apps/files_sharing/lib/SharedMount.php @@ -246,6 +246,11 @@ class SharedMount extends MountPoint implements MoveableMount { ->from('filecache') ->where($builder->expr()->eq('fileid', $builder->createNamedParameter($this->getStorageRootId()))); - return $query->execute()->fetchColumn(); + $result = $query->execute(); + $row = $result->fetch(); + if ($row) { + return $row['storage']; + } + return -1; } } diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index ab58a97687..bd8343fa44 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -159,7 +159,8 @@ class UserMountCache implements IUserMountCache { 'mount_id' => $mount->getMountId() ], ['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()); } }