diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-11-24 15:28:40 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-24 15:28:40 +0100 |
commit | d6ade509cf33849edb10b33fb2490b2428f9091b (patch) | |
tree | e04ab66705965405050cf84e9e12d6d33a60db9d | |
parent | b74b6671c14fb87f057fffac86b9e332096ef698 (diff) | |
parent | ce2f9493a72672826bd95f5d7b39210e5c020d06 (diff) | |
download | nextcloud-server-d6ade509cf33849edb10b33fb2490b2428f9091b.tar.gz nextcloud-server-d6ade509cf33849edb10b33fb2490b2428f9091b.zip |
Merge pull request #2299 from nextcloud/oc-mounts-non-existing-user
filter out oc_mounts results from non existing users
-rw-r--r-- | lib/private/Files/Config/UserMountCache.php | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/private/Files/Config/UserMountCache.php b/lib/private/Files/Config/UserMountCache.php index e9e142d0d4b..c9a701d24b6 100644 --- a/lib/private/Files/Config/UserMountCache.php +++ b/lib/private/Files/Config/UserMountCache.php @@ -188,6 +188,9 @@ class UserMountCache implements IUserMountCache { private function dbRowToMountInfo(array $row) { $user = $this->userManager->get($row['user_id']); + if (is_null($user)) { + return null; + } return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path'])? $row['path']:''); } @@ -205,7 +208,7 @@ class UserMountCache implements IUserMountCache { $rows = $query->execute()->fetchAll(); - $this->mountsForUsers[$user->getUID()] = array_map([$this, 'dbRowToMountInfo'], $rows); + $this->mountsForUsers[$user->getUID()] = array_filter(array_map([$this, 'dbRowToMountInfo'], $rows)); } return $this->mountsForUsers[$user->getUID()]; } @@ -223,7 +226,7 @@ class UserMountCache implements IUserMountCache { $rows = $query->execute()->fetchAll(); - return array_map([$this, 'dbRowToMountInfo'], $rows); + return array_filter(array_map([$this, 'dbRowToMountInfo'], $rows)); } /** @@ -239,7 +242,7 @@ class UserMountCache implements IUserMountCache { $rows = $query->execute()->fetchAll(); - return array_map([$this, 'dbRowToMountInfo'], $rows); + return array_filter(array_map([$this, 'dbRowToMountInfo'], $rows)); } /** |