]> source.dussan.org Git - nextcloud-server.git/commitdiff
filter out oc_mounts results from non existing users 2299/head
authorRobin Appelman <robin@icewind.nl>
Thu, 24 Nov 2016 10:44:18 +0000 (11:44 +0100)
committerRobin Appelman <robin@icewind.nl>
Thu, 24 Nov 2016 10:44:18 +0000 (11:44 +0100)
Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Files/Config/UserMountCache.php

index e9e142d0d4b43e46c2b2d73bdd8f0f1e4c83ae63..c9a701d24b6a7dd21f60db88c93041e045cb51d3 100644 (file)
@@ -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));
        }
 
        /**