@@ -32,100 +32,100 @@ |
||
32 | 32 | * @since 7.0.0 |
33 | 33 | */ |
34 | 34 | interface IJobList { |
35 | - /** |
|
36 | - * Add a job to the list |
|
37 | - * |
|
38 | - * @param \OCP\BackgroundJob\IJob|string $job |
|
39 | - * @param mixed $argument The argument to be passed to $job->run() when the job is exectured |
|
40 | - * @since 7.0.0 |
|
41 | - */ |
|
42 | - public function add($job, $argument = null); |
|
35 | + /** |
|
36 | + * Add a job to the list |
|
37 | + * |
|
38 | + * @param \OCP\BackgroundJob\IJob|string $job |
|
39 | + * @param mixed $argument The argument to be passed to $job->run() when the job is exectured |
|
40 | + * @since 7.0.0 |
|
41 | + */ |
|
42 | + public function add($job, $argument = null); |
|
43 | 43 | |
44 | - /** |
|
45 | - * Remove a job from the list |
|
46 | - * |
|
47 | - * @param \OCP\BackgroundJob\IJob|string $job |
|
48 | - * @param mixed $argument |
|
49 | - * @since 7.0.0 |
|
50 | - */ |
|
51 | - public function remove($job, $argument = null); |
|
44 | + /** |
|
45 | + * Remove a job from the list |
|
46 | + * |
|
47 | + * @param \OCP\BackgroundJob\IJob|string $job |
|
48 | + * @param mixed $argument |
|
49 | + * @since 7.0.0 |
|
50 | + */ |
|
51 | + public function remove($job, $argument = null); |
|
52 | 52 | |
53 | - /** |
|
54 | - * check if a job is in the list |
|
55 | - * |
|
56 | - * @param \OCP\BackgroundJob\IJob|string $job |
|
57 | - * @param mixed $argument |
|
58 | - * @return bool |
|
59 | - * @since 7.0.0 |
|
60 | - */ |
|
61 | - public function has($job, $argument); |
|
53 | + /** |
|
54 | + * check if a job is in the list |
|
55 | + * |
|
56 | + * @param \OCP\BackgroundJob\IJob|string $job |
|
57 | + * @param mixed $argument |
|
58 | + * @return bool |
|
59 | + * @since 7.0.0 |
|
60 | + */ |
|
61 | + public function has($job, $argument); |
|
62 | 62 | |
63 | - /** |
|
64 | - * get all jobs in the list |
|
65 | - * |
|
66 | - * @return \OCP\BackgroundJob\IJob[] |
|
67 | - * @since 7.0.0 |
|
68 | - * @deprecated 9.0.0 - This method is dangerous since it can cause load and |
|
69 | - * memory problems when creating too many instances. |
|
70 | - */ |
|
71 | - public function getAll(); |
|
63 | + /** |
|
64 | + * get all jobs in the list |
|
65 | + * |
|
66 | + * @return \OCP\BackgroundJob\IJob[] |
|
67 | + * @since 7.0.0 |
|
68 | + * @deprecated 9.0.0 - This method is dangerous since it can cause load and |
|
69 | + * memory problems when creating too many instances. |
|
70 | + */ |
|
71 | + public function getAll(); |
|
72 | 72 | |
73 | - /** |
|
74 | - * get the next job in the list |
|
75 | - * |
|
76 | - * @return \OCP\BackgroundJob\IJob|null |
|
77 | - * @since 7.0.0 |
|
78 | - */ |
|
79 | - public function getNext(); |
|
73 | + /** |
|
74 | + * get the next job in the list |
|
75 | + * |
|
76 | + * @return \OCP\BackgroundJob\IJob|null |
|
77 | + * @since 7.0.0 |
|
78 | + */ |
|
79 | + public function getNext(); |
|
80 | 80 | |
81 | - /** |
|
82 | - * @param int $id |
|
83 | - * @return \OCP\BackgroundJob\IJob|null |
|
84 | - * @since 7.0.0 |
|
85 | - */ |
|
86 | - public function getById($id); |
|
81 | + /** |
|
82 | + * @param int $id |
|
83 | + * @return \OCP\BackgroundJob\IJob|null |
|
84 | + * @since 7.0.0 |
|
85 | + */ |
|
86 | + public function getById($id); |
|
87 | 87 | |
88 | - /** |
|
89 | - * set the job that was last ran to the current time |
|
90 | - * |
|
91 | - * @param \OCP\BackgroundJob\IJob $job |
|
92 | - * @since 7.0.0 |
|
93 | - */ |
|
94 | - public function setLastJob(IJob $job); |
|
88 | + /** |
|
89 | + * set the job that was last ran to the current time |
|
90 | + * |
|
91 | + * @param \OCP\BackgroundJob\IJob $job |
|
92 | + * @since 7.0.0 |
|
93 | + */ |
|
94 | + public function setLastJob(IJob $job); |
|
95 | 95 | |
96 | - /** |
|
97 | - * Remove the reservation for a job |
|
98 | - * |
|
99 | - * @param IJob $job |
|
100 | - * @since 9.1.0 |
|
101 | - */ |
|
102 | - public function unlockJob(IJob $job); |
|
96 | + /** |
|
97 | + * Remove the reservation for a job |
|
98 | + * |
|
99 | + * @param IJob $job |
|
100 | + * @since 9.1.0 |
|
101 | + */ |
|
102 | + public function unlockJob(IJob $job); |
|
103 | 103 | |
104 | - /** |
|
105 | - * get the id of the last ran job |
|
106 | - * |
|
107 | - * @return int |
|
108 | - * @since 7.0.0 |
|
109 | - * @deprecated 9.1.0 - The functionality behind the value is deprecated, it |
|
110 | - * only tells you which job finished last, but since we now allow multiple |
|
111 | - * executors to run in parallel, it's not used to calculate the next job. |
|
112 | - */ |
|
113 | - public function getLastJob(); |
|
104 | + /** |
|
105 | + * get the id of the last ran job |
|
106 | + * |
|
107 | + * @return int |
|
108 | + * @since 7.0.0 |
|
109 | + * @deprecated 9.1.0 - The functionality behind the value is deprecated, it |
|
110 | + * only tells you which job finished last, but since we now allow multiple |
|
111 | + * executors to run in parallel, it's not used to calculate the next job. |
|
112 | + */ |
|
113 | + public function getLastJob(); |
|
114 | 114 | |
115 | - /** |
|
116 | - * set the lastRun of $job to now |
|
117 | - * |
|
118 | - * @param IJob $job |
|
119 | - * @since 7.0.0 |
|
120 | - */ |
|
121 | - public function setLastRun(IJob $job); |
|
115 | + /** |
|
116 | + * set the lastRun of $job to now |
|
117 | + * |
|
118 | + * @param IJob $job |
|
119 | + * @since 7.0.0 |
|
120 | + */ |
|
121 | + public function setLastRun(IJob $job); |
|
122 | 122 | |
123 | - /** |
|
124 | - * set the run duration of $job |
|
125 | - * |
|
126 | - * @param IJob $job |
|
127 | - * @param $timeTaken |
|
128 | - * @since 12.0.0 |
|
129 | - */ |
|
130 | - public function setExecutionTime(IJob $job, $timeTaken); |
|
123 | + /** |
|
124 | + * set the run duration of $job |
|
125 | + * |
|
126 | + * @param IJob $job |
|
127 | + * @param $timeTaken |
|
128 | + * @since 12.0.0 |
|
129 | + */ |
|
130 | + public function setExecutionTime(IJob $job, $timeTaken); |
|
131 | 131 | } |
@@ -107,32 +107,32 @@ discard block |
||
107 | 107 | case '{DAV:}prop': |
108 | 108 | $newProps['properties'] = array_keys($elem['value']); |
109 | 109 | break; |
110 | - case '{' . SearchPlugin::NS_Nextcloud . '}filter': |
|
110 | + case '{'.SearchPlugin::NS_Nextcloud.'}filter': |
|
111 | 111 | foreach ($elem['value'] as $subElem) { |
112 | - if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') { |
|
112 | + if ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}comp-filter') { |
|
113 | 113 | if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) { |
114 | 114 | $newProps['filters']['comps'] = []; |
115 | 115 | } |
116 | 116 | $newProps['filters']['comps'][] = $subElem['value']; |
117 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') { |
|
117 | + } elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}prop-filter') { |
|
118 | 118 | if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) { |
119 | 119 | $newProps['filters']['props'] = []; |
120 | 120 | } |
121 | 121 | $newProps['filters']['props'][] = $subElem['value']; |
122 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') { |
|
122 | + } elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}param-filter') { |
|
123 | 123 | if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) { |
124 | 124 | $newProps['filters']['params'] = []; |
125 | 125 | } |
126 | 126 | $newProps['filters']['params'][] = $subElem['value']; |
127 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') { |
|
127 | + } elseif ($subElem['name'] === '{'.SearchPlugin::NS_Nextcloud.'}search-term') { |
|
128 | 128 | $newProps['filters']['search-term'] = $subElem['value']; |
129 | 129 | } |
130 | 130 | } |
131 | 131 | break; |
132 | - case '{' . SearchPlugin::NS_Nextcloud . '}limit': |
|
132 | + case '{'.SearchPlugin::NS_Nextcloud.'}limit': |
|
133 | 133 | $newProps['limit'] = $elem['value']; |
134 | 134 | break; |
135 | - case '{' . SearchPlugin::NS_Nextcloud . '}offset': |
|
135 | + case '{'.SearchPlugin::NS_Nextcloud.'}offset': |
|
136 | 136 | $newProps['offset'] = $elem['value']; |
137 | 137 | break; |
138 | 138 | |
@@ -140,21 +140,21 @@ discard block |
||
140 | 140 | } |
141 | 141 | |
142 | 142 | if (empty($newProps['filters'])) { |
143 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request'); |
|
143 | + throw new BadRequest('The {'.SearchPlugin::NS_Nextcloud.'}filter element is required for this request'); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params'])); |
147 | 147 | $noCompsDefined = empty($newProps['filters']['comps']); |
148 | 148 | if ($propsOrParamsDefined && $noCompsDefined) { |
149 | - throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter'); |
|
149 | + throw new BadRequest('{'.SearchPlugin::NS_Nextcloud.'}prop-filter or {'.SearchPlugin::NS_Nextcloud.'}param-filter given without any {'.SearchPlugin::NS_Nextcloud.'}comp-filter'); |
|
150 | 150 | } |
151 | 151 | |
152 | 152 | if (!isset($newProps['filters']['search-term'])) { |
153 | - throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request'); |
|
153 | + throw new BadRequest('{'.SearchPlugin::NS_Nextcloud.'}search-term is required for this request'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) { |
157 | - throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request'); |
|
157 | + throw new BadRequest('At least one{'.SearchPlugin::NS_Nextcloud.'}prop-filter or {'.SearchPlugin::NS_Nextcloud.'}param-filter is required for this request'); |
|
158 | 158 | } |
159 | 159 | |
160 | 160 |
@@ -39,133 +39,133 @@ |
||
39 | 39 | */ |
40 | 40 | class CalendarSearchReport implements XmlDeserializable { |
41 | 41 | |
42 | - /** |
|
43 | - * An array with requested properties. |
|
44 | - * |
|
45 | - * @var array |
|
46 | - */ |
|
47 | - public $properties; |
|
48 | - |
|
49 | - /** |
|
50 | - * List of property/component filters. |
|
51 | - * |
|
52 | - * @var array |
|
53 | - */ |
|
54 | - public $filters; |
|
55 | - |
|
56 | - /** |
|
57 | - * @var int |
|
58 | - */ |
|
59 | - public $limit; |
|
60 | - |
|
61 | - /** |
|
62 | - * @var int |
|
63 | - */ |
|
64 | - public $offset; |
|
65 | - |
|
66 | - /** |
|
67 | - * The deserialize method is called during xml parsing. |
|
68 | - * |
|
69 | - * This method is called statically, this is because in theory this method |
|
70 | - * may be used as a type of constructor, or factory method. |
|
71 | - * |
|
72 | - * Often you want to return an instance of the current class, but you are |
|
73 | - * free to return other data as well. |
|
74 | - * |
|
75 | - * You are responsible for advancing the reader to the next element. Not |
|
76 | - * doing anything will result in a never-ending loop. |
|
77 | - * |
|
78 | - * If you just want to skip parsing for this element altogether, you can |
|
79 | - * just call $reader->next(); |
|
80 | - * |
|
81 | - * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
82 | - * the next element. |
|
83 | - * |
|
84 | - * @param Reader $reader |
|
85 | - * @return mixed |
|
86 | - */ |
|
87 | - public static function xmlDeserialize(Reader $reader) { |
|
88 | - $elems = $reader->parseInnerTree([ |
|
89 | - '{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter', |
|
90 | - '{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter', |
|
91 | - '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter', |
|
92 | - '{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter', |
|
93 | - '{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter', |
|
94 | - '{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter', |
|
95 | - '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', |
|
96 | - ]); |
|
97 | - |
|
98 | - $newProps = [ |
|
99 | - 'filters' => [], |
|
100 | - 'properties' => [], |
|
101 | - 'limit' => null, |
|
102 | - 'offset' => null |
|
103 | - ]; |
|
104 | - |
|
105 | - if (!is_array($elems)) { |
|
106 | - $elems = []; |
|
107 | - } |
|
108 | - |
|
109 | - foreach ($elems as $elem) { |
|
110 | - switch ($elem['name']) { |
|
111 | - case '{DAV:}prop': |
|
112 | - $newProps['properties'] = array_keys($elem['value']); |
|
113 | - break; |
|
114 | - case '{' . SearchPlugin::NS_Nextcloud . '}filter': |
|
115 | - foreach ($elem['value'] as $subElem) { |
|
116 | - if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') { |
|
117 | - if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) { |
|
118 | - $newProps['filters']['comps'] = []; |
|
119 | - } |
|
120 | - $newProps['filters']['comps'][] = $subElem['value']; |
|
121 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') { |
|
122 | - if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) { |
|
123 | - $newProps['filters']['props'] = []; |
|
124 | - } |
|
125 | - $newProps['filters']['props'][] = $subElem['value']; |
|
126 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') { |
|
127 | - if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) { |
|
128 | - $newProps['filters']['params'] = []; |
|
129 | - } |
|
130 | - $newProps['filters']['params'][] = $subElem['value']; |
|
131 | - } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') { |
|
132 | - $newProps['filters']['search-term'] = $subElem['value']; |
|
133 | - } |
|
134 | - } |
|
135 | - break; |
|
136 | - case '{' . SearchPlugin::NS_Nextcloud . '}limit': |
|
137 | - $newProps['limit'] = $elem['value']; |
|
138 | - break; |
|
139 | - case '{' . SearchPlugin::NS_Nextcloud . '}offset': |
|
140 | - $newProps['offset'] = $elem['value']; |
|
141 | - break; |
|
142 | - |
|
143 | - } |
|
144 | - } |
|
145 | - |
|
146 | - if (empty($newProps['filters'])) { |
|
147 | - throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request'); |
|
148 | - } |
|
149 | - |
|
150 | - $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params'])); |
|
151 | - $noCompsDefined = empty($newProps['filters']['comps']); |
|
152 | - if ($propsOrParamsDefined && $noCompsDefined) { |
|
153 | - throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter'); |
|
154 | - } |
|
155 | - |
|
156 | - if (!isset($newProps['filters']['search-term'])) { |
|
157 | - throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request'); |
|
158 | - } |
|
159 | - |
|
160 | - if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) { |
|
161 | - throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request'); |
|
162 | - } |
|
163 | - |
|
164 | - |
|
165 | - $obj = new self(); |
|
166 | - foreach ($newProps as $key => $value) { |
|
167 | - $obj->$key = $value; |
|
168 | - } |
|
169 | - return $obj; |
|
170 | - } |
|
42 | + /** |
|
43 | + * An array with requested properties. |
|
44 | + * |
|
45 | + * @var array |
|
46 | + */ |
|
47 | + public $properties; |
|
48 | + |
|
49 | + /** |
|
50 | + * List of property/component filters. |
|
51 | + * |
|
52 | + * @var array |
|
53 | + */ |
|
54 | + public $filters; |
|
55 | + |
|
56 | + /** |
|
57 | + * @var int |
|
58 | + */ |
|
59 | + public $limit; |
|
60 | + |
|
61 | + /** |
|
62 | + * @var int |
|
63 | + */ |
|
64 | + public $offset; |
|
65 | + |
|
66 | + /** |
|
67 | + * The deserialize method is called during xml parsing. |
|
68 | + * |
|
69 | + * This method is called statically, this is because in theory this method |
|
70 | + * may be used as a type of constructor, or factory method. |
|
71 | + * |
|
72 | + * Often you want to return an instance of the current class, but you are |
|
73 | + * free to return other data as well. |
|
74 | + * |
|
75 | + * You are responsible for advancing the reader to the next element. Not |
|
76 | + * doing anything will result in a never-ending loop. |
|
77 | + * |
|
78 | + * If you just want to skip parsing for this element altogether, you can |
|
79 | + * just call $reader->next(); |
|
80 | + * |
|
81 | + * $reader->parseInnerTree() will parse the entire sub-tree, and advance to |
|
82 | + * the next element. |
|
83 | + * |
|
84 | + * @param Reader $reader |
|
85 | + * @return mixed |
|
86 | + */ |
|
87 | + public static function xmlDeserialize(Reader $reader) { |
|
88 | + $elems = $reader->parseInnerTree([ |
|
89 | + '{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter', |
|
90 | + '{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter', |
|
91 | + '{http://nextcloud.com/ns}param-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\ParamFilter', |
|
92 | + '{http://nextcloud.com/ns}search-term' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\SearchTermFilter', |
|
93 | + '{http://nextcloud.com/ns}limit' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\LimitFilter', |
|
94 | + '{http://nextcloud.com/ns}offset' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\OffsetFilter', |
|
95 | + '{DAV:}prop' => 'Sabre\\Xml\\Element\\KeyValue', |
|
96 | + ]); |
|
97 | + |
|
98 | + $newProps = [ |
|
99 | + 'filters' => [], |
|
100 | + 'properties' => [], |
|
101 | + 'limit' => null, |
|
102 | + 'offset' => null |
|
103 | + ]; |
|
104 | + |
|
105 | + if (!is_array($elems)) { |
|
106 | + $elems = []; |
|
107 | + } |
|
108 | + |
|
109 | + foreach ($elems as $elem) { |
|
110 | + switch ($elem['name']) { |
|
111 | + case '{DAV:}prop': |
|
112 | + $newProps['properties'] = array_keys($elem['value']); |
|
113 | + break; |
|
114 | + case '{' . SearchPlugin::NS_Nextcloud . '}filter': |
|
115 | + foreach ($elem['value'] as $subElem) { |
|
116 | + if ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}comp-filter') { |
|
117 | + if (!isset($newProps['filters']['comps']) || !is_array($newProps['filters']['comps'])) { |
|
118 | + $newProps['filters']['comps'] = []; |
|
119 | + } |
|
120 | + $newProps['filters']['comps'][] = $subElem['value']; |
|
121 | + } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}prop-filter') { |
|
122 | + if (!isset($newProps['filters']['props']) || !is_array($newProps['filters']['props'])) { |
|
123 | + $newProps['filters']['props'] = []; |
|
124 | + } |
|
125 | + $newProps['filters']['props'][] = $subElem['value']; |
|
126 | + } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}param-filter') { |
|
127 | + if (!isset($newProps['filters']['params']) || !is_array($newProps['filters']['params'])) { |
|
128 | + $newProps['filters']['params'] = []; |
|
129 | + } |
|
130 | + $newProps['filters']['params'][] = $subElem['value']; |
|
131 | + } elseif ($subElem['name'] === '{' . SearchPlugin::NS_Nextcloud . '}search-term') { |
|
132 | + $newProps['filters']['search-term'] = $subElem['value']; |
|
133 | + } |
|
134 | + } |
|
135 | + break; |
|
136 | + case '{' . SearchPlugin::NS_Nextcloud . '}limit': |
|
137 | + $newProps['limit'] = $elem['value']; |
|
138 | + break; |
|
139 | + case '{' . SearchPlugin::NS_Nextcloud . '}offset': |
|
140 | + $newProps['offset'] = $elem['value']; |
|
141 | + break; |
|
142 | + |
|
143 | + } |
|
144 | + } |
|
145 | + |
|
146 | + if (empty($newProps['filters'])) { |
|
147 | + throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}filter element is required for this request'); |
|
148 | + } |
|
149 | + |
|
150 | + $propsOrParamsDefined = (!empty($newProps['filters']['props']) || !empty($newProps['filters']['params'])); |
|
151 | + $noCompsDefined = empty($newProps['filters']['comps']); |
|
152 | + if ($propsOrParamsDefined && $noCompsDefined) { |
|
153 | + throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter given without any {' . SearchPlugin::NS_Nextcloud . '}comp-filter'); |
|
154 | + } |
|
155 | + |
|
156 | + if (!isset($newProps['filters']['search-term'])) { |
|
157 | + throw new BadRequest('{' . SearchPlugin::NS_Nextcloud . '}search-term is required for this request'); |
|
158 | + } |
|
159 | + |
|
160 | + if (empty($newProps['filters']['props']) && empty($newProps['filters']['params'])) { |
|
161 | + throw new BadRequest('At least one{' . SearchPlugin::NS_Nextcloud . '}prop-filter or {' . SearchPlugin::NS_Nextcloud . '}param-filter is required for this request'); |
|
162 | + } |
|
163 | + |
|
164 | + |
|
165 | + $obj = new self(); |
|
166 | + foreach ($newProps as $key => $value) { |
|
167 | + $obj->$key = $value; |
|
168 | + } |
|
169 | + return $obj; |
|
170 | + } |
|
171 | 171 | } |
@@ -23,20 +23,20 @@ |
||
23 | 23 | |
24 | 24 | class CoreBundle extends Bundle { |
25 | 25 | |
26 | - /** |
|
27 | - * {@inheritDoc} |
|
28 | - */ |
|
29 | - public function getName() { |
|
30 | - return 'Core bundle'; |
|
31 | - } |
|
26 | + /** |
|
27 | + * {@inheritDoc} |
|
28 | + */ |
|
29 | + public function getName() { |
|
30 | + return 'Core bundle'; |
|
31 | + } |
|
32 | 32 | |
33 | - /** |
|
34 | - * {@inheritDoc} |
|
35 | - */ |
|
36 | - public function getAppIdentifiers() { |
|
37 | - return [ |
|
38 | - 'bruteforcesettings', |
|
39 | - ]; |
|
40 | - } |
|
33 | + /** |
|
34 | + * {@inheritDoc} |
|
35 | + */ |
|
36 | + public function getAppIdentifiers() { |
|
37 | + return [ |
|
38 | + 'bruteforcesettings', |
|
39 | + ]; |
|
40 | + } |
|
41 | 41 | |
42 | 42 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * {@inheritDoc} |
28 | 28 | */ |
29 | 29 | public function getName() { |
30 | - return (string)$this->l10n->t('Groupware bundle'); |
|
30 | + return (string) $this->l10n->t('Groupware bundle'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -25,23 +25,23 @@ |
||
25 | 25 | |
26 | 26 | class GroupwareBundle extends Bundle { |
27 | 27 | |
28 | - /** |
|
29 | - * {@inheritDoc} |
|
30 | - */ |
|
31 | - public function getName() { |
|
32 | - return (string)$this->l10n->t('Groupware bundle'); |
|
33 | - } |
|
28 | + /** |
|
29 | + * {@inheritDoc} |
|
30 | + */ |
|
31 | + public function getName() { |
|
32 | + return (string)$this->l10n->t('Groupware bundle'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - */ |
|
38 | - public function getAppIdentifiers() { |
|
39 | - return [ |
|
40 | - 'calendar', |
|
41 | - 'contacts', |
|
42 | - 'deck', |
|
43 | - 'mail' |
|
44 | - ]; |
|
45 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + */ |
|
38 | + public function getAppIdentifiers() { |
|
39 | + return [ |
|
40 | + 'calendar', |
|
41 | + 'contacts', |
|
42 | + 'deck', |
|
43 | + 'mail' |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |
@@ -35,55 +35,55 @@ |
||
35 | 35 | * @since 8.0.0 |
36 | 36 | */ |
37 | 37 | interface IEventLogger { |
38 | - /** |
|
39 | - * Mark the start of an event setting its ID $id and providing event description $description. |
|
40 | - * |
|
41 | - * @param string $id |
|
42 | - * @param string $description |
|
43 | - * @since 8.0.0 |
|
44 | - */ |
|
45 | - public function start($id, $description); |
|
38 | + /** |
|
39 | + * Mark the start of an event setting its ID $id and providing event description $description. |
|
40 | + * |
|
41 | + * @param string $id |
|
42 | + * @param string $description |
|
43 | + * @since 8.0.0 |
|
44 | + */ |
|
45 | + public function start($id, $description); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Mark the end of an event with specific ID $id, marked by start() method. |
|
49 | - * Ending event should store \OCP\Diagnostics\IEvent to |
|
50 | - * be returned with getEvents() method. |
|
51 | - * |
|
52 | - * @param string $id |
|
53 | - * @since 8.0.0 |
|
54 | - */ |
|
55 | - public function end($id); |
|
47 | + /** |
|
48 | + * Mark the end of an event with specific ID $id, marked by start() method. |
|
49 | + * Ending event should store \OCP\Diagnostics\IEvent to |
|
50 | + * be returned with getEvents() method. |
|
51 | + * |
|
52 | + * @param string $id |
|
53 | + * @since 8.0.0 |
|
54 | + */ |
|
55 | + public function end($id); |
|
56 | 56 | |
57 | - /** |
|
58 | - * Mark the start and the end of an event with specific ID $id and description $description, |
|
59 | - * explicitly marking start and end of the event, represented by $start and $end timestamps. |
|
60 | - * Logging event should store \OCP\Diagnostics\IEvent to |
|
61 | - * be returned with getEvents() method. |
|
62 | - * |
|
63 | - * @param string $id |
|
64 | - * @param string $description |
|
65 | - * @param float $start |
|
66 | - * @param float $end |
|
67 | - * @since 8.0.0 |
|
68 | - */ |
|
69 | - public function log($id, $description, $start, $end); |
|
57 | + /** |
|
58 | + * Mark the start and the end of an event with specific ID $id and description $description, |
|
59 | + * explicitly marking start and end of the event, represented by $start and $end timestamps. |
|
60 | + * Logging event should store \OCP\Diagnostics\IEvent to |
|
61 | + * be returned with getEvents() method. |
|
62 | + * |
|
63 | + * @param string $id |
|
64 | + * @param string $description |
|
65 | + * @param float $start |
|
66 | + * @param float $end |
|
67 | + * @since 8.0.0 |
|
68 | + */ |
|
69 | + public function log($id, $description, $start, $end); |
|
70 | 70 | |
71 | - /** |
|
72 | - * This method should return all \OCP\Diagnostics\IEvent objects stored using |
|
73 | - * start()/end() or log() methods |
|
74 | - * |
|
75 | - * @return \OCP\Diagnostics\IEvent[] |
|
76 | - * @since 8.0.0 |
|
77 | - */ |
|
78 | - public function getEvents(); |
|
71 | + /** |
|
72 | + * This method should return all \OCP\Diagnostics\IEvent objects stored using |
|
73 | + * start()/end() or log() methods |
|
74 | + * |
|
75 | + * @return \OCP\Diagnostics\IEvent[] |
|
76 | + * @since 8.0.0 |
|
77 | + */ |
|
78 | + public function getEvents(); |
|
79 | 79 | |
80 | - /** |
|
81 | - * Activate the module for the duration of the request. Deactivated module |
|
82 | - * does not create and store \OCP\Diagnostics\IEvent objects. |
|
83 | - * Only activated module should create and store objects to be |
|
84 | - * returned with getEvents() call. |
|
85 | - * |
|
86 | - * @since 12.0.0 |
|
87 | - */ |
|
88 | - public function activate(); |
|
80 | + /** |
|
81 | + * Activate the module for the duration of the request. Deactivated module |
|
82 | + * does not create and store \OCP\Diagnostics\IEvent objects. |
|
83 | + * Only activated module should create and store objects to be |
|
84 | + * returned with getEvents() call. |
|
85 | + * |
|
86 | + * @since 12.0.0 |
|
87 | + */ |
|
88 | + public function activate(); |
|
89 | 89 | } |
@@ -30,38 +30,38 @@ |
||
30 | 30 | * @since 8.0.0 |
31 | 31 | */ |
32 | 32 | interface IQuery { |
33 | - /** |
|
34 | - * @return string |
|
35 | - * @since 8.0.0 |
|
36 | - */ |
|
37 | - public function getSql(); |
|
33 | + /** |
|
34 | + * @return string |
|
35 | + * @since 8.0.0 |
|
36 | + */ |
|
37 | + public function getSql(); |
|
38 | 38 | |
39 | - /** |
|
40 | - * @return array |
|
41 | - * @since 8.0.0 |
|
42 | - */ |
|
43 | - public function getParams(); |
|
39 | + /** |
|
40 | + * @return array |
|
41 | + * @since 8.0.0 |
|
42 | + */ |
|
43 | + public function getParams(); |
|
44 | 44 | |
45 | - /** |
|
46 | - * @return float |
|
47 | - * @since 8.0.0 |
|
48 | - */ |
|
49 | - public function getDuration(); |
|
45 | + /** |
|
46 | + * @return float |
|
47 | + * @since 8.0.0 |
|
48 | + */ |
|
49 | + public function getDuration(); |
|
50 | 50 | |
51 | - /** |
|
52 | - * @return float |
|
53 | - * @since 11.0.0 |
|
54 | - */ |
|
55 | - public function getStartTime(); |
|
51 | + /** |
|
52 | + * @return float |
|
53 | + * @since 11.0.0 |
|
54 | + */ |
|
55 | + public function getStartTime(); |
|
56 | 56 | |
57 | - /** |
|
58 | - * @return array |
|
59 | - * @since 11.0.0 |
|
60 | - */ |
|
61 | - public function getStacktrace(); |
|
62 | - /** |
|
63 | - * @return array |
|
64 | - * @since 12.0.0 |
|
65 | - */ |
|
66 | - public function getStart(); |
|
57 | + /** |
|
58 | + * @return array |
|
59 | + * @since 11.0.0 |
|
60 | + */ |
|
61 | + public function getStacktrace(); |
|
62 | + /** |
|
63 | + * @return array |
|
64 | + * @since 12.0.0 |
|
65 | + */ |
|
66 | + public function getStart(); |
|
67 | 67 | } |
@@ -26,65 +26,65 @@ |
||
26 | 26 | use OCP\Diagnostics\IQuery; |
27 | 27 | |
28 | 28 | class Query implements IQuery { |
29 | - private $sql; |
|
29 | + private $sql; |
|
30 | 30 | |
31 | - private $params; |
|
31 | + private $params; |
|
32 | 32 | |
33 | - private $start; |
|
33 | + private $start; |
|
34 | 34 | |
35 | - private $end; |
|
35 | + private $end; |
|
36 | 36 | |
37 | - private $stack; |
|
37 | + private $stack; |
|
38 | 38 | |
39 | - /** |
|
40 | - * @param string $sql |
|
41 | - * @param array $params |
|
42 | - * @param int $start |
|
43 | - */ |
|
44 | - public function __construct($sql, $params, $start, array $stack) { |
|
45 | - $this->sql = $sql; |
|
46 | - $this->params = $params; |
|
47 | - $this->start = $start; |
|
48 | - $this->stack = $stack; |
|
49 | - } |
|
39 | + /** |
|
40 | + * @param string $sql |
|
41 | + * @param array $params |
|
42 | + * @param int $start |
|
43 | + */ |
|
44 | + public function __construct($sql, $params, $start, array $stack) { |
|
45 | + $this->sql = $sql; |
|
46 | + $this->params = $params; |
|
47 | + $this->start = $start; |
|
48 | + $this->stack = $stack; |
|
49 | + } |
|
50 | 50 | |
51 | - public function end($time) { |
|
52 | - $this->end = $time; |
|
53 | - } |
|
51 | + public function end($time) { |
|
52 | + $this->end = $time; |
|
53 | + } |
|
54 | 54 | |
55 | - /** |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function getParams() { |
|
59 | - return $this->params; |
|
60 | - } |
|
55 | + /** |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function getParams() { |
|
59 | + return $this->params; |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * @return string |
|
64 | - */ |
|
65 | - public function getSql() { |
|
66 | - return $this->sql; |
|
67 | - } |
|
62 | + /** |
|
63 | + * @return string |
|
64 | + */ |
|
65 | + public function getSql() { |
|
66 | + return $this->sql; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return float |
|
71 | - */ |
|
72 | - public function getStart() { |
|
73 | - return $this->start; |
|
74 | - } |
|
69 | + /** |
|
70 | + * @return float |
|
71 | + */ |
|
72 | + public function getStart() { |
|
73 | + return $this->start; |
|
74 | + } |
|
75 | 75 | |
76 | - /** |
|
77 | - * @return float |
|
78 | - */ |
|
79 | - public function getDuration() { |
|
80 | - return $this->end - $this->start; |
|
81 | - } |
|
76 | + /** |
|
77 | + * @return float |
|
78 | + */ |
|
79 | + public function getDuration() { |
|
80 | + return $this->end - $this->start; |
|
81 | + } |
|
82 | 82 | |
83 | - public function getStartTime() { |
|
84 | - return $this->start; |
|
85 | - } |
|
83 | + public function getStartTime() { |
|
84 | + return $this->start; |
|
85 | + } |
|
86 | 86 | |
87 | - public function getStacktrace() { |
|
88 | - return $this->stack; |
|
89 | - } |
|
87 | + public function getStacktrace() { |
|
88 | + return $this->stack; |
|
89 | + } |
|
90 | 90 | } |
@@ -24,7 +24,7 @@ |
||
24 | 24 | use OC\Files\Mount\MountPoint; |
25 | 25 | |
26 | 26 | class ExternalMountPoint extends MountPoint { |
27 | - public function getMountType() { |
|
28 | - return 'external'; |
|
29 | - } |
|
27 | + public function getMountType() { |
|
28 | + return 'external'; |
|
29 | + } |
|
30 | 30 | } |
@@ -27,7 +27,7 @@ |
||
27 | 27 | * {@inheritDoc} |
28 | 28 | */ |
29 | 29 | public function getName() { |
30 | - return (string)$this->l10n->t('Social sharing bundle'); |
|
30 | + return (string) $this->l10n->t('Social sharing bundle'); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -25,23 +25,23 @@ |
||
25 | 25 | |
26 | 26 | class SocialSharingBundle extends Bundle { |
27 | 27 | |
28 | - /** |
|
29 | - * {@inheritDoc} |
|
30 | - */ |
|
31 | - public function getName() { |
|
32 | - return (string)$this->l10n->t('Social sharing bundle'); |
|
33 | - } |
|
28 | + /** |
|
29 | + * {@inheritDoc} |
|
30 | + */ |
|
31 | + public function getName() { |
|
32 | + return (string)$this->l10n->t('Social sharing bundle'); |
|
33 | + } |
|
34 | 34 | |
35 | - /** |
|
36 | - * {@inheritDoc} |
|
37 | - */ |
|
38 | - public function getAppIdentifiers() { |
|
39 | - return [ |
|
40 | - 'socialsharing_twitter', |
|
41 | - 'socialsharing_facebook', |
|
42 | - 'socialsharing_email', |
|
43 | - 'socialsharing_diaspora', |
|
44 | - ]; |
|
45 | - } |
|
35 | + /** |
|
36 | + * {@inheritDoc} |
|
37 | + */ |
|
38 | + public function getAppIdentifiers() { |
|
39 | + return [ |
|
40 | + 'socialsharing_twitter', |
|
41 | + 'socialsharing_facebook', |
|
42 | + 'socialsharing_email', |
|
43 | + 'socialsharing_diaspora', |
|
44 | + ]; |
|
45 | + } |
|
46 | 46 | |
47 | 47 | } |