@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $offset = $arguments['offset']; |
70 | 70 | $stopAt = $arguments['stopAt']; |
71 | 71 | |
72 | - $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
72 | + $this->logger->info('Building calendar index ('.$offset.'/'.$stopAt.')'); |
|
73 | 73 | |
74 | 74 | $offset = $this->buildIndex($offset, $stopAt); |
75 | 75 | |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | 'offset' => $offset, |
81 | 81 | 'stopAt' => $stopAt |
82 | 82 | ]); |
83 | - $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
83 | + $this->logger->info('New building calendar index job scheduled with offset '.$offset); |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | ->orderBy('id', 'ASC'); |
101 | 101 | |
102 | 102 | $stmt = $query->execute(); |
103 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
103 | + while ($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
104 | 104 | $offset = $row['id']; |
105 | 105 | |
106 | 106 | $calendarData = $row['calendardata']; |
@@ -31,90 +31,90 @@ |
||
31 | 31 | |
32 | 32 | class BuildCalendarSearchIndexBackgroundJob extends QueuedJob { |
33 | 33 | |
34 | - /** @var IDBConnection */ |
|
35 | - private $db; |
|
36 | - |
|
37 | - /** @var CalDavBackend */ |
|
38 | - private $calDavBackend; |
|
39 | - |
|
40 | - /** @var ILogger */ |
|
41 | - private $logger; |
|
42 | - |
|
43 | - /** @var IJobList */ |
|
44 | - private $jobList; |
|
45 | - |
|
46 | - /** @var ITimeFactory */ |
|
47 | - private $timeFactory; |
|
48 | - |
|
49 | - /** |
|
50 | - * @param IDBConnection $db |
|
51 | - * @param CalDavBackend $calDavBackend |
|
52 | - * @param ILogger $logger |
|
53 | - * @param IJobList $jobList |
|
54 | - * @param ITimeFactory $timeFactory |
|
55 | - */ |
|
56 | - public function __construct(IDBConnection $db, |
|
57 | - CalDavBackend $calDavBackend, |
|
58 | - ILogger $logger, |
|
59 | - IJobList $jobList, |
|
60 | - ITimeFactory $timeFactory) { |
|
61 | - $this->db = $db; |
|
62 | - $this->calDavBackend = $calDavBackend; |
|
63 | - $this->logger = $logger; |
|
64 | - $this->jobList = $jobList; |
|
65 | - $this->timeFactory = $timeFactory; |
|
66 | - } |
|
67 | - |
|
68 | - public function run($arguments) { |
|
69 | - $offset = $arguments['offset']; |
|
70 | - $stopAt = $arguments['stopAt']; |
|
71 | - |
|
72 | - $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
73 | - |
|
74 | - $offset = $this->buildIndex($offset, $stopAt); |
|
75 | - |
|
76 | - if ($offset >= $stopAt) { |
|
77 | - $this->logger->info('Building calendar index done'); |
|
78 | - } else { |
|
79 | - $this->jobList->add(self::class, [ |
|
80 | - 'offset' => $offset, |
|
81 | - 'stopAt' => $stopAt |
|
82 | - ]); |
|
83 | - $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
84 | - } |
|
85 | - } |
|
86 | - |
|
87 | - /** |
|
88 | - * @param int $offset |
|
89 | - * @param int $stopAt |
|
90 | - * @return int |
|
91 | - */ |
|
92 | - private function buildIndex($offset, $stopAt) { |
|
93 | - $startTime = $this->timeFactory->getTime(); |
|
94 | - |
|
95 | - $query = $this->db->getQueryBuilder(); |
|
96 | - $query->select(['id', 'calendarid', 'uri', 'calendardata']) |
|
97 | - ->from('calendarobjects') |
|
98 | - ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
99 | - ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
100 | - ->orderBy('id', 'ASC'); |
|
101 | - |
|
102 | - $stmt = $query->execute(); |
|
103 | - while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
104 | - $offset = $row['id']; |
|
105 | - |
|
106 | - $calendarData = $row['calendardata']; |
|
107 | - if (is_resource($calendarData)) { |
|
108 | - $calendarData = stream_get_contents($calendarData); |
|
109 | - } |
|
110 | - |
|
111 | - $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData); |
|
112 | - |
|
113 | - if (($this->timeFactory->getTime() - $startTime) > 15) { |
|
114 | - return $offset; |
|
115 | - } |
|
116 | - } |
|
117 | - |
|
118 | - return $stopAt; |
|
119 | - } |
|
34 | + /** @var IDBConnection */ |
|
35 | + private $db; |
|
36 | + |
|
37 | + /** @var CalDavBackend */ |
|
38 | + private $calDavBackend; |
|
39 | + |
|
40 | + /** @var ILogger */ |
|
41 | + private $logger; |
|
42 | + |
|
43 | + /** @var IJobList */ |
|
44 | + private $jobList; |
|
45 | + |
|
46 | + /** @var ITimeFactory */ |
|
47 | + private $timeFactory; |
|
48 | + |
|
49 | + /** |
|
50 | + * @param IDBConnection $db |
|
51 | + * @param CalDavBackend $calDavBackend |
|
52 | + * @param ILogger $logger |
|
53 | + * @param IJobList $jobList |
|
54 | + * @param ITimeFactory $timeFactory |
|
55 | + */ |
|
56 | + public function __construct(IDBConnection $db, |
|
57 | + CalDavBackend $calDavBackend, |
|
58 | + ILogger $logger, |
|
59 | + IJobList $jobList, |
|
60 | + ITimeFactory $timeFactory) { |
|
61 | + $this->db = $db; |
|
62 | + $this->calDavBackend = $calDavBackend; |
|
63 | + $this->logger = $logger; |
|
64 | + $this->jobList = $jobList; |
|
65 | + $this->timeFactory = $timeFactory; |
|
66 | + } |
|
67 | + |
|
68 | + public function run($arguments) { |
|
69 | + $offset = $arguments['offset']; |
|
70 | + $stopAt = $arguments['stopAt']; |
|
71 | + |
|
72 | + $this->logger->info('Building calendar index (' . $offset .'/' . $stopAt . ')'); |
|
73 | + |
|
74 | + $offset = $this->buildIndex($offset, $stopAt); |
|
75 | + |
|
76 | + if ($offset >= $stopAt) { |
|
77 | + $this->logger->info('Building calendar index done'); |
|
78 | + } else { |
|
79 | + $this->jobList->add(self::class, [ |
|
80 | + 'offset' => $offset, |
|
81 | + 'stopAt' => $stopAt |
|
82 | + ]); |
|
83 | + $this->logger->info('New building calendar index job scheduled with offset ' . $offset); |
|
84 | + } |
|
85 | + } |
|
86 | + |
|
87 | + /** |
|
88 | + * @param int $offset |
|
89 | + * @param int $stopAt |
|
90 | + * @return int |
|
91 | + */ |
|
92 | + private function buildIndex($offset, $stopAt) { |
|
93 | + $startTime = $this->timeFactory->getTime(); |
|
94 | + |
|
95 | + $query = $this->db->getQueryBuilder(); |
|
96 | + $query->select(['id', 'calendarid', 'uri', 'calendardata']) |
|
97 | + ->from('calendarobjects') |
|
98 | + ->where($query->expr()->lte('id', $query->createNamedParameter($stopAt))) |
|
99 | + ->andWhere($query->expr()->gt('id', $query->createNamedParameter($offset))) |
|
100 | + ->orderBy('id', 'ASC'); |
|
101 | + |
|
102 | + $stmt = $query->execute(); |
|
103 | + while($row = $stmt->fetch(\PDO::FETCH_ASSOC)) { |
|
104 | + $offset = $row['id']; |
|
105 | + |
|
106 | + $calendarData = $row['calendardata']; |
|
107 | + if (is_resource($calendarData)) { |
|
108 | + $calendarData = stream_get_contents($calendarData); |
|
109 | + } |
|
110 | + |
|
111 | + $this->calDavBackend->updateProperties($row['calendarid'], $row['uri'], $calendarData); |
|
112 | + |
|
113 | + if (($this->timeFactory->getTime() - $startTime) > 15) { |
|
114 | + return $offset; |
|
115 | + } |
|
116 | + } |
|
117 | + |
|
118 | + return $stopAt; |
|
119 | + } |
|
120 | 120 | } |
@@ -30,57 +30,57 @@ |
||
30 | 30 | |
31 | 31 | class BuildCalendarSearchIndex implements IRepairStep { |
32 | 32 | |
33 | - /** @var IDBConnection */ |
|
34 | - private $db; |
|
33 | + /** @var IDBConnection */ |
|
34 | + private $db; |
|
35 | 35 | |
36 | - /** @var IJobList */ |
|
37 | - private $jobList; |
|
36 | + /** @var IJobList */ |
|
37 | + private $jobList; |
|
38 | 38 | |
39 | - /** @var IConfig */ |
|
40 | - private $config; |
|
39 | + /** @var IConfig */ |
|
40 | + private $config; |
|
41 | 41 | |
42 | - /** |
|
43 | - * @param IDBConnection $db |
|
44 | - * @param IJobList $jobList |
|
45 | - * @param IConfig $config |
|
46 | - */ |
|
47 | - public function __construct(IDBConnection $db, |
|
48 | - IJobList $jobList, |
|
49 | - IConfig $config) { |
|
50 | - $this->db = $db; |
|
51 | - $this->jobList = $jobList; |
|
52 | - $this->config = $config; |
|
53 | - } |
|
42 | + /** |
|
43 | + * @param IDBConnection $db |
|
44 | + * @param IJobList $jobList |
|
45 | + * @param IConfig $config |
|
46 | + */ |
|
47 | + public function __construct(IDBConnection $db, |
|
48 | + IJobList $jobList, |
|
49 | + IConfig $config) { |
|
50 | + $this->db = $db; |
|
51 | + $this->jobList = $jobList; |
|
52 | + $this->config = $config; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getName() { |
|
59 | - return 'Registering building of calendar search index as background job'; |
|
60 | - } |
|
55 | + /** |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getName() { |
|
59 | + return 'Registering building of calendar search index as background job'; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @param IOutput $output |
|
64 | - */ |
|
65 | - public function run(IOutput $output) { |
|
66 | - // only run once |
|
67 | - if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') { |
|
68 | - $output->info('Repair step already executed'); |
|
69 | - return; |
|
70 | - } |
|
62 | + /** |
|
63 | + * @param IOutput $output |
|
64 | + */ |
|
65 | + public function run(IOutput $output) { |
|
66 | + // only run once |
|
67 | + if ($this->config->getAppValue('dav', 'buildCalendarSearchIndex') === 'yes') { |
|
68 | + $output->info('Repair step already executed'); |
|
69 | + return; |
|
70 | + } |
|
71 | 71 | |
72 | - $query = $this->db->getQueryBuilder(); |
|
73 | - $query->select($query->createFunction('MAX(id)')) |
|
74 | - ->from('calendarobjects'); |
|
75 | - $maxId = (int)$query->execute()->fetchColumn(); |
|
72 | + $query = $this->db->getQueryBuilder(); |
|
73 | + $query->select($query->createFunction('MAX(id)')) |
|
74 | + ->from('calendarobjects'); |
|
75 | + $maxId = (int)$query->execute()->fetchColumn(); |
|
76 | 76 | |
77 | - $output->info('Add background job'); |
|
78 | - $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [ |
|
79 | - 'offset' => 0, |
|
80 | - 'stopAt' => $maxId |
|
81 | - ]); |
|
77 | + $output->info('Add background job'); |
|
78 | + $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [ |
|
79 | + 'offset' => 0, |
|
80 | + 'stopAt' => $maxId |
|
81 | + ]); |
|
82 | 82 | |
83 | - // if all were done, no need to redo the repair during next upgrade |
|
84 | - $this->config->setAppValue('dav', 'buildCalendarSearchIndex', 'yes'); |
|
85 | - } |
|
83 | + // if all were done, no need to redo the repair during next upgrade |
|
84 | + $this->config->setAppValue('dav', 'buildCalendarSearchIndex', 'yes'); |
|
85 | + } |
|
86 | 86 | } |
87 | 87 | \ No newline at end of file |
@@ -72,7 +72,7 @@ |
||
72 | 72 | $query = $this->db->getQueryBuilder(); |
73 | 73 | $query->select($query->createFunction('MAX(id)')) |
74 | 74 | ->from('calendarobjects'); |
75 | - $maxId = (int)$query->execute()->fetchColumn(); |
|
75 | + $maxId = (int) $query->execute()->fetchColumn(); |
|
76 | 76 | |
77 | 77 | $output->info('Add background job'); |
78 | 78 | $this->jobList->add(BuildCalendarSearchIndexBackgroundJob::class, [ |
@@ -25,135 +25,135 @@ |
||
25 | 25 | use OCA\DAV\CalDAV\CalendarHome; |
26 | 26 | |
27 | 27 | class SearchPlugin extends ServerPlugin { |
28 | - const NS_Nextcloud = 'http://nextcloud.com/ns'; |
|
29 | - |
|
30 | - /** |
|
31 | - * Reference to SabreDAV server object. |
|
32 | - * |
|
33 | - * @var \Sabre\DAV\Server |
|
34 | - */ |
|
35 | - protected $server; |
|
36 | - |
|
37 | - /** |
|
38 | - * This method should return a list of server-features. |
|
39 | - * |
|
40 | - * This is for example 'versioning' and is added to the DAV: header |
|
41 | - * in an OPTIONS response. |
|
42 | - * |
|
43 | - * @return string[] |
|
44 | - */ |
|
45 | - public function getFeatures() { |
|
46 | - // May have to be changed to be detected |
|
47 | - return ['nc-calendar-search']; |
|
48 | - } |
|
49 | - |
|
50 | - /** |
|
51 | - * Returns a plugin name. |
|
52 | - * |
|
53 | - * Using this name other plugins will be able to access other plugins |
|
54 | - * using Sabre\DAV\Server::getPlugin |
|
55 | - * |
|
56 | - * @return string |
|
57 | - */ |
|
58 | - public function getPluginName() { |
|
59 | - return 'nc-calendar-search'; |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * This initializes the plugin. |
|
64 | - * |
|
65 | - * This function is called by Sabre\DAV\Server, after |
|
66 | - * addPlugin is called. |
|
67 | - * |
|
68 | - * This method should set up the required event subscriptions. |
|
69 | - * |
|
70 | - * @param Server $server |
|
71 | - */ |
|
72 | - public function initialize(Server $server) { |
|
73 | - $this->server = $server; |
|
74 | - |
|
75 | - $server->on('report', [$this, 'report']); |
|
76 | - |
|
77 | - $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] = |
|
78 | - 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport'; |
|
79 | - } |
|
80 | - |
|
81 | - /** |
|
82 | - * This functions handles REPORT requests specific to CalDAV |
|
83 | - * |
|
84 | - * @param string $reportName |
|
85 | - * @param mixed $report |
|
86 | - * @param mixed $path |
|
87 | - * @return bool |
|
88 | - */ |
|
89 | - public function report($reportName, $report, $path) { |
|
90 | - switch ($reportName) { |
|
91 | - case '{' . self::NS_Nextcloud . '}calendar-search': |
|
92 | - $this->server->transactionType = 'report-nc-calendar-search'; |
|
93 | - $this->calendarSearch($report); |
|
94 | - return false; |
|
95 | - } |
|
96 | - } |
|
97 | - |
|
98 | - /** |
|
99 | - * Returns a list of reports this plugin supports. |
|
100 | - * |
|
101 | - * This will be used in the {DAV:}supported-report-set property. |
|
102 | - * Note that you still need to subscribe to the 'report' event to actually |
|
103 | - * implement them |
|
104 | - * |
|
105 | - * @param string $uri |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - public function getSupportedReportSet($uri) { |
|
109 | - $node = $this->server->tree->getNodeForPath($uri); |
|
110 | - |
|
111 | - $reports = []; |
|
112 | - if ($node instanceof CalendarHome) { |
|
113 | - $reports[] = '{' . self::NS_Nextcloud . '}calendar-search'; |
|
114 | - } |
|
115 | - |
|
116 | - return $reports; |
|
117 | - } |
|
118 | - |
|
119 | - /** |
|
120 | - * This function handles the calendar-query REPORT |
|
121 | - * |
|
122 | - * This report is used by clients to request calendar objects based on |
|
123 | - * complex conditions. |
|
124 | - * |
|
125 | - * @param Xml\Request\CalendarSearchReport $report |
|
126 | - * @return void |
|
127 | - */ |
|
128 | - private function calendarSearch($report) { |
|
129 | - $node = $this->server->tree->getNodeForPath($this->server->getRequestUri()); |
|
130 | - $depth = $this->server->getHTTPDepth(2); |
|
131 | - |
|
132 | - // The default result is an empty array |
|
133 | - $result = []; |
|
134 | - |
|
135 | - // If we're dealing with the calendar home, the calendar home itself is |
|
136 | - // responsible for the calendar-query |
|
137 | - if ($node instanceof CalendarHome && $depth == 2) { |
|
138 | - |
|
139 | - $nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset); |
|
140 | - |
|
141 | - foreach ($nodePaths as $path) { |
|
142 | - list($properties) = $this->server->getPropertiesForPath( |
|
143 | - $this->server->getRequestUri() . '/' . $path, |
|
144 | - $report->properties); |
|
145 | - $result[] = $properties; |
|
146 | - } |
|
147 | - } |
|
148 | - |
|
149 | - $prefer = $this->server->getHTTPPrefer(); |
|
150 | - |
|
151 | - $this->server->httpResponse->setStatus(207); |
|
152 | - $this->server->httpResponse->setHeader('Content-Type', |
|
153 | - 'application/xml; charset=utf-8'); |
|
154 | - $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer'); |
|
155 | - $this->server->httpResponse->setBody( |
|
156 | - $this->server->generateMultiStatus($result, |
|
157 | - $prefer['return'] === 'minimal')); |
|
158 | - } |
|
28 | + const NS_Nextcloud = 'http://nextcloud.com/ns'; |
|
29 | + |
|
30 | + /** |
|
31 | + * Reference to SabreDAV server object. |
|
32 | + * |
|
33 | + * @var \Sabre\DAV\Server |
|
34 | + */ |
|
35 | + protected $server; |
|
36 | + |
|
37 | + /** |
|
38 | + * This method should return a list of server-features. |
|
39 | + * |
|
40 | + * This is for example 'versioning' and is added to the DAV: header |
|
41 | + * in an OPTIONS response. |
|
42 | + * |
|
43 | + * @return string[] |
|
44 | + */ |
|
45 | + public function getFeatures() { |
|
46 | + // May have to be changed to be detected |
|
47 | + return ['nc-calendar-search']; |
|
48 | + } |
|
49 | + |
|
50 | + /** |
|
51 | + * Returns a plugin name. |
|
52 | + * |
|
53 | + * Using this name other plugins will be able to access other plugins |
|
54 | + * using Sabre\DAV\Server::getPlugin |
|
55 | + * |
|
56 | + * @return string |
|
57 | + */ |
|
58 | + public function getPluginName() { |
|
59 | + return 'nc-calendar-search'; |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * This initializes the plugin. |
|
64 | + * |
|
65 | + * This function is called by Sabre\DAV\Server, after |
|
66 | + * addPlugin is called. |
|
67 | + * |
|
68 | + * This method should set up the required event subscriptions. |
|
69 | + * |
|
70 | + * @param Server $server |
|
71 | + */ |
|
72 | + public function initialize(Server $server) { |
|
73 | + $this->server = $server; |
|
74 | + |
|
75 | + $server->on('report', [$this, 'report']); |
|
76 | + |
|
77 | + $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] = |
|
78 | + 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport'; |
|
79 | + } |
|
80 | + |
|
81 | + /** |
|
82 | + * This functions handles REPORT requests specific to CalDAV |
|
83 | + * |
|
84 | + * @param string $reportName |
|
85 | + * @param mixed $report |
|
86 | + * @param mixed $path |
|
87 | + * @return bool |
|
88 | + */ |
|
89 | + public function report($reportName, $report, $path) { |
|
90 | + switch ($reportName) { |
|
91 | + case '{' . self::NS_Nextcloud . '}calendar-search': |
|
92 | + $this->server->transactionType = 'report-nc-calendar-search'; |
|
93 | + $this->calendarSearch($report); |
|
94 | + return false; |
|
95 | + } |
|
96 | + } |
|
97 | + |
|
98 | + /** |
|
99 | + * Returns a list of reports this plugin supports. |
|
100 | + * |
|
101 | + * This will be used in the {DAV:}supported-report-set property. |
|
102 | + * Note that you still need to subscribe to the 'report' event to actually |
|
103 | + * implement them |
|
104 | + * |
|
105 | + * @param string $uri |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + public function getSupportedReportSet($uri) { |
|
109 | + $node = $this->server->tree->getNodeForPath($uri); |
|
110 | + |
|
111 | + $reports = []; |
|
112 | + if ($node instanceof CalendarHome) { |
|
113 | + $reports[] = '{' . self::NS_Nextcloud . '}calendar-search'; |
|
114 | + } |
|
115 | + |
|
116 | + return $reports; |
|
117 | + } |
|
118 | + |
|
119 | + /** |
|
120 | + * This function handles the calendar-query REPORT |
|
121 | + * |
|
122 | + * This report is used by clients to request calendar objects based on |
|
123 | + * complex conditions. |
|
124 | + * |
|
125 | + * @param Xml\Request\CalendarSearchReport $report |
|
126 | + * @return void |
|
127 | + */ |
|
128 | + private function calendarSearch($report) { |
|
129 | + $node = $this->server->tree->getNodeForPath($this->server->getRequestUri()); |
|
130 | + $depth = $this->server->getHTTPDepth(2); |
|
131 | + |
|
132 | + // The default result is an empty array |
|
133 | + $result = []; |
|
134 | + |
|
135 | + // If we're dealing with the calendar home, the calendar home itself is |
|
136 | + // responsible for the calendar-query |
|
137 | + if ($node instanceof CalendarHome && $depth == 2) { |
|
138 | + |
|
139 | + $nodePaths = $node->calendarSearch($report->filters, $report->limit, $report->offset); |
|
140 | + |
|
141 | + foreach ($nodePaths as $path) { |
|
142 | + list($properties) = $this->server->getPropertiesForPath( |
|
143 | + $this->server->getRequestUri() . '/' . $path, |
|
144 | + $report->properties); |
|
145 | + $result[] = $properties; |
|
146 | + } |
|
147 | + } |
|
148 | + |
|
149 | + $prefer = $this->server->getHTTPPrefer(); |
|
150 | + |
|
151 | + $this->server->httpResponse->setStatus(207); |
|
152 | + $this->server->httpResponse->setHeader('Content-Type', |
|
153 | + 'application/xml; charset=utf-8'); |
|
154 | + $this->server->httpResponse->setHeader('Vary', 'Brief,Prefer'); |
|
155 | + $this->server->httpResponse->setBody( |
|
156 | + $this->server->generateMultiStatus($result, |
|
157 | + $prefer['return'] === 'minimal')); |
|
158 | + } |
|
159 | 159 | } |
160 | 160 | \ No newline at end of file |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | $server->on('report', [$this, 'report']); |
76 | 76 | |
77 | - $server->xml->elementMap['{' . self::NS_Nextcloud . '}calendar-search'] = |
|
77 | + $server->xml->elementMap['{'.self::NS_Nextcloud.'}calendar-search'] = |
|
78 | 78 | 'OCA\\DAV\\CalDAV\\Search\\Xml\\Request\\CalendarSearchReport'; |
79 | 79 | } |
80 | 80 | |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | */ |
89 | 89 | public function report($reportName, $report, $path) { |
90 | 90 | switch ($reportName) { |
91 | - case '{' . self::NS_Nextcloud . '}calendar-search': |
|
91 | + case '{'.self::NS_Nextcloud.'}calendar-search': |
|
92 | 92 | $this->server->transactionType = 'report-nc-calendar-search'; |
93 | 93 | $this->calendarSearch($report); |
94 | 94 | return false; |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | $reports = []; |
112 | 112 | if ($node instanceof CalendarHome) { |
113 | - $reports[] = '{' . self::NS_Nextcloud . '}calendar-search'; |
|
113 | + $reports[] = '{'.self::NS_Nextcloud.'}calendar-search'; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | return $reports; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | |
141 | 141 | foreach ($nodePaths as $path) { |
142 | 142 | list($properties) = $this->server->getPropertiesForPath( |
143 | - $this->server->getRequestUri() . '/' . $path, |
|
143 | + $this->server->getRequestUri().'/'.$path, |
|
144 | 144 | $report->properties); |
145 | 145 | $result[] = $properties; |
146 | 146 | } |