From f3592eaf3b49342c9db7672d0c47475da4722347 Mon Sep 17 00:00:00 2001 From: Christian Mollekopf Date: Wed, 3 May 2023 09:25:49 +0200 Subject: [PATCH] Always fetch the full result in kolab_storage_cache::select The previous behaviour did not work in the addressbook if more than 500 results were provided, because nothing turned the uid only fetch into the full data, resulting in "empty" result records. This solution seems to work fine for the cases tested and avoids having to completely different codepaths based on a number of records found. --- plugins/libkolab/lib/kolab_storage_cache.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/plugins/libkolab/lib/kolab_storage_cache.php b/plugins/libkolab/lib/kolab_storage_cache.php index 353b044f..e8e69318 100644 --- a/plugins/libkolab/lib/kolab_storage_cache.php +++ b/plugins/libkolab/lib/kolab_storage_cache.php @@ -25,7 +25,6 @@ class kolab_storage_cache { const DB_DATE_FORMAT = 'Y-m-d H:i:s'; - const MAX_RECORDS = 500; protected $db; protected $imap; @@ -778,8 +777,8 @@ class kolab_storage_cache if ($this->ready) { $this->_read_folder_data(); - // fetch full object data on one query if a small result set is expected - $fetchall = !$uids && ($this->limit ? $this->limit[0] : ($count = $this->count($query))) < self::MAX_RECORDS; + // fetch full object data unless only uids are requested + $fetchall = !$uids; // skip SELECT if we know it will return nothing if ($count === 0) {