diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index 2a58f79681..64cd2b25ee 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -997,7 +997,8 @@ class Cache implements ICache { ->from('filecache') ->whereStorageId() ->andWhere($query->expr()->lt('size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT))) - ->orderBy('fileid', 'DESC'); + ->orderBy('fileid', 'DESC') + ->setMaxResults(1); $result = $query->execute(); $path = $result->fetchColumn();