aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2023-08-09 18:17:04 +0200
committerGitHub <noreply@github.com>2023-08-09 18:17:04 +0200
commit42d1568b6bd6f10099771a85333b252e0561875a (patch)
tree8a4bf96f910f583fff7274c2d7225e7f922dc7df /apps/dav
parentdf304bdac8390a64cdd31c75f84504c09c8d1e64 (diff)
parent4a98bb99721c4047ed1a979214cf1ddc38c482d1 (diff)
downloadnextcloud-server-42d1568b6bd6f10099771a85333b252e0561875a.tar.gz
nextcloud-server-42d1568b6bd6f10099771a85333b252e0561875a.zip
Merge pull request #39741 from jmcclelland/optimize-cal-query
optimize calendar search query
Diffstat (limited to 'apps/dav')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index a948c54ad58..7e7ee1c9c9d 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -1845,9 +1845,13 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
->andWhere($innerQuery->expr()->eq('op.calendartype',
$outerQuery->createNamedParameter(self::CALENDAR_TYPE_CALENDAR)));
+ $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
+ ->from('calendarobjects', 'c')
+ ->where($outerQuery->expr()->isNull('deleted_at'));
+
// only return public items for shared calendars for now
if (isset($calendarInfo['{http://owncloud.org/ns}owner-principal']) === false || $calendarInfo['principaluri'] !== $calendarInfo['{http://owncloud.org/ns}owner-principal']) {
- $innerQuery->andWhere($innerQuery->expr()->eq('c.classification',
+ $outerQuery->andWhere($outerQuery->expr()->eq('c.classification',
$outerQuery->createNamedParameter(self::CLASSIFICATION_PUBLIC)));
}
@@ -1866,10 +1870,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$this->db->escapeLikeParameter($pattern) . '%')));
}
- $outerQuery->select('c.id', 'c.calendardata', 'c.componenttype', 'c.uid', 'c.uri')
- ->from('calendarobjects', 'c')
- ->where($outerQuery->expr()->isNull('deleted_at'));
-
if (isset($options['timerange'])) {
if (isset($options['timerange']['start']) && $options['timerange']['start'] instanceof DateTimeInterface) {
$outerQuery->andWhere($outerQuery->expr()->gt('lastoccurence',