Merge pull request #1200 from nextcloud/stable9.1-usermountcache-orphanedshare

[stable10] Prevent error with orphaned shares when updating user mount cache
This commit is contained in:
Roeland Jago Douma 2016-08-31 15:07:40 +02:00 committed by GitHub
commit 782c3138c9
2 changed files with 9 additions and 2 deletions

View File

@ -246,6 +246,12 @@ class SharedMount extends MountPoint implements MoveableMount {
->from('filecache') ->from('filecache')
->where($builder->expr()->eq('fileid', $builder->createNamedParameter($this->getStorageRootId()))); ->where($builder->expr()->eq('fileid', $builder->createNamedParameter($this->getStorageRootId())));
return $query->execute()->fetchColumn(); $result = $query->execute();
$row = $result->fetch();
$result->closeCursor();
if ($row) {
return $row['storage'];
}
return -1;
} }
} }

View File

@ -159,7 +159,8 @@ class UserMountCache implements IUserMountCache {
'mount_id' => $mount->getMountId() 'mount_id' => $mount->getMountId()
], ['root_id', 'user_id']); ], ['root_id', 'user_id']);
} else { } 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());
} }
} }