Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-11-11 12:57:04 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-11-11 12:57:04 +0300
commitca14c02301a358172c2b9c1d15d6221cb60e6b1e (patch)
tree4888f6c2bd484f40e11cce8eff50f62b726c381d /apps/dav/lib/CalDAV/CalDavBackend.php
parent92d4844e0b0ff09bf22ef738d452beb0e63d63eb (diff)
Document and type allowed values for calendar property searches
For API users it looked like any properties could be searched. But it turned out to be a hand picked list of properties that we index and then use for the search. To prevent application errors where special props are not found, I suggest we document and type the allowed values. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/CalDAV/CalDavBackend.php')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php25
1 files changed, 20 insertions, 5 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 7094358a2c6..5aa499be159 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -170,10 +170,25 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
'{http://calendarserver.org/ns/}subscribed-strip-attachments' => 'stripattachments',
];
- /** @var array properties to index */
- public static $indexProperties = ['CATEGORIES', 'COMMENT', 'DESCRIPTION',
- 'LOCATION', 'RESOURCES', 'STATUS', 'SUMMARY', 'ATTENDEE', 'CONTACT',
- 'ORGANIZER'];
+ /**
+ * properties to index
+ *
+ * This list has to be kept in sync with ICalendarQuery::SEARCH_PROPERTY_*
+ *
+ * @see \OCP\Calendar\ICalendarQuery
+ */
+ private const INDEXED_PROPERTIES = [
+ 'CATEGORIES',
+ 'COMMENT',
+ 'DESCRIPTION',
+ 'LOCATION',
+ 'RESOURCES',
+ 'STATUS',
+ 'SUMMARY',
+ 'ATTENDEE',
+ 'CONTACT',
+ 'ORGANIZER'
+ ];
/** @var array parameters to index */
public static $indexParameters = [
@@ -2948,7 +2963,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
}
foreach ($component->children() as $property) {
- if (in_array($property->name, self::$indexProperties)) {
+ if (in_array($property->name, self::INDEXED_PROPERTIES, true)) {
$value = $property->getValue();
// is this a shitty db?
if (!$this->db->supports4ByteText()) {