@@ -26,32 +26,32 @@ |
||
26 | 26 | * @since 12.0.0 |
27 | 27 | */ |
28 | 28 | interface ICloudIdManager { |
29 | - /** |
|
30 | - * @param string $cloudId |
|
31 | - * @return ICloudId |
|
32 | - * |
|
33 | - * @since 12.0.0 |
|
34 | - */ |
|
35 | - public function resolveCloudId($cloudId); |
|
29 | + /** |
|
30 | + * @param string $cloudId |
|
31 | + * @return ICloudId |
|
32 | + * |
|
33 | + * @since 12.0.0 |
|
34 | + */ |
|
35 | + public function resolveCloudId($cloudId); |
|
36 | 36 | |
37 | - /** |
|
38 | - * Get the cloud id for a remote user |
|
39 | - * |
|
40 | - * @param string $user |
|
41 | - * @param string $remote |
|
42 | - * @return ICloudId |
|
43 | - * |
|
44 | - * @since 12.0.0 |
|
45 | - */ |
|
46 | - public function getCloudId($user, $remote); |
|
37 | + /** |
|
38 | + * Get the cloud id for a remote user |
|
39 | + * |
|
40 | + * @param string $user |
|
41 | + * @param string $remote |
|
42 | + * @return ICloudId |
|
43 | + * |
|
44 | + * @since 12.0.0 |
|
45 | + */ |
|
46 | + public function getCloudId($user, $remote); |
|
47 | 47 | |
48 | - /** |
|
49 | - * Check if the input is a correctly formatted cloud id |
|
50 | - * |
|
51 | - * @param string $cloudId |
|
52 | - * @return bool |
|
53 | - * |
|
54 | - * @since 12.0.0 |
|
55 | - */ |
|
56 | - public function isValidCloudId($cloudId); |
|
48 | + /** |
|
49 | + * Check if the input is a correctly formatted cloud id |
|
50 | + * |
|
51 | + * @param string $cloudId |
|
52 | + * @return bool |
|
53 | + * |
|
54 | + * @since 12.0.0 |
|
55 | + */ |
|
56 | + public function isValidCloudId($cloudId); |
|
57 | 57 | } |
@@ -25,56 +25,56 @@ |
||
25 | 25 | * @since 8.2.0 |
26 | 26 | */ |
27 | 27 | interface IFactory { |
28 | - /** |
|
29 | - * Get a language instance |
|
30 | - * |
|
31 | - * @param string $app |
|
32 | - * @param string|null $lang |
|
33 | - * @return \OCP\IL10N |
|
34 | - * @since 8.2.0 |
|
35 | - */ |
|
36 | - public function get($app, $lang = null); |
|
28 | + /** |
|
29 | + * Get a language instance |
|
30 | + * |
|
31 | + * @param string $app |
|
32 | + * @param string|null $lang |
|
33 | + * @return \OCP\IL10N |
|
34 | + * @since 8.2.0 |
|
35 | + */ |
|
36 | + public function get($app, $lang = null); |
|
37 | 37 | |
38 | - /** |
|
39 | - * Find the best language |
|
40 | - * |
|
41 | - * @param string|null $app App id or null for core |
|
42 | - * @return string language If nothing works it returns 'en' |
|
43 | - * @since 9.0.0 |
|
44 | - */ |
|
45 | - public function findLanguage($app = null); |
|
38 | + /** |
|
39 | + * Find the best language |
|
40 | + * |
|
41 | + * @param string|null $app App id or null for core |
|
42 | + * @return string language If nothing works it returns 'en' |
|
43 | + * @since 9.0.0 |
|
44 | + */ |
|
45 | + public function findLanguage($app = null); |
|
46 | 46 | |
47 | - /** |
|
48 | - * Find all available languages for an app |
|
49 | - * |
|
50 | - * @param string|null $app App id or null for core |
|
51 | - * @return string[] an array of available languages |
|
52 | - * @since 9.0.0 |
|
53 | - */ |
|
54 | - public function findAvailableLanguages($app = null); |
|
47 | + /** |
|
48 | + * Find all available languages for an app |
|
49 | + * |
|
50 | + * @param string|null $app App id or null for core |
|
51 | + * @return string[] an array of available languages |
|
52 | + * @since 9.0.0 |
|
53 | + */ |
|
54 | + public function findAvailableLanguages($app = null); |
|
55 | 55 | |
56 | - /** |
|
57 | - * @param string|null $app App id or null for core |
|
58 | - * @param string $lang |
|
59 | - * @return bool |
|
60 | - * @since 9.0.0 |
|
61 | - */ |
|
62 | - public function languageExists($app, $lang); |
|
56 | + /** |
|
57 | + * @param string|null $app App id or null for core |
|
58 | + * @param string $lang |
|
59 | + * @return bool |
|
60 | + * @since 9.0.0 |
|
61 | + */ |
|
62 | + public function languageExists($app, $lang); |
|
63 | 63 | |
64 | - /** |
|
65 | - * @param string|null $app App id or null for core |
|
66 | - * @return string |
|
67 | - * @since 9.0.0 |
|
68 | - */ |
|
69 | - public function setLanguageFromRequest($app = null); |
|
64 | + /** |
|
65 | + * @param string|null $app App id or null for core |
|
66 | + * @return string |
|
67 | + * @since 9.0.0 |
|
68 | + */ |
|
69 | + public function setLanguageFromRequest($app = null); |
|
70 | 70 | |
71 | 71 | |
72 | - /** |
|
73 | - * Creates a function from the plural string |
|
74 | - * |
|
75 | - * @param string $string |
|
76 | - * @return string Unique function name |
|
77 | - * @since 9.0.0 |
|
78 | - */ |
|
79 | - public function createPluralFunction($string); |
|
72 | + /** |
|
73 | + * Creates a function from the plural string |
|
74 | + * |
|
75 | + * @param string $string |
|
76 | + * @return string Unique function name |
|
77 | + * @since 9.0.0 |
|
78 | + */ |
|
79 | + public function createPluralFunction($string); |
|
80 | 80 | } |
@@ -57,654 +57,654 @@ |
||
57 | 57 | * @since 4.0.0 |
58 | 58 | */ |
59 | 59 | class Util { |
60 | - // consts for Logging |
|
61 | - const DEBUG=0; |
|
62 | - const INFO=1; |
|
63 | - const WARN=2; |
|
64 | - const ERROR=3; |
|
65 | - const FATAL=4; |
|
66 | - |
|
67 | - /** \OCP\Share\IManager */ |
|
68 | - private static $shareManager; |
|
69 | - |
|
70 | - /** |
|
71 | - * get the current installed version of ownCloud |
|
72 | - * @return array |
|
73 | - * @since 4.0.0 |
|
74 | - */ |
|
75 | - public static function getVersion() { |
|
76 | - return(\OC_Util::getVersion()); |
|
77 | - } |
|
60 | + // consts for Logging |
|
61 | + const DEBUG=0; |
|
62 | + const INFO=1; |
|
63 | + const WARN=2; |
|
64 | + const ERROR=3; |
|
65 | + const FATAL=4; |
|
66 | + |
|
67 | + /** \OCP\Share\IManager */ |
|
68 | + private static $shareManager; |
|
69 | + |
|
70 | + /** |
|
71 | + * get the current installed version of ownCloud |
|
72 | + * @return array |
|
73 | + * @since 4.0.0 |
|
74 | + */ |
|
75 | + public static function getVersion() { |
|
76 | + return(\OC_Util::getVersion()); |
|
77 | + } |
|
78 | 78 | |
79 | - /** |
|
80 | - * Set current update channel |
|
81 | - * @param string $channel |
|
82 | - * @since 8.1.0 |
|
83 | - */ |
|
84 | - public static function setChannel($channel) { |
|
85 | - \OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel); |
|
86 | - } |
|
79 | + /** |
|
80 | + * Set current update channel |
|
81 | + * @param string $channel |
|
82 | + * @since 8.1.0 |
|
83 | + */ |
|
84 | + public static function setChannel($channel) { |
|
85 | + \OC::$server->getConfig()->setSystemValue('updater.release.channel', $channel); |
|
86 | + } |
|
87 | 87 | |
88 | - /** |
|
89 | - * Get current update channel |
|
90 | - * @return string |
|
91 | - * @since 8.1.0 |
|
92 | - */ |
|
93 | - public static function getChannel() { |
|
94 | - return \OC_Util::getChannel(); |
|
95 | - } |
|
96 | - |
|
97 | - /** |
|
98 | - * send an email |
|
99 | - * @param string $toaddress |
|
100 | - * @param string $toname |
|
101 | - * @param string $subject |
|
102 | - * @param string $mailtext |
|
103 | - * @param string $fromaddress |
|
104 | - * @param string $fromname |
|
105 | - * @param int $html |
|
106 | - * @param string $altbody |
|
107 | - * @param string $ccaddress |
|
108 | - * @param string $ccname |
|
109 | - * @param string $bcc |
|
110 | - * @deprecated 8.1.0 Use \OCP\Mail\IMailer instead |
|
111 | - * @since 4.0.0 |
|
112 | - */ |
|
113 | - public static function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, |
|
114 | - $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') { |
|
115 | - $mailer = \OC::$server->getMailer(); |
|
116 | - $message = $mailer->createMessage(); |
|
117 | - $message->setTo([$toaddress => $toname]); |
|
118 | - $message->setSubject($subject); |
|
119 | - $message->setPlainBody($mailtext); |
|
120 | - $message->setFrom([$fromaddress => $fromname]); |
|
121 | - if($html === 1) { |
|
122 | - $message->setHTMLBody($altbody); |
|
123 | - } |
|
124 | - |
|
125 | - if($altbody === '') { |
|
126 | - $message->setHTMLBody($mailtext); |
|
127 | - $message->setPlainBody(''); |
|
128 | - } else { |
|
129 | - $message->setHtmlBody($mailtext); |
|
130 | - $message->setPlainBody($altbody); |
|
131 | - } |
|
132 | - |
|
133 | - if(!empty($ccaddress)) { |
|
134 | - if(!empty($ccname)) { |
|
135 | - $message->setCc([$ccaddress => $ccname]); |
|
136 | - } else { |
|
137 | - $message->setCc([$ccaddress]); |
|
138 | - } |
|
139 | - } |
|
140 | - if(!empty($bcc)) { |
|
141 | - $message->setBcc([$bcc]); |
|
142 | - } |
|
143 | - |
|
144 | - $mailer->send($message); |
|
145 | - } |
|
146 | - |
|
147 | - /** |
|
148 | - * write a message in the log |
|
149 | - * @param string $app |
|
150 | - * @param string $message |
|
151 | - * @param int $level |
|
152 | - * @since 4.0.0 |
|
153 | - */ |
|
154 | - public static function writeLog( $app, $message, $level ) { |
|
155 | - $context = ['app' => $app]; |
|
156 | - \OC::$server->getLogger()->log($level, $message, $context); |
|
157 | - } |
|
158 | - |
|
159 | - /** |
|
160 | - * write exception into the log |
|
161 | - * @param string $app app name |
|
162 | - * @param \Exception $ex exception to log |
|
163 | - * @param int $level log level, defaults to \OCP\Util::FATAL |
|
164 | - * @since ....0.0 - parameter $level was added in 7.0.0 |
|
165 | - * @deprecated 8.2.0 use logException of \OCP\ILogger |
|
166 | - */ |
|
167 | - public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) { |
|
168 | - \OC::$server->getLogger()->logException($ex, ['app' => $app]); |
|
169 | - } |
|
170 | - |
|
171 | - /** |
|
172 | - * check if sharing is disabled for the current user |
|
173 | - * |
|
174 | - * @return boolean |
|
175 | - * @since 7.0.0 |
|
176 | - * @deprecated 9.1.0 Use \OC::$server->getShareManager()->sharingDisabledForUser |
|
177 | - */ |
|
178 | - public static function isSharingDisabledForUser() { |
|
179 | - if (self::$shareManager === null) { |
|
180 | - self::$shareManager = \OC::$server->getShareManager(); |
|
181 | - } |
|
182 | - |
|
183 | - $user = \OC::$server->getUserSession()->getUser(); |
|
184 | - if ($user !== null) { |
|
185 | - $user = $user->getUID(); |
|
186 | - } |
|
187 | - |
|
188 | - return self::$shareManager->sharingDisabledForUser($user); |
|
189 | - } |
|
190 | - |
|
191 | - /** |
|
192 | - * get l10n object |
|
193 | - * @param string $application |
|
194 | - * @param string|null $language |
|
195 | - * @return \OCP\IL10N |
|
196 | - * @since 6.0.0 - parameter $language was added in 8.0.0 |
|
197 | - */ |
|
198 | - public static function getL10N($application, $language = null) { |
|
199 | - return \OC::$server->getL10N($application, $language); |
|
200 | - } |
|
201 | - |
|
202 | - /** |
|
203 | - * add a css file |
|
204 | - * @param string $application |
|
205 | - * @param string $file |
|
206 | - * @since 4.0.0 |
|
207 | - */ |
|
208 | - public static function addStyle( $application, $file = null ) { |
|
209 | - \OC_Util::addStyle( $application, $file ); |
|
210 | - } |
|
211 | - |
|
212 | - /** |
|
213 | - * add a javascript file |
|
214 | - * @param string $application |
|
215 | - * @param string $file |
|
216 | - * @since 4.0.0 |
|
217 | - */ |
|
218 | - public static function addScript( $application, $file = null ) { |
|
219 | - \OC_Util::addScript( $application, $file ); |
|
220 | - } |
|
221 | - |
|
222 | - /** |
|
223 | - * Add a translation JS file |
|
224 | - * @param string $application application id |
|
225 | - * @param string $languageCode language code, defaults to the current locale |
|
226 | - * @since 8.0.0 |
|
227 | - */ |
|
228 | - public static function addTranslations($application, $languageCode = null) { |
|
229 | - \OC_Util::addTranslations($application, $languageCode); |
|
230 | - } |
|
231 | - |
|
232 | - /** |
|
233 | - * Add a custom element to the header |
|
234 | - * If $text is null then the element will be written as empty element. |
|
235 | - * So use "" to get a closing tag. |
|
236 | - * @param string $tag tag name of the element |
|
237 | - * @param array $attributes array of attributes for the element |
|
238 | - * @param string $text the text content for the element |
|
239 | - * @since 4.0.0 |
|
240 | - */ |
|
241 | - public static function addHeader($tag, $attributes, $text=null) { |
|
242 | - \OC_Util::addHeader($tag, $attributes, $text); |
|
243 | - } |
|
244 | - |
|
245 | - /** |
|
246 | - * formats a timestamp in the "right" way |
|
247 | - * @param int $timestamp $timestamp |
|
248 | - * @param bool $dateOnly option to omit time from the result |
|
249 | - * @param DateTimeZone|string $timeZone where the given timestamp shall be converted to |
|
250 | - * @return string timestamp |
|
251 | - * |
|
252 | - * @deprecated 8.0.0 Use \OC::$server->query('DateTimeFormatter') instead |
|
253 | - * @since 4.0.0 |
|
254 | - */ |
|
255 | - public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) { |
|
256 | - return(\OC_Util::formatDate($timestamp, $dateOnly, $timeZone)); |
|
257 | - } |
|
258 | - |
|
259 | - /** |
|
260 | - * check if some encrypted files are stored |
|
261 | - * @return bool |
|
262 | - * |
|
263 | - * @deprecated 8.1.0 No longer required |
|
264 | - * @since 6.0.0 |
|
265 | - */ |
|
266 | - public static function encryptedFiles() { |
|
267 | - return false; |
|
268 | - } |
|
269 | - |
|
270 | - /** |
|
271 | - * Creates an absolute url to the given app and file. |
|
272 | - * @param string $app app |
|
273 | - * @param string $file file |
|
274 | - * @param array $args array with param=>value, will be appended to the returned url |
|
275 | - * The value of $args will be urlencoded |
|
276 | - * @return string the url |
|
277 | - * @since 4.0.0 - parameter $args was added in 4.5.0 |
|
278 | - */ |
|
279 | - public static function linkToAbsolute( $app, $file, $args = array() ) { |
|
280 | - $urlGenerator = \OC::$server->getURLGenerator(); |
|
281 | - return $urlGenerator->getAbsoluteURL( |
|
282 | - $urlGenerator->linkTo($app, $file, $args) |
|
283 | - ); |
|
284 | - } |
|
285 | - |
|
286 | - /** |
|
287 | - * Creates an absolute url for remote use. |
|
288 | - * @param string $service id |
|
289 | - * @return string the url |
|
290 | - * @since 4.0.0 |
|
291 | - */ |
|
292 | - public static function linkToRemote( $service ) { |
|
293 | - $urlGenerator = \OC::$server->getURLGenerator(); |
|
294 | - $remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service; |
|
295 | - return $urlGenerator->getAbsoluteURL( |
|
296 | - $remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '') |
|
297 | - ); |
|
298 | - } |
|
299 | - |
|
300 | - /** |
|
301 | - * Creates an absolute url for public use |
|
302 | - * @param string $service id |
|
303 | - * @return string the url |
|
304 | - * @since 4.5.0 |
|
305 | - */ |
|
306 | - public static function linkToPublic($service) { |
|
307 | - return \OC_Helper::linkToPublic($service); |
|
308 | - } |
|
309 | - |
|
310 | - /** |
|
311 | - * Creates an url using a defined route |
|
312 | - * @param string $route |
|
313 | - * @param array $parameters |
|
314 | - * @internal param array $args with param=>value, will be appended to the returned url |
|
315 | - * @return string the url |
|
316 | - * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkToRoute($route, $parameters) |
|
317 | - * @since 5.0.0 |
|
318 | - */ |
|
319 | - public static function linkToRoute( $route, $parameters = array() ) { |
|
320 | - return \OC::$server->getURLGenerator()->linkToRoute($route, $parameters); |
|
321 | - } |
|
322 | - |
|
323 | - /** |
|
324 | - * Creates an url to the given app and file |
|
325 | - * @param string $app app |
|
326 | - * @param string $file file |
|
327 | - * @param array $args array with param=>value, will be appended to the returned url |
|
328 | - * The value of $args will be urlencoded |
|
329 | - * @return string the url |
|
330 | - * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkTo($app, $file, $args) |
|
331 | - * @since 4.0.0 - parameter $args was added in 4.5.0 |
|
332 | - */ |
|
333 | - public static function linkTo( $app, $file, $args = array() ) { |
|
334 | - return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
|
335 | - } |
|
336 | - |
|
337 | - /** |
|
338 | - * Returns the server host, even if the website uses one or more reverse proxy |
|
339 | - * @return string the server host |
|
340 | - * @deprecated 8.1.0 Use \OCP\IRequest::getServerHost |
|
341 | - * @since 4.0.0 |
|
342 | - */ |
|
343 | - public static function getServerHost() { |
|
344 | - return \OC::$server->getRequest()->getServerHost(); |
|
345 | - } |
|
346 | - |
|
347 | - /** |
|
348 | - * Returns the server host name without an eventual port number |
|
349 | - * @return string the server hostname |
|
350 | - * @since 5.0.0 |
|
351 | - */ |
|
352 | - public static function getServerHostName() { |
|
353 | - $host_name = self::getServerHost(); |
|
354 | - // strip away port number (if existing) |
|
355 | - $colon_pos = strpos($host_name, ':'); |
|
356 | - if ($colon_pos != FALSE) { |
|
357 | - $host_name = substr($host_name, 0, $colon_pos); |
|
358 | - } |
|
359 | - return $host_name; |
|
360 | - } |
|
361 | - |
|
362 | - /** |
|
363 | - * Returns the default email address |
|
364 | - * @param string $user_part the user part of the address |
|
365 | - * @return string the default email address |
|
366 | - * |
|
367 | - * Assembles a default email address (using the server hostname |
|
368 | - * and the given user part, and returns it |
|
369 | - * Example: when given lostpassword-noreply as $user_part param, |
|
370 | - * and is currently accessed via http(s)://example.com/, |
|
371 | - * it would return '[email protected]' |
|
372 | - * |
|
373 | - * If the configuration value 'mail_from_address' is set in |
|
374 | - * config.php, this value will override the $user_part that |
|
375 | - * is passed to this function |
|
376 | - * @since 5.0.0 |
|
377 | - */ |
|
378 | - public static function getDefaultEmailAddress($user_part) { |
|
379 | - $config = \OC::$server->getConfig(); |
|
380 | - $user_part = $config->getSystemValue('mail_from_address', $user_part); |
|
381 | - $host_name = self::getServerHostName(); |
|
382 | - $host_name = $config->getSystemValue('mail_domain', $host_name); |
|
383 | - $defaultEmailAddress = $user_part.'@'.$host_name; |
|
384 | - |
|
385 | - $mailer = \OC::$server->getMailer(); |
|
386 | - if ($mailer->validateMailAddress($defaultEmailAddress)) { |
|
387 | - return $defaultEmailAddress; |
|
388 | - } |
|
389 | - |
|
390 | - // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain' |
|
391 | - return $user_part.'@localhost.localdomain'; |
|
392 | - } |
|
393 | - |
|
394 | - /** |
|
395 | - * Returns the server protocol. It respects reverse proxy servers and load balancers |
|
396 | - * @return string the server protocol |
|
397 | - * @deprecated 8.1.0 Use \OCP\IRequest::getServerProtocol |
|
398 | - * @since 4.5.0 |
|
399 | - */ |
|
400 | - public static function getServerProtocol() { |
|
401 | - return \OC::$server->getRequest()->getServerProtocol(); |
|
402 | - } |
|
403 | - |
|
404 | - /** |
|
405 | - * Returns the request uri, even if the website uses one or more reverse proxies |
|
406 | - * @return string the request uri |
|
407 | - * @deprecated 8.1.0 Use \OCP\IRequest::getRequestUri |
|
408 | - * @since 5.0.0 |
|
409 | - */ |
|
410 | - public static function getRequestUri() { |
|
411 | - return \OC::$server->getRequest()->getRequestUri(); |
|
412 | - } |
|
413 | - |
|
414 | - /** |
|
415 | - * Returns the script name, even if the website uses one or more reverse proxies |
|
416 | - * @return string the script name |
|
417 | - * @deprecated 8.1.0 Use \OCP\IRequest::getScriptName |
|
418 | - * @since 5.0.0 |
|
419 | - */ |
|
420 | - public static function getScriptName() { |
|
421 | - return \OC::$server->getRequest()->getScriptName(); |
|
422 | - } |
|
423 | - |
|
424 | - /** |
|
425 | - * Creates path to an image |
|
426 | - * @param string $app app |
|
427 | - * @param string $image image name |
|
428 | - * @return string the url |
|
429 | - * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->imagePath($app, $image) |
|
430 | - * @since 4.0.0 |
|
431 | - */ |
|
432 | - public static function imagePath( $app, $image ) { |
|
433 | - return \OC::$server->getURLGenerator()->imagePath($app, $image); |
|
434 | - } |
|
435 | - |
|
436 | - /** |
|
437 | - * Make a human file size (2048 to 2 kB) |
|
438 | - * @param int $bytes file size in bytes |
|
439 | - * @return string a human readable file size |
|
440 | - * @since 4.0.0 |
|
441 | - */ |
|
442 | - public static function humanFileSize( $bytes ) { |
|
443 | - return(\OC_Helper::humanFileSize( $bytes )); |
|
444 | - } |
|
445 | - |
|
446 | - /** |
|
447 | - * Make a computer file size (2 kB to 2048) |
|
448 | - * @param string $str file size in a fancy format |
|
449 | - * @return int a file size in bytes |
|
450 | - * |
|
451 | - * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418 |
|
452 | - * @since 4.0.0 |
|
453 | - */ |
|
454 | - public static function computerFileSize( $str ) { |
|
455 | - return(\OC_Helper::computerFileSize( $str )); |
|
456 | - } |
|
457 | - |
|
458 | - /** |
|
459 | - * connects a function to a hook |
|
460 | - * |
|
461 | - * @param string $signalClass class name of emitter |
|
462 | - * @param string $signalName name of signal |
|
463 | - * @param string|object $slotClass class name of slot |
|
464 | - * @param string $slotName name of slot |
|
465 | - * @return bool |
|
466 | - * |
|
467 | - * This function makes it very easy to connect to use hooks. |
|
468 | - * |
|
469 | - * TODO: write example |
|
470 | - * @since 4.0.0 |
|
471 | - */ |
|
472 | - static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) { |
|
473 | - return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName )); |
|
474 | - } |
|
475 | - |
|
476 | - /** |
|
477 | - * Emits a signal. To get data from the slot use references! |
|
478 | - * @param string $signalclass class name of emitter |
|
479 | - * @param string $signalname name of signal |
|
480 | - * @param array $params default: array() array with additional data |
|
481 | - * @return bool true if slots exists or false if not |
|
482 | - * |
|
483 | - * TODO: write example |
|
484 | - * @since 4.0.0 |
|
485 | - */ |
|
486 | - static public function emitHook( $signalclass, $signalname, $params = array()) { |
|
487 | - return(\OC_Hook::emit( $signalclass, $signalname, $params )); |
|
488 | - } |
|
489 | - |
|
490 | - /** |
|
491 | - * Cached encrypted CSRF token. Some static unit-tests of ownCloud compare |
|
492 | - * multiple OC_Template elements which invoke `callRegister`. If the value |
|
493 | - * would not be cached these unit-tests would fail. |
|
494 | - * @var string |
|
495 | - */ |
|
496 | - private static $token = ''; |
|
497 | - |
|
498 | - /** |
|
499 | - * Register an get/post call. This is important to prevent CSRF attacks |
|
500 | - * @since 4.5.0 |
|
501 | - */ |
|
502 | - public static function callRegister() { |
|
503 | - if(self::$token === '') { |
|
504 | - self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue(); |
|
505 | - } |
|
506 | - return self::$token; |
|
507 | - } |
|
508 | - |
|
509 | - /** |
|
510 | - * Check an ajax get/post call if the request token is valid. exit if not. |
|
511 | - * @since 4.5.0 |
|
512 | - * @deprecated 9.0.0 Use annotations based on the app framework. |
|
513 | - */ |
|
514 | - public static function callCheck() { |
|
515 | - if(!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
516 | - header('Location: '.\OC::$WEBROOT); |
|
517 | - exit(); |
|
518 | - } |
|
519 | - |
|
520 | - if (!(\OC::$server->getRequest()->passesCSRFCheck())) { |
|
521 | - exit(); |
|
522 | - } |
|
523 | - } |
|
524 | - |
|
525 | - /** |
|
526 | - * Used to sanitize HTML |
|
527 | - * |
|
528 | - * This function is used to sanitize HTML and should be applied on any |
|
529 | - * string or array of strings before displaying it on a web page. |
|
530 | - * |
|
531 | - * @param string|array $value |
|
532 | - * @return string|array an array of sanitized strings or a single sanitized string, depends on the input parameter. |
|
533 | - * @since 4.5.0 |
|
534 | - */ |
|
535 | - public static function sanitizeHTML($value) { |
|
536 | - return \OC_Util::sanitizeHTML($value); |
|
537 | - } |
|
538 | - |
|
539 | - /** |
|
540 | - * Public function to encode url parameters |
|
541 | - * |
|
542 | - * This function is used to encode path to file before output. |
|
543 | - * Encoding is done according to RFC 3986 with one exception: |
|
544 | - * Character '/' is preserved as is. |
|
545 | - * |
|
546 | - * @param string $component part of URI to encode |
|
547 | - * @return string |
|
548 | - * @since 6.0.0 |
|
549 | - */ |
|
550 | - public static function encodePath($component) { |
|
551 | - return(\OC_Util::encodePath($component)); |
|
552 | - } |
|
553 | - |
|
554 | - /** |
|
555 | - * Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is. |
|
556 | - * |
|
557 | - * @param array $input The array to work on |
|
558 | - * @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default) |
|
559 | - * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 |
|
560 | - * @return array |
|
561 | - * @since 4.5.0 |
|
562 | - */ |
|
563 | - public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') { |
|
564 | - return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding)); |
|
565 | - } |
|
566 | - |
|
567 | - /** |
|
568 | - * replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement. |
|
569 | - * |
|
570 | - * @param string $string The input string. Opposite to the PHP build-in function does not accept an array. |
|
571 | - * @param string $replacement The replacement string. |
|
572 | - * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string. |
|
573 | - * @param int $length Length of the part to be replaced |
|
574 | - * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 |
|
575 | - * @return string |
|
576 | - * @since 4.5.0 |
|
577 | - * @deprecated 8.2.0 Use substr_replace() instead. |
|
578 | - */ |
|
579 | - public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') { |
|
580 | - return substr_replace($string, $replacement, $start, $length); |
|
581 | - } |
|
582 | - |
|
583 | - /** |
|
584 | - * Replace all occurrences of the search string with the replacement string |
|
585 | - * |
|
586 | - * @param string $search The value being searched for, otherwise known as the needle. String. |
|
587 | - * @param string $replace The replacement string. |
|
588 | - * @param string $subject The string or array being searched and replaced on, otherwise known as the haystack. |
|
589 | - * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 |
|
590 | - * @param int $count If passed, this will be set to the number of replacements performed. |
|
591 | - * @return string |
|
592 | - * @since 4.5.0 |
|
593 | - * @deprecated 8.2.0 Use str_replace() instead. |
|
594 | - */ |
|
595 | - public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) { |
|
596 | - return str_replace($search, $replace, $subject, $count); |
|
597 | - } |
|
598 | - |
|
599 | - /** |
|
600 | - * performs a search in a nested array |
|
601 | - * |
|
602 | - * @param array $haystack the array to be searched |
|
603 | - * @param string $needle the search string |
|
604 | - * @param int $index optional, only search this key name |
|
605 | - * @return mixed the key of the matching field, otherwise false |
|
606 | - * @since 4.5.0 |
|
607 | - */ |
|
608 | - public static function recursiveArraySearch($haystack, $needle, $index = null) { |
|
609 | - return(\OC_Helper::recursiveArraySearch($haystack, $needle, $index)); |
|
610 | - } |
|
611 | - |
|
612 | - /** |
|
613 | - * calculates the maximum upload size respecting system settings, free space and user quota |
|
614 | - * |
|
615 | - * @param string $dir the current folder where the user currently operates |
|
616 | - * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly |
|
617 | - * @return int number of bytes representing |
|
618 | - * @since 5.0.0 |
|
619 | - */ |
|
620 | - public static function maxUploadFilesize($dir, $free = null) { |
|
621 | - return \OC_Helper::maxUploadFilesize($dir, $free); |
|
622 | - } |
|
623 | - |
|
624 | - /** |
|
625 | - * Calculate free space left within user quota |
|
626 | - * @param string $dir the current folder where the user currently operates |
|
627 | - * @return int number of bytes representing |
|
628 | - * @since 7.0.0 |
|
629 | - */ |
|
630 | - public static function freeSpace($dir) { |
|
631 | - return \OC_Helper::freeSpace($dir); |
|
632 | - } |
|
633 | - |
|
634 | - /** |
|
635 | - * Calculate PHP upload limit |
|
636 | - * |
|
637 | - * @return int number of bytes representing |
|
638 | - * @since 7.0.0 |
|
639 | - */ |
|
640 | - public static function uploadLimit() { |
|
641 | - return \OC_Helper::uploadLimit(); |
|
642 | - } |
|
643 | - |
|
644 | - /** |
|
645 | - * Returns whether the given file name is valid |
|
646 | - * @param string $file file name to check |
|
647 | - * @return bool true if the file name is valid, false otherwise |
|
648 | - * @deprecated 8.1.0 use \OC\Files\View::verifyPath() |
|
649 | - * @since 7.0.0 |
|
650 | - */ |
|
651 | - public static function isValidFileName($file) { |
|
652 | - return \OC_Util::isValidFileName($file); |
|
653 | - } |
|
654 | - |
|
655 | - /** |
|
656 | - * Generates a cryptographic secure pseudo-random string |
|
657 | - * @param int $length of the random string |
|
658 | - * @return string |
|
659 | - * @deprecated 8.0.0 Use \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length); instead |
|
660 | - * @since 7.0.0 |
|
661 | - */ |
|
662 | - public static function generateRandomBytes($length = 30) { |
|
663 | - return \OC::$server->getSecureRandom()->generate($length, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
664 | - } |
|
665 | - |
|
666 | - /** |
|
667 | - * Compare two strings to provide a natural sort |
|
668 | - * @param string $a first string to compare |
|
669 | - * @param string $b second string to compare |
|
670 | - * @return -1 if $b comes before $a, 1 if $a comes before $b |
|
671 | - * or 0 if the strings are identical |
|
672 | - * @since 7.0.0 |
|
673 | - */ |
|
674 | - public static function naturalSortCompare($a, $b) { |
|
675 | - return \OC\NaturalSort::getInstance()->compare($a, $b); |
|
676 | - } |
|
677 | - |
|
678 | - /** |
|
679 | - * check if a password is required for each public link |
|
680 | - * @return boolean |
|
681 | - * @since 7.0.0 |
|
682 | - */ |
|
683 | - public static function isPublicLinkPasswordRequired() { |
|
684 | - return \OC_Util::isPublicLinkPasswordRequired(); |
|
685 | - } |
|
686 | - |
|
687 | - /** |
|
688 | - * check if share API enforces a default expire date |
|
689 | - * @return boolean |
|
690 | - * @since 8.0.0 |
|
691 | - */ |
|
692 | - public static function isDefaultExpireDateEnforced() { |
|
693 | - return \OC_Util::isDefaultExpireDateEnforced(); |
|
694 | - } |
|
695 | - |
|
696 | - protected static $needUpgradeCache = null; |
|
697 | - |
|
698 | - /** |
|
699 | - * Checks whether the current version needs upgrade. |
|
700 | - * |
|
701 | - * @return bool true if upgrade is needed, false otherwise |
|
702 | - * @since 7.0.0 |
|
703 | - */ |
|
704 | - public static function needUpgrade() { |
|
705 | - if (!isset(self::$needUpgradeCache)) { |
|
706 | - self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getConfig()); |
|
707 | - } |
|
708 | - return self::$needUpgradeCache; |
|
709 | - } |
|
88 | + /** |
|
89 | + * Get current update channel |
|
90 | + * @return string |
|
91 | + * @since 8.1.0 |
|
92 | + */ |
|
93 | + public static function getChannel() { |
|
94 | + return \OC_Util::getChannel(); |
|
95 | + } |
|
96 | + |
|
97 | + /** |
|
98 | + * send an email |
|
99 | + * @param string $toaddress |
|
100 | + * @param string $toname |
|
101 | + * @param string $subject |
|
102 | + * @param string $mailtext |
|
103 | + * @param string $fromaddress |
|
104 | + * @param string $fromname |
|
105 | + * @param int $html |
|
106 | + * @param string $altbody |
|
107 | + * @param string $ccaddress |
|
108 | + * @param string $ccname |
|
109 | + * @param string $bcc |
|
110 | + * @deprecated 8.1.0 Use \OCP\Mail\IMailer instead |
|
111 | + * @since 4.0.0 |
|
112 | + */ |
|
113 | + public static function sendMail($toaddress, $toname, $subject, $mailtext, $fromaddress, $fromname, |
|
114 | + $html = 0, $altbody = '', $ccaddress = '', $ccname = '', $bcc = '') { |
|
115 | + $mailer = \OC::$server->getMailer(); |
|
116 | + $message = $mailer->createMessage(); |
|
117 | + $message->setTo([$toaddress => $toname]); |
|
118 | + $message->setSubject($subject); |
|
119 | + $message->setPlainBody($mailtext); |
|
120 | + $message->setFrom([$fromaddress => $fromname]); |
|
121 | + if($html === 1) { |
|
122 | + $message->setHTMLBody($altbody); |
|
123 | + } |
|
124 | + |
|
125 | + if($altbody === '') { |
|
126 | + $message->setHTMLBody($mailtext); |
|
127 | + $message->setPlainBody(''); |
|
128 | + } else { |
|
129 | + $message->setHtmlBody($mailtext); |
|
130 | + $message->setPlainBody($altbody); |
|
131 | + } |
|
132 | + |
|
133 | + if(!empty($ccaddress)) { |
|
134 | + if(!empty($ccname)) { |
|
135 | + $message->setCc([$ccaddress => $ccname]); |
|
136 | + } else { |
|
137 | + $message->setCc([$ccaddress]); |
|
138 | + } |
|
139 | + } |
|
140 | + if(!empty($bcc)) { |
|
141 | + $message->setBcc([$bcc]); |
|
142 | + } |
|
143 | + |
|
144 | + $mailer->send($message); |
|
145 | + } |
|
146 | + |
|
147 | + /** |
|
148 | + * write a message in the log |
|
149 | + * @param string $app |
|
150 | + * @param string $message |
|
151 | + * @param int $level |
|
152 | + * @since 4.0.0 |
|
153 | + */ |
|
154 | + public static function writeLog( $app, $message, $level ) { |
|
155 | + $context = ['app' => $app]; |
|
156 | + \OC::$server->getLogger()->log($level, $message, $context); |
|
157 | + } |
|
158 | + |
|
159 | + /** |
|
160 | + * write exception into the log |
|
161 | + * @param string $app app name |
|
162 | + * @param \Exception $ex exception to log |
|
163 | + * @param int $level log level, defaults to \OCP\Util::FATAL |
|
164 | + * @since ....0.0 - parameter $level was added in 7.0.0 |
|
165 | + * @deprecated 8.2.0 use logException of \OCP\ILogger |
|
166 | + */ |
|
167 | + public static function logException( $app, \Exception $ex, $level = \OCP\Util::FATAL ) { |
|
168 | + \OC::$server->getLogger()->logException($ex, ['app' => $app]); |
|
169 | + } |
|
170 | + |
|
171 | + /** |
|
172 | + * check if sharing is disabled for the current user |
|
173 | + * |
|
174 | + * @return boolean |
|
175 | + * @since 7.0.0 |
|
176 | + * @deprecated 9.1.0 Use \OC::$server->getShareManager()->sharingDisabledForUser |
|
177 | + */ |
|
178 | + public static function isSharingDisabledForUser() { |
|
179 | + if (self::$shareManager === null) { |
|
180 | + self::$shareManager = \OC::$server->getShareManager(); |
|
181 | + } |
|
182 | + |
|
183 | + $user = \OC::$server->getUserSession()->getUser(); |
|
184 | + if ($user !== null) { |
|
185 | + $user = $user->getUID(); |
|
186 | + } |
|
187 | + |
|
188 | + return self::$shareManager->sharingDisabledForUser($user); |
|
189 | + } |
|
190 | + |
|
191 | + /** |
|
192 | + * get l10n object |
|
193 | + * @param string $application |
|
194 | + * @param string|null $language |
|
195 | + * @return \OCP\IL10N |
|
196 | + * @since 6.0.0 - parameter $language was added in 8.0.0 |
|
197 | + */ |
|
198 | + public static function getL10N($application, $language = null) { |
|
199 | + return \OC::$server->getL10N($application, $language); |
|
200 | + } |
|
201 | + |
|
202 | + /** |
|
203 | + * add a css file |
|
204 | + * @param string $application |
|
205 | + * @param string $file |
|
206 | + * @since 4.0.0 |
|
207 | + */ |
|
208 | + public static function addStyle( $application, $file = null ) { |
|
209 | + \OC_Util::addStyle( $application, $file ); |
|
210 | + } |
|
211 | + |
|
212 | + /** |
|
213 | + * add a javascript file |
|
214 | + * @param string $application |
|
215 | + * @param string $file |
|
216 | + * @since 4.0.0 |
|
217 | + */ |
|
218 | + public static function addScript( $application, $file = null ) { |
|
219 | + \OC_Util::addScript( $application, $file ); |
|
220 | + } |
|
221 | + |
|
222 | + /** |
|
223 | + * Add a translation JS file |
|
224 | + * @param string $application application id |
|
225 | + * @param string $languageCode language code, defaults to the current locale |
|
226 | + * @since 8.0.0 |
|
227 | + */ |
|
228 | + public static function addTranslations($application, $languageCode = null) { |
|
229 | + \OC_Util::addTranslations($application, $languageCode); |
|
230 | + } |
|
231 | + |
|
232 | + /** |
|
233 | + * Add a custom element to the header |
|
234 | + * If $text is null then the element will be written as empty element. |
|
235 | + * So use "" to get a closing tag. |
|
236 | + * @param string $tag tag name of the element |
|
237 | + * @param array $attributes array of attributes for the element |
|
238 | + * @param string $text the text content for the element |
|
239 | + * @since 4.0.0 |
|
240 | + */ |
|
241 | + public static function addHeader($tag, $attributes, $text=null) { |
|
242 | + \OC_Util::addHeader($tag, $attributes, $text); |
|
243 | + } |
|
244 | + |
|
245 | + /** |
|
246 | + * formats a timestamp in the "right" way |
|
247 | + * @param int $timestamp $timestamp |
|
248 | + * @param bool $dateOnly option to omit time from the result |
|
249 | + * @param DateTimeZone|string $timeZone where the given timestamp shall be converted to |
|
250 | + * @return string timestamp |
|
251 | + * |
|
252 | + * @deprecated 8.0.0 Use \OC::$server->query('DateTimeFormatter') instead |
|
253 | + * @since 4.0.0 |
|
254 | + */ |
|
255 | + public static function formatDate($timestamp, $dateOnly=false, $timeZone = null) { |
|
256 | + return(\OC_Util::formatDate($timestamp, $dateOnly, $timeZone)); |
|
257 | + } |
|
258 | + |
|
259 | + /** |
|
260 | + * check if some encrypted files are stored |
|
261 | + * @return bool |
|
262 | + * |
|
263 | + * @deprecated 8.1.0 No longer required |
|
264 | + * @since 6.0.0 |
|
265 | + */ |
|
266 | + public static function encryptedFiles() { |
|
267 | + return false; |
|
268 | + } |
|
269 | + |
|
270 | + /** |
|
271 | + * Creates an absolute url to the given app and file. |
|
272 | + * @param string $app app |
|
273 | + * @param string $file file |
|
274 | + * @param array $args array with param=>value, will be appended to the returned url |
|
275 | + * The value of $args will be urlencoded |
|
276 | + * @return string the url |
|
277 | + * @since 4.0.0 - parameter $args was added in 4.5.0 |
|
278 | + */ |
|
279 | + public static function linkToAbsolute( $app, $file, $args = array() ) { |
|
280 | + $urlGenerator = \OC::$server->getURLGenerator(); |
|
281 | + return $urlGenerator->getAbsoluteURL( |
|
282 | + $urlGenerator->linkTo($app, $file, $args) |
|
283 | + ); |
|
284 | + } |
|
285 | + |
|
286 | + /** |
|
287 | + * Creates an absolute url for remote use. |
|
288 | + * @param string $service id |
|
289 | + * @return string the url |
|
290 | + * @since 4.0.0 |
|
291 | + */ |
|
292 | + public static function linkToRemote( $service ) { |
|
293 | + $urlGenerator = \OC::$server->getURLGenerator(); |
|
294 | + $remoteBase = $urlGenerator->linkTo('', 'remote.php') . '/' . $service; |
|
295 | + return $urlGenerator->getAbsoluteURL( |
|
296 | + $remoteBase . (($service[strlen($service) - 1] != '/') ? '/' : '') |
|
297 | + ); |
|
298 | + } |
|
299 | + |
|
300 | + /** |
|
301 | + * Creates an absolute url for public use |
|
302 | + * @param string $service id |
|
303 | + * @return string the url |
|
304 | + * @since 4.5.0 |
|
305 | + */ |
|
306 | + public static function linkToPublic($service) { |
|
307 | + return \OC_Helper::linkToPublic($service); |
|
308 | + } |
|
309 | + |
|
310 | + /** |
|
311 | + * Creates an url using a defined route |
|
312 | + * @param string $route |
|
313 | + * @param array $parameters |
|
314 | + * @internal param array $args with param=>value, will be appended to the returned url |
|
315 | + * @return string the url |
|
316 | + * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkToRoute($route, $parameters) |
|
317 | + * @since 5.0.0 |
|
318 | + */ |
|
319 | + public static function linkToRoute( $route, $parameters = array() ) { |
|
320 | + return \OC::$server->getURLGenerator()->linkToRoute($route, $parameters); |
|
321 | + } |
|
322 | + |
|
323 | + /** |
|
324 | + * Creates an url to the given app and file |
|
325 | + * @param string $app app |
|
326 | + * @param string $file file |
|
327 | + * @param array $args array with param=>value, will be appended to the returned url |
|
328 | + * The value of $args will be urlencoded |
|
329 | + * @return string the url |
|
330 | + * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->linkTo($app, $file, $args) |
|
331 | + * @since 4.0.0 - parameter $args was added in 4.5.0 |
|
332 | + */ |
|
333 | + public static function linkTo( $app, $file, $args = array() ) { |
|
334 | + return \OC::$server->getURLGenerator()->linkTo($app, $file, $args); |
|
335 | + } |
|
336 | + |
|
337 | + /** |
|
338 | + * Returns the server host, even if the website uses one or more reverse proxy |
|
339 | + * @return string the server host |
|
340 | + * @deprecated 8.1.0 Use \OCP\IRequest::getServerHost |
|
341 | + * @since 4.0.0 |
|
342 | + */ |
|
343 | + public static function getServerHost() { |
|
344 | + return \OC::$server->getRequest()->getServerHost(); |
|
345 | + } |
|
346 | + |
|
347 | + /** |
|
348 | + * Returns the server host name without an eventual port number |
|
349 | + * @return string the server hostname |
|
350 | + * @since 5.0.0 |
|
351 | + */ |
|
352 | + public static function getServerHostName() { |
|
353 | + $host_name = self::getServerHost(); |
|
354 | + // strip away port number (if existing) |
|
355 | + $colon_pos = strpos($host_name, ':'); |
|
356 | + if ($colon_pos != FALSE) { |
|
357 | + $host_name = substr($host_name, 0, $colon_pos); |
|
358 | + } |
|
359 | + return $host_name; |
|
360 | + } |
|
361 | + |
|
362 | + /** |
|
363 | + * Returns the default email address |
|
364 | + * @param string $user_part the user part of the address |
|
365 | + * @return string the default email address |
|
366 | + * |
|
367 | + * Assembles a default email address (using the server hostname |
|
368 | + * and the given user part, and returns it |
|
369 | + * Example: when given lostpassword-noreply as $user_part param, |
|
370 | + * and is currently accessed via http(s)://example.com/, |
|
371 | + * it would return '[email protected]' |
|
372 | + * |
|
373 | + * If the configuration value 'mail_from_address' is set in |
|
374 | + * config.php, this value will override the $user_part that |
|
375 | + * is passed to this function |
|
376 | + * @since 5.0.0 |
|
377 | + */ |
|
378 | + public static function getDefaultEmailAddress($user_part) { |
|
379 | + $config = \OC::$server->getConfig(); |
|
380 | + $user_part = $config->getSystemValue('mail_from_address', $user_part); |
|
381 | + $host_name = self::getServerHostName(); |
|
382 | + $host_name = $config->getSystemValue('mail_domain', $host_name); |
|
383 | + $defaultEmailAddress = $user_part.'@'.$host_name; |
|
384 | + |
|
385 | + $mailer = \OC::$server->getMailer(); |
|
386 | + if ($mailer->validateMailAddress($defaultEmailAddress)) { |
|
387 | + return $defaultEmailAddress; |
|
388 | + } |
|
389 | + |
|
390 | + // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain' |
|
391 | + return $user_part.'@localhost.localdomain'; |
|
392 | + } |
|
393 | + |
|
394 | + /** |
|
395 | + * Returns the server protocol. It respects reverse proxy servers and load balancers |
|
396 | + * @return string the server protocol |
|
397 | + * @deprecated 8.1.0 Use \OCP\IRequest::getServerProtocol |
|
398 | + * @since 4.5.0 |
|
399 | + */ |
|
400 | + public static function getServerProtocol() { |
|
401 | + return \OC::$server->getRequest()->getServerProtocol(); |
|
402 | + } |
|
403 | + |
|
404 | + /** |
|
405 | + * Returns the request uri, even if the website uses one or more reverse proxies |
|
406 | + * @return string the request uri |
|
407 | + * @deprecated 8.1.0 Use \OCP\IRequest::getRequestUri |
|
408 | + * @since 5.0.0 |
|
409 | + */ |
|
410 | + public static function getRequestUri() { |
|
411 | + return \OC::$server->getRequest()->getRequestUri(); |
|
412 | + } |
|
413 | + |
|
414 | + /** |
|
415 | + * Returns the script name, even if the website uses one or more reverse proxies |
|
416 | + * @return string the script name |
|
417 | + * @deprecated 8.1.0 Use \OCP\IRequest::getScriptName |
|
418 | + * @since 5.0.0 |
|
419 | + */ |
|
420 | + public static function getScriptName() { |
|
421 | + return \OC::$server->getRequest()->getScriptName(); |
|
422 | + } |
|
423 | + |
|
424 | + /** |
|
425 | + * Creates path to an image |
|
426 | + * @param string $app app |
|
427 | + * @param string $image image name |
|
428 | + * @return string the url |
|
429 | + * @deprecated 8.1.0 Use \OC::$server->getURLGenerator()->imagePath($app, $image) |
|
430 | + * @since 4.0.0 |
|
431 | + */ |
|
432 | + public static function imagePath( $app, $image ) { |
|
433 | + return \OC::$server->getURLGenerator()->imagePath($app, $image); |
|
434 | + } |
|
435 | + |
|
436 | + /** |
|
437 | + * Make a human file size (2048 to 2 kB) |
|
438 | + * @param int $bytes file size in bytes |
|
439 | + * @return string a human readable file size |
|
440 | + * @since 4.0.0 |
|
441 | + */ |
|
442 | + public static function humanFileSize( $bytes ) { |
|
443 | + return(\OC_Helper::humanFileSize( $bytes )); |
|
444 | + } |
|
445 | + |
|
446 | + /** |
|
447 | + * Make a computer file size (2 kB to 2048) |
|
448 | + * @param string $str file size in a fancy format |
|
449 | + * @return int a file size in bytes |
|
450 | + * |
|
451 | + * Inspired by: http://www.php.net/manual/en/function.filesize.php#92418 |
|
452 | + * @since 4.0.0 |
|
453 | + */ |
|
454 | + public static function computerFileSize( $str ) { |
|
455 | + return(\OC_Helper::computerFileSize( $str )); |
|
456 | + } |
|
457 | + |
|
458 | + /** |
|
459 | + * connects a function to a hook |
|
460 | + * |
|
461 | + * @param string $signalClass class name of emitter |
|
462 | + * @param string $signalName name of signal |
|
463 | + * @param string|object $slotClass class name of slot |
|
464 | + * @param string $slotName name of slot |
|
465 | + * @return bool |
|
466 | + * |
|
467 | + * This function makes it very easy to connect to use hooks. |
|
468 | + * |
|
469 | + * TODO: write example |
|
470 | + * @since 4.0.0 |
|
471 | + */ |
|
472 | + static public function connectHook($signalClass, $signalName, $slotClass, $slotName ) { |
|
473 | + return(\OC_Hook::connect($signalClass, $signalName, $slotClass, $slotName )); |
|
474 | + } |
|
475 | + |
|
476 | + /** |
|
477 | + * Emits a signal. To get data from the slot use references! |
|
478 | + * @param string $signalclass class name of emitter |
|
479 | + * @param string $signalname name of signal |
|
480 | + * @param array $params default: array() array with additional data |
|
481 | + * @return bool true if slots exists or false if not |
|
482 | + * |
|
483 | + * TODO: write example |
|
484 | + * @since 4.0.0 |
|
485 | + */ |
|
486 | + static public function emitHook( $signalclass, $signalname, $params = array()) { |
|
487 | + return(\OC_Hook::emit( $signalclass, $signalname, $params )); |
|
488 | + } |
|
489 | + |
|
490 | + /** |
|
491 | + * Cached encrypted CSRF token. Some static unit-tests of ownCloud compare |
|
492 | + * multiple OC_Template elements which invoke `callRegister`. If the value |
|
493 | + * would not be cached these unit-tests would fail. |
|
494 | + * @var string |
|
495 | + */ |
|
496 | + private static $token = ''; |
|
497 | + |
|
498 | + /** |
|
499 | + * Register an get/post call. This is important to prevent CSRF attacks |
|
500 | + * @since 4.5.0 |
|
501 | + */ |
|
502 | + public static function callRegister() { |
|
503 | + if(self::$token === '') { |
|
504 | + self::$token = \OC::$server->getCsrfTokenManager()->getToken()->getEncryptedValue(); |
|
505 | + } |
|
506 | + return self::$token; |
|
507 | + } |
|
508 | + |
|
509 | + /** |
|
510 | + * Check an ajax get/post call if the request token is valid. exit if not. |
|
511 | + * @since 4.5.0 |
|
512 | + * @deprecated 9.0.0 Use annotations based on the app framework. |
|
513 | + */ |
|
514 | + public static function callCheck() { |
|
515 | + if(!\OC::$server->getRequest()->passesStrictCookieCheck()) { |
|
516 | + header('Location: '.\OC::$WEBROOT); |
|
517 | + exit(); |
|
518 | + } |
|
519 | + |
|
520 | + if (!(\OC::$server->getRequest()->passesCSRFCheck())) { |
|
521 | + exit(); |
|
522 | + } |
|
523 | + } |
|
524 | + |
|
525 | + /** |
|
526 | + * Used to sanitize HTML |
|
527 | + * |
|
528 | + * This function is used to sanitize HTML and should be applied on any |
|
529 | + * string or array of strings before displaying it on a web page. |
|
530 | + * |
|
531 | + * @param string|array $value |
|
532 | + * @return string|array an array of sanitized strings or a single sanitized string, depends on the input parameter. |
|
533 | + * @since 4.5.0 |
|
534 | + */ |
|
535 | + public static function sanitizeHTML($value) { |
|
536 | + return \OC_Util::sanitizeHTML($value); |
|
537 | + } |
|
538 | + |
|
539 | + /** |
|
540 | + * Public function to encode url parameters |
|
541 | + * |
|
542 | + * This function is used to encode path to file before output. |
|
543 | + * Encoding is done according to RFC 3986 with one exception: |
|
544 | + * Character '/' is preserved as is. |
|
545 | + * |
|
546 | + * @param string $component part of URI to encode |
|
547 | + * @return string |
|
548 | + * @since 6.0.0 |
|
549 | + */ |
|
550 | + public static function encodePath($component) { |
|
551 | + return(\OC_Util::encodePath($component)); |
|
552 | + } |
|
553 | + |
|
554 | + /** |
|
555 | + * Returns an array with all keys from input lowercased or uppercased. Numbered indices are left as is. |
|
556 | + * |
|
557 | + * @param array $input The array to work on |
|
558 | + * @param int $case Either MB_CASE_UPPER or MB_CASE_LOWER (default) |
|
559 | + * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 |
|
560 | + * @return array |
|
561 | + * @since 4.5.0 |
|
562 | + */ |
|
563 | + public static function mb_array_change_key_case($input, $case = MB_CASE_LOWER, $encoding = 'UTF-8') { |
|
564 | + return(\OC_Helper::mb_array_change_key_case($input, $case, $encoding)); |
|
565 | + } |
|
566 | + |
|
567 | + /** |
|
568 | + * replaces a copy of string delimited by the start and (optionally) length parameters with the string given in replacement. |
|
569 | + * |
|
570 | + * @param string $string The input string. Opposite to the PHP build-in function does not accept an array. |
|
571 | + * @param string $replacement The replacement string. |
|
572 | + * @param int $start If start is positive, the replacing will begin at the start'th offset into string. If start is negative, the replacing will begin at the start'th character from the end of string. |
|
573 | + * @param int $length Length of the part to be replaced |
|
574 | + * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 |
|
575 | + * @return string |
|
576 | + * @since 4.5.0 |
|
577 | + * @deprecated 8.2.0 Use substr_replace() instead. |
|
578 | + */ |
|
579 | + public static function mb_substr_replace($string, $replacement, $start, $length = null, $encoding = 'UTF-8') { |
|
580 | + return substr_replace($string, $replacement, $start, $length); |
|
581 | + } |
|
582 | + |
|
583 | + /** |
|
584 | + * Replace all occurrences of the search string with the replacement string |
|
585 | + * |
|
586 | + * @param string $search The value being searched for, otherwise known as the needle. String. |
|
587 | + * @param string $replace The replacement string. |
|
588 | + * @param string $subject The string or array being searched and replaced on, otherwise known as the haystack. |
|
589 | + * @param string $encoding The encoding parameter is the character encoding. Defaults to UTF-8 |
|
590 | + * @param int $count If passed, this will be set to the number of replacements performed. |
|
591 | + * @return string |
|
592 | + * @since 4.5.0 |
|
593 | + * @deprecated 8.2.0 Use str_replace() instead. |
|
594 | + */ |
|
595 | + public static function mb_str_replace($search, $replace, $subject, $encoding = 'UTF-8', &$count = null) { |
|
596 | + return str_replace($search, $replace, $subject, $count); |
|
597 | + } |
|
598 | + |
|
599 | + /** |
|
600 | + * performs a search in a nested array |
|
601 | + * |
|
602 | + * @param array $haystack the array to be searched |
|
603 | + * @param string $needle the search string |
|
604 | + * @param int $index optional, only search this key name |
|
605 | + * @return mixed the key of the matching field, otherwise false |
|
606 | + * @since 4.5.0 |
|
607 | + */ |
|
608 | + public static function recursiveArraySearch($haystack, $needle, $index = null) { |
|
609 | + return(\OC_Helper::recursiveArraySearch($haystack, $needle, $index)); |
|
610 | + } |
|
611 | + |
|
612 | + /** |
|
613 | + * calculates the maximum upload size respecting system settings, free space and user quota |
|
614 | + * |
|
615 | + * @param string $dir the current folder where the user currently operates |
|
616 | + * @param int $free the number of bytes free on the storage holding $dir, if not set this will be received from the storage directly |
|
617 | + * @return int number of bytes representing |
|
618 | + * @since 5.0.0 |
|
619 | + */ |
|
620 | + public static function maxUploadFilesize($dir, $free = null) { |
|
621 | + return \OC_Helper::maxUploadFilesize($dir, $free); |
|
622 | + } |
|
623 | + |
|
624 | + /** |
|
625 | + * Calculate free space left within user quota |
|
626 | + * @param string $dir the current folder where the user currently operates |
|
627 | + * @return int number of bytes representing |
|
628 | + * @since 7.0.0 |
|
629 | + */ |
|
630 | + public static function freeSpace($dir) { |
|
631 | + return \OC_Helper::freeSpace($dir); |
|
632 | + } |
|
633 | + |
|
634 | + /** |
|
635 | + * Calculate PHP upload limit |
|
636 | + * |
|
637 | + * @return int number of bytes representing |
|
638 | + * @since 7.0.0 |
|
639 | + */ |
|
640 | + public static function uploadLimit() { |
|
641 | + return \OC_Helper::uploadLimit(); |
|
642 | + } |
|
643 | + |
|
644 | + /** |
|
645 | + * Returns whether the given file name is valid |
|
646 | + * @param string $file file name to check |
|
647 | + * @return bool true if the file name is valid, false otherwise |
|
648 | + * @deprecated 8.1.0 use \OC\Files\View::verifyPath() |
|
649 | + * @since 7.0.0 |
|
650 | + */ |
|
651 | + public static function isValidFileName($file) { |
|
652 | + return \OC_Util::isValidFileName($file); |
|
653 | + } |
|
654 | + |
|
655 | + /** |
|
656 | + * Generates a cryptographic secure pseudo-random string |
|
657 | + * @param int $length of the random string |
|
658 | + * @return string |
|
659 | + * @deprecated 8.0.0 Use \OC::$server->getSecureRandom()->getMediumStrengthGenerator()->generate($length); instead |
|
660 | + * @since 7.0.0 |
|
661 | + */ |
|
662 | + public static function generateRandomBytes($length = 30) { |
|
663 | + return \OC::$server->getSecureRandom()->generate($length, \OCP\Security\ISecureRandom::CHAR_LOWER.\OCP\Security\ISecureRandom::CHAR_DIGITS); |
|
664 | + } |
|
665 | + |
|
666 | + /** |
|
667 | + * Compare two strings to provide a natural sort |
|
668 | + * @param string $a first string to compare |
|
669 | + * @param string $b second string to compare |
|
670 | + * @return -1 if $b comes before $a, 1 if $a comes before $b |
|
671 | + * or 0 if the strings are identical |
|
672 | + * @since 7.0.0 |
|
673 | + */ |
|
674 | + public static function naturalSortCompare($a, $b) { |
|
675 | + return \OC\NaturalSort::getInstance()->compare($a, $b); |
|
676 | + } |
|
677 | + |
|
678 | + /** |
|
679 | + * check if a password is required for each public link |
|
680 | + * @return boolean |
|
681 | + * @since 7.0.0 |
|
682 | + */ |
|
683 | + public static function isPublicLinkPasswordRequired() { |
|
684 | + return \OC_Util::isPublicLinkPasswordRequired(); |
|
685 | + } |
|
686 | + |
|
687 | + /** |
|
688 | + * check if share API enforces a default expire date |
|
689 | + * @return boolean |
|
690 | + * @since 8.0.0 |
|
691 | + */ |
|
692 | + public static function isDefaultExpireDateEnforced() { |
|
693 | + return \OC_Util::isDefaultExpireDateEnforced(); |
|
694 | + } |
|
695 | + |
|
696 | + protected static $needUpgradeCache = null; |
|
697 | + |
|
698 | + /** |
|
699 | + * Checks whether the current version needs upgrade. |
|
700 | + * |
|
701 | + * @return bool true if upgrade is needed, false otherwise |
|
702 | + * @since 7.0.0 |
|
703 | + */ |
|
704 | + public static function needUpgrade() { |
|
705 | + if (!isset(self::$needUpgradeCache)) { |
|
706 | + self::$needUpgradeCache=\OC_Util::needUpgrade(\OC::$server->getConfig()); |
|
707 | + } |
|
708 | + return self::$needUpgradeCache; |
|
709 | + } |
|
710 | 710 | } |
@@ -41,127 +41,127 @@ |
||
41 | 41 | * @since 8.0.0 |
42 | 42 | */ |
43 | 43 | interface IUserManager { |
44 | - /** |
|
45 | - * register a user backend |
|
46 | - * |
|
47 | - * @param \OCP\UserInterface $backend |
|
48 | - * @since 8.0.0 |
|
49 | - */ |
|
50 | - public function registerBackend($backend); |
|
51 | - |
|
52 | - /** |
|
53 | - * Get the active backends |
|
54 | - * @return \OCP\UserInterface[] |
|
55 | - * @since 8.0.0 |
|
56 | - */ |
|
57 | - public function getBackends(); |
|
58 | - |
|
59 | - /** |
|
60 | - * remove a user backend |
|
61 | - * |
|
62 | - * @param \OCP\UserInterface $backend |
|
63 | - * @since 8.0.0 |
|
64 | - */ |
|
65 | - public function removeBackend($backend); |
|
66 | - |
|
67 | - /** |
|
68 | - * remove all user backends |
|
69 | - * @since 8.0.0 |
|
70 | - */ |
|
71 | - public function clearBackends() ; |
|
72 | - |
|
73 | - /** |
|
74 | - * get a user by user id |
|
75 | - * |
|
76 | - * @param string $uid |
|
77 | - * @return \OCP\IUser|null Either the user or null if the specified user does not exist |
|
78 | - * @since 8.0.0 |
|
79 | - */ |
|
80 | - public function get($uid); |
|
81 | - |
|
82 | - /** |
|
83 | - * check if a user exists |
|
84 | - * |
|
85 | - * @param string $uid |
|
86 | - * @return bool |
|
87 | - * @since 8.0.0 |
|
88 | - */ |
|
89 | - public function userExists($uid); |
|
90 | - |
|
91 | - /** |
|
92 | - * Check if the password is valid for the user |
|
93 | - * |
|
94 | - * @param string $loginName |
|
95 | - * @param string $password |
|
96 | - * @return mixed the User object on success, false otherwise |
|
97 | - * @since 8.0.0 |
|
98 | - */ |
|
99 | - public function checkPassword($loginName, $password); |
|
100 | - |
|
101 | - /** |
|
102 | - * search by user id |
|
103 | - * |
|
104 | - * @param string $pattern |
|
105 | - * @param int $limit |
|
106 | - * @param int $offset |
|
107 | - * @return \OCP\IUser[] |
|
108 | - * @since 8.0.0 |
|
109 | - */ |
|
110 | - public function search($pattern, $limit = null, $offset = null); |
|
111 | - |
|
112 | - /** |
|
113 | - * search by displayName |
|
114 | - * |
|
115 | - * @param string $pattern |
|
116 | - * @param int $limit |
|
117 | - * @param int $offset |
|
118 | - * @return \OCP\IUser[] |
|
119 | - * @since 8.0.0 |
|
120 | - */ |
|
121 | - public function searchDisplayName($pattern, $limit = null, $offset = null); |
|
122 | - |
|
123 | - /** |
|
124 | - * @param string $uid |
|
125 | - * @param string $password |
|
126 | - * @throws \Exception |
|
127 | - * @return bool|\OCP\IUser the created user of false |
|
128 | - * @since 8.0.0 |
|
129 | - */ |
|
130 | - public function createUser($uid, $password); |
|
131 | - |
|
132 | - /** |
|
133 | - * returns how many users per backend exist (if supported by backend) |
|
134 | - * |
|
135 | - * @return array an array of backend class as key and count number as value |
|
136 | - * @since 8.0.0 |
|
137 | - */ |
|
138 | - public function countUsers(); |
|
139 | - |
|
140 | - /** |
|
141 | - * @param \Closure $callback |
|
142 | - * @param string $search |
|
143 | - * @since 9.0.0 |
|
144 | - */ |
|
145 | - public function callForAllUsers(\Closure $callback, $search = ''); |
|
146 | - |
|
147 | - /** |
|
148 | - * returns how many users have logged in once |
|
149 | - * |
|
150 | - * @return int |
|
151 | - * @since 11.0.0 |
|
152 | - */ |
|
153 | - public function countSeenUsers(); |
|
154 | - |
|
155 | - /** |
|
156 | - * @param \Closure $callback |
|
157 | - * @since 11.0.0 |
|
158 | - */ |
|
159 | - public function callForSeenUsers(\Closure $callback); |
|
160 | - |
|
161 | - /** |
|
162 | - * @param string $email |
|
163 | - * @return IUser[] |
|
164 | - * @since 9.1.0 |
|
165 | - */ |
|
166 | - public function getByEmail($email); |
|
44 | + /** |
|
45 | + * register a user backend |
|
46 | + * |
|
47 | + * @param \OCP\UserInterface $backend |
|
48 | + * @since 8.0.0 |
|
49 | + */ |
|
50 | + public function registerBackend($backend); |
|
51 | + |
|
52 | + /** |
|
53 | + * Get the active backends |
|
54 | + * @return \OCP\UserInterface[] |
|
55 | + * @since 8.0.0 |
|
56 | + */ |
|
57 | + public function getBackends(); |
|
58 | + |
|
59 | + /** |
|
60 | + * remove a user backend |
|
61 | + * |
|
62 | + * @param \OCP\UserInterface $backend |
|
63 | + * @since 8.0.0 |
|
64 | + */ |
|
65 | + public function removeBackend($backend); |
|
66 | + |
|
67 | + /** |
|
68 | + * remove all user backends |
|
69 | + * @since 8.0.0 |
|
70 | + */ |
|
71 | + public function clearBackends() ; |
|
72 | + |
|
73 | + /** |
|
74 | + * get a user by user id |
|
75 | + * |
|
76 | + * @param string $uid |
|
77 | + * @return \OCP\IUser|null Either the user or null if the specified user does not exist |
|
78 | + * @since 8.0.0 |
|
79 | + */ |
|
80 | + public function get($uid); |
|
81 | + |
|
82 | + /** |
|
83 | + * check if a user exists |
|
84 | + * |
|
85 | + * @param string $uid |
|
86 | + * @return bool |
|
87 | + * @since 8.0.0 |
|
88 | + */ |
|
89 | + public function userExists($uid); |
|
90 | + |
|
91 | + /** |
|
92 | + * Check if the password is valid for the user |
|
93 | + * |
|
94 | + * @param string $loginName |
|
95 | + * @param string $password |
|
96 | + * @return mixed the User object on success, false otherwise |
|
97 | + * @since 8.0.0 |
|
98 | + */ |
|
99 | + public function checkPassword($loginName, $password); |
|
100 | + |
|
101 | + /** |
|
102 | + * search by user id |
|
103 | + * |
|
104 | + * @param string $pattern |
|
105 | + * @param int $limit |
|
106 | + * @param int $offset |
|
107 | + * @return \OCP\IUser[] |
|
108 | + * @since 8.0.0 |
|
109 | + */ |
|
110 | + public function search($pattern, $limit = null, $offset = null); |
|
111 | + |
|
112 | + /** |
|
113 | + * search by displayName |
|
114 | + * |
|
115 | + * @param string $pattern |
|
116 | + * @param int $limit |
|
117 | + * @param int $offset |
|
118 | + * @return \OCP\IUser[] |
|
119 | + * @since 8.0.0 |
|
120 | + */ |
|
121 | + public function searchDisplayName($pattern, $limit = null, $offset = null); |
|
122 | + |
|
123 | + /** |
|
124 | + * @param string $uid |
|
125 | + * @param string $password |
|
126 | + * @throws \Exception |
|
127 | + * @return bool|\OCP\IUser the created user of false |
|
128 | + * @since 8.0.0 |
|
129 | + */ |
|
130 | + public function createUser($uid, $password); |
|
131 | + |
|
132 | + /** |
|
133 | + * returns how many users per backend exist (if supported by backend) |
|
134 | + * |
|
135 | + * @return array an array of backend class as key and count number as value |
|
136 | + * @since 8.0.0 |
|
137 | + */ |
|
138 | + public function countUsers(); |
|
139 | + |
|
140 | + /** |
|
141 | + * @param \Closure $callback |
|
142 | + * @param string $search |
|
143 | + * @since 9.0.0 |
|
144 | + */ |
|
145 | + public function callForAllUsers(\Closure $callback, $search = ''); |
|
146 | + |
|
147 | + /** |
|
148 | + * returns how many users have logged in once |
|
149 | + * |
|
150 | + * @return int |
|
151 | + * @since 11.0.0 |
|
152 | + */ |
|
153 | + public function countSeenUsers(); |
|
154 | + |
|
155 | + /** |
|
156 | + * @param \Closure $callback |
|
157 | + * @since 11.0.0 |
|
158 | + */ |
|
159 | + public function callForSeenUsers(\Closure $callback); |
|
160 | + |
|
161 | + /** |
|
162 | + * @param string $email |
|
163 | + * @return IUser[] |
|
164 | + * @since 9.1.0 |
|
165 | + */ |
|
166 | + public function getByEmail($email); |
|
167 | 167 | } |
@@ -31,28 +31,28 @@ |
||
31 | 31 | * @since 8.1.0 |
32 | 32 | */ |
33 | 33 | interface IResponse { |
34 | - /** |
|
35 | - * @return string|resource |
|
36 | - * @since 8.1.0 |
|
37 | - */ |
|
38 | - public function getBody(); |
|
34 | + /** |
|
35 | + * @return string|resource |
|
36 | + * @since 8.1.0 |
|
37 | + */ |
|
38 | + public function getBody(); |
|
39 | 39 | |
40 | - /** |
|
41 | - * @return int |
|
42 | - * @since 8.1.0 |
|
43 | - */ |
|
44 | - public function getStatusCode(); |
|
40 | + /** |
|
41 | + * @return int |
|
42 | + * @since 8.1.0 |
|
43 | + */ |
|
44 | + public function getStatusCode(); |
|
45 | 45 | |
46 | - /** |
|
47 | - * @param $key |
|
48 | - * @return string |
|
49 | - * @since 8.1.0 |
|
50 | - */ |
|
51 | - public function getHeader($key); |
|
46 | + /** |
|
47 | + * @param $key |
|
48 | + * @return string |
|
49 | + * @since 8.1.0 |
|
50 | + */ |
|
51 | + public function getHeader($key); |
|
52 | 52 | |
53 | - /** |
|
54 | - * @return array |
|
55 | - * @since 8.1.0 |
|
56 | - */ |
|
57 | - public function getHeaders(); |
|
53 | + /** |
|
54 | + * @return array |
|
55 | + * @since 8.1.0 |
|
56 | + */ |
|
57 | + public function getHeaders(); |
|
58 | 58 | } |
@@ -31,178 +31,178 @@ |
||
31 | 31 | */ |
32 | 32 | interface IClient { |
33 | 33 | |
34 | - /** |
|
35 | - * Sends a GET request |
|
36 | - * @param string $uri |
|
37 | - * @param array $options Array such as |
|
38 | - * 'query' => [ |
|
39 | - * 'field' => 'abc', |
|
40 | - * 'other_field' => '123', |
|
41 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
42 | - * ], |
|
43 | - * 'headers' => [ |
|
44 | - * 'foo' => 'bar', |
|
45 | - * ], |
|
46 | - * 'cookies' => [' |
|
47 | - * 'foo' => 'bar', |
|
48 | - * ], |
|
49 | - * 'allow_redirects' => [ |
|
50 | - * 'max' => 10, // allow at most 10 redirects. |
|
51 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
52 | - * 'referer' => true, // add a Referer header |
|
53 | - * 'protocols' => ['https'] // only allow https URLs |
|
54 | - * ], |
|
55 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
56 | - * 'verify' => true, // bool or string to CA file |
|
57 | - * 'debug' => true, |
|
58 | - * @return IResponse |
|
59 | - * @throws \Exception If the request could not get completed |
|
60 | - * @since 8.1.0 |
|
61 | - */ |
|
62 | - public function get($uri, array $options = []); |
|
34 | + /** |
|
35 | + * Sends a GET request |
|
36 | + * @param string $uri |
|
37 | + * @param array $options Array such as |
|
38 | + * 'query' => [ |
|
39 | + * 'field' => 'abc', |
|
40 | + * 'other_field' => '123', |
|
41 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
42 | + * ], |
|
43 | + * 'headers' => [ |
|
44 | + * 'foo' => 'bar', |
|
45 | + * ], |
|
46 | + * 'cookies' => [' |
|
47 | + * 'foo' => 'bar', |
|
48 | + * ], |
|
49 | + * 'allow_redirects' => [ |
|
50 | + * 'max' => 10, // allow at most 10 redirects. |
|
51 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
52 | + * 'referer' => true, // add a Referer header |
|
53 | + * 'protocols' => ['https'] // only allow https URLs |
|
54 | + * ], |
|
55 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
56 | + * 'verify' => true, // bool or string to CA file |
|
57 | + * 'debug' => true, |
|
58 | + * @return IResponse |
|
59 | + * @throws \Exception If the request could not get completed |
|
60 | + * @since 8.1.0 |
|
61 | + */ |
|
62 | + public function get($uri, array $options = []); |
|
63 | 63 | |
64 | - /** |
|
65 | - * Sends a HEAD request |
|
66 | - * @param string $uri |
|
67 | - * @param array $options Array such as |
|
68 | - * 'headers' => [ |
|
69 | - * 'foo' => 'bar', |
|
70 | - * ], |
|
71 | - * 'cookies' => [' |
|
72 | - * 'foo' => 'bar', |
|
73 | - * ], |
|
74 | - * 'allow_redirects' => [ |
|
75 | - * 'max' => 10, // allow at most 10 redirects. |
|
76 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
77 | - * 'referer' => true, // add a Referer header |
|
78 | - * 'protocols' => ['https'] // only allow https URLs |
|
79 | - * ], |
|
80 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
81 | - * 'verify' => true, // bool or string to CA file |
|
82 | - * 'debug' => true, |
|
83 | - * @return IResponse |
|
84 | - * @throws \Exception If the request could not get completed |
|
85 | - * @since 8.1.0 |
|
86 | - */ |
|
87 | - public function head($uri, $options = []); |
|
64 | + /** |
|
65 | + * Sends a HEAD request |
|
66 | + * @param string $uri |
|
67 | + * @param array $options Array such as |
|
68 | + * 'headers' => [ |
|
69 | + * 'foo' => 'bar', |
|
70 | + * ], |
|
71 | + * 'cookies' => [' |
|
72 | + * 'foo' => 'bar', |
|
73 | + * ], |
|
74 | + * 'allow_redirects' => [ |
|
75 | + * 'max' => 10, // allow at most 10 redirects. |
|
76 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
77 | + * 'referer' => true, // add a Referer header |
|
78 | + * 'protocols' => ['https'] // only allow https URLs |
|
79 | + * ], |
|
80 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
81 | + * 'verify' => true, // bool or string to CA file |
|
82 | + * 'debug' => true, |
|
83 | + * @return IResponse |
|
84 | + * @throws \Exception If the request could not get completed |
|
85 | + * @since 8.1.0 |
|
86 | + */ |
|
87 | + public function head($uri, $options = []); |
|
88 | 88 | |
89 | - /** |
|
90 | - * Sends a POST request |
|
91 | - * @param string $uri |
|
92 | - * @param array $options Array such as |
|
93 | - * 'body' => [ |
|
94 | - * 'field' => 'abc', |
|
95 | - * 'other_field' => '123', |
|
96 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
97 | - * ], |
|
98 | - * 'headers' => [ |
|
99 | - * 'foo' => 'bar', |
|
100 | - * ], |
|
101 | - * 'cookies' => [' |
|
102 | - * 'foo' => 'bar', |
|
103 | - * ], |
|
104 | - * 'allow_redirects' => [ |
|
105 | - * 'max' => 10, // allow at most 10 redirects. |
|
106 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
107 | - * 'referer' => true, // add a Referer header |
|
108 | - * 'protocols' => ['https'] // only allow https URLs |
|
109 | - * ], |
|
110 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
111 | - * 'verify' => true, // bool or string to CA file |
|
112 | - * 'debug' => true, |
|
113 | - * @return IResponse |
|
114 | - * @throws \Exception If the request could not get completed |
|
115 | - * @since 8.1.0 |
|
116 | - */ |
|
117 | - public function post($uri, array $options = []); |
|
89 | + /** |
|
90 | + * Sends a POST request |
|
91 | + * @param string $uri |
|
92 | + * @param array $options Array such as |
|
93 | + * 'body' => [ |
|
94 | + * 'field' => 'abc', |
|
95 | + * 'other_field' => '123', |
|
96 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
97 | + * ], |
|
98 | + * 'headers' => [ |
|
99 | + * 'foo' => 'bar', |
|
100 | + * ], |
|
101 | + * 'cookies' => [' |
|
102 | + * 'foo' => 'bar', |
|
103 | + * ], |
|
104 | + * 'allow_redirects' => [ |
|
105 | + * 'max' => 10, // allow at most 10 redirects. |
|
106 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
107 | + * 'referer' => true, // add a Referer header |
|
108 | + * 'protocols' => ['https'] // only allow https URLs |
|
109 | + * ], |
|
110 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
111 | + * 'verify' => true, // bool or string to CA file |
|
112 | + * 'debug' => true, |
|
113 | + * @return IResponse |
|
114 | + * @throws \Exception If the request could not get completed |
|
115 | + * @since 8.1.0 |
|
116 | + */ |
|
117 | + public function post($uri, array $options = []); |
|
118 | 118 | |
119 | - /** |
|
120 | - * Sends a PUT request |
|
121 | - * @param string $uri |
|
122 | - * @param array $options Array such as |
|
123 | - * 'body' => [ |
|
124 | - * 'field' => 'abc', |
|
125 | - * 'other_field' => '123', |
|
126 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
127 | - * ], |
|
128 | - * 'headers' => [ |
|
129 | - * 'foo' => 'bar', |
|
130 | - * ], |
|
131 | - * 'cookies' => [' |
|
132 | - * 'foo' => 'bar', |
|
133 | - * ], |
|
134 | - * 'allow_redirects' => [ |
|
135 | - * 'max' => 10, // allow at most 10 redirects. |
|
136 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
137 | - * 'referer' => true, // add a Referer header |
|
138 | - * 'protocols' => ['https'] // only allow https URLs |
|
139 | - * ], |
|
140 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
141 | - * 'verify' => true, // bool or string to CA file |
|
142 | - * 'debug' => true, |
|
143 | - * @return IResponse |
|
144 | - * @throws \Exception If the request could not get completed |
|
145 | - * @since 8.1.0 |
|
146 | - */ |
|
147 | - public function put($uri, array $options = []); |
|
119 | + /** |
|
120 | + * Sends a PUT request |
|
121 | + * @param string $uri |
|
122 | + * @param array $options Array such as |
|
123 | + * 'body' => [ |
|
124 | + * 'field' => 'abc', |
|
125 | + * 'other_field' => '123', |
|
126 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
127 | + * ], |
|
128 | + * 'headers' => [ |
|
129 | + * 'foo' => 'bar', |
|
130 | + * ], |
|
131 | + * 'cookies' => [' |
|
132 | + * 'foo' => 'bar', |
|
133 | + * ], |
|
134 | + * 'allow_redirects' => [ |
|
135 | + * 'max' => 10, // allow at most 10 redirects. |
|
136 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
137 | + * 'referer' => true, // add a Referer header |
|
138 | + * 'protocols' => ['https'] // only allow https URLs |
|
139 | + * ], |
|
140 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
141 | + * 'verify' => true, // bool or string to CA file |
|
142 | + * 'debug' => true, |
|
143 | + * @return IResponse |
|
144 | + * @throws \Exception If the request could not get completed |
|
145 | + * @since 8.1.0 |
|
146 | + */ |
|
147 | + public function put($uri, array $options = []); |
|
148 | 148 | |
149 | - /** |
|
150 | - * Sends a DELETE request |
|
151 | - * @param string $uri |
|
152 | - * @param array $options Array such as |
|
153 | - * 'body' => [ |
|
154 | - * 'field' => 'abc', |
|
155 | - * 'other_field' => '123', |
|
156 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
157 | - * ], |
|
158 | - * 'headers' => [ |
|
159 | - * 'foo' => 'bar', |
|
160 | - * ], |
|
161 | - * 'cookies' => [' |
|
162 | - * 'foo' => 'bar', |
|
163 | - * ], |
|
164 | - * 'allow_redirects' => [ |
|
165 | - * 'max' => 10, // allow at most 10 redirects. |
|
166 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
167 | - * 'referer' => true, // add a Referer header |
|
168 | - * 'protocols' => ['https'] // only allow https URLs |
|
169 | - * ], |
|
170 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
171 | - * 'verify' => true, // bool or string to CA file |
|
172 | - * 'debug' => true, |
|
173 | - * @return IResponse |
|
174 | - * @throws \Exception If the request could not get completed |
|
175 | - * @since 8.1.0 |
|
176 | - */ |
|
177 | - public function delete($uri, array $options = []); |
|
149 | + /** |
|
150 | + * Sends a DELETE request |
|
151 | + * @param string $uri |
|
152 | + * @param array $options Array such as |
|
153 | + * 'body' => [ |
|
154 | + * 'field' => 'abc', |
|
155 | + * 'other_field' => '123', |
|
156 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
157 | + * ], |
|
158 | + * 'headers' => [ |
|
159 | + * 'foo' => 'bar', |
|
160 | + * ], |
|
161 | + * 'cookies' => [' |
|
162 | + * 'foo' => 'bar', |
|
163 | + * ], |
|
164 | + * 'allow_redirects' => [ |
|
165 | + * 'max' => 10, // allow at most 10 redirects. |
|
166 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
167 | + * 'referer' => true, // add a Referer header |
|
168 | + * 'protocols' => ['https'] // only allow https URLs |
|
169 | + * ], |
|
170 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
171 | + * 'verify' => true, // bool or string to CA file |
|
172 | + * 'debug' => true, |
|
173 | + * @return IResponse |
|
174 | + * @throws \Exception If the request could not get completed |
|
175 | + * @since 8.1.0 |
|
176 | + */ |
|
177 | + public function delete($uri, array $options = []); |
|
178 | 178 | |
179 | - /** |
|
180 | - * Sends a options request |
|
181 | - * @param string $uri |
|
182 | - * @param array $options Array such as |
|
183 | - * 'body' => [ |
|
184 | - * 'field' => 'abc', |
|
185 | - * 'other_field' => '123', |
|
186 | - * 'file_name' => fopen('/path/to/file', 'r'), |
|
187 | - * ], |
|
188 | - * 'headers' => [ |
|
189 | - * 'foo' => 'bar', |
|
190 | - * ], |
|
191 | - * 'cookies' => [' |
|
192 | - * 'foo' => 'bar', |
|
193 | - * ], |
|
194 | - * 'allow_redirects' => [ |
|
195 | - * 'max' => 10, // allow at most 10 redirects. |
|
196 | - * 'strict' => true, // use "strict" RFC compliant redirects. |
|
197 | - * 'referer' => true, // add a Referer header |
|
198 | - * 'protocols' => ['https'] // only allow https URLs |
|
199 | - * ], |
|
200 | - * 'save_to' => '/path/to/file', // save to a file or a stream |
|
201 | - * 'verify' => true, // bool or string to CA file |
|
202 | - * 'debug' => true, |
|
203 | - * @return IResponse |
|
204 | - * @throws \Exception If the request could not get completed |
|
205 | - * @since 8.1.0 |
|
206 | - */ |
|
207 | - public function options($uri, array $options = []); |
|
179 | + /** |
|
180 | + * Sends a options request |
|
181 | + * @param string $uri |
|
182 | + * @param array $options Array such as |
|
183 | + * 'body' => [ |
|
184 | + * 'field' => 'abc', |
|
185 | + * 'other_field' => '123', |
|
186 | + * 'file_name' => fopen('/path/to/file', 'r'), |
|
187 | + * ], |
|
188 | + * 'headers' => [ |
|
189 | + * 'foo' => 'bar', |
|
190 | + * ], |
|
191 | + * 'cookies' => [' |
|
192 | + * 'foo' => 'bar', |
|
193 | + * ], |
|
194 | + * 'allow_redirects' => [ |
|
195 | + * 'max' => 10, // allow at most 10 redirects. |
|
196 | + * 'strict' => true, // use "strict" RFC compliant redirects. |
|
197 | + * 'referer' => true, // add a Referer header |
|
198 | + * 'protocols' => ['https'] // only allow https URLs |
|
199 | + * ], |
|
200 | + * 'save_to' => '/path/to/file', // save to a file or a stream |
|
201 | + * 'verify' => true, // bool or string to CA file |
|
202 | + * 'debug' => true, |
|
203 | + * @return IResponse |
|
204 | + * @throws \Exception If the request could not get completed |
|
205 | + * @since 8.1.0 |
|
206 | + */ |
|
207 | + public function options($uri, array $options = []); |
|
208 | 208 | } |
@@ -30,9 +30,9 @@ |
||
30 | 30 | * @since 8.1.0 |
31 | 31 | */ |
32 | 32 | interface IClientService { |
33 | - /** |
|
34 | - * @return IClient |
|
35 | - * @since 8.1.0 |
|
36 | - */ |
|
37 | - public function newClient(); |
|
33 | + /** |
|
34 | + * @return IClient |
|
35 | + * @since 8.1.0 |
|
36 | + */ |
|
37 | + public function newClient(); |
|
38 | 38 | } |
@@ -41,187 +41,187 @@ |
||
41 | 41 | * @since 6.0.0 |
42 | 42 | */ |
43 | 43 | interface IConfig { |
44 | - /** |
|
45 | - * @since 8.2.0 |
|
46 | - */ |
|
47 | - const SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***'; |
|
48 | - |
|
49 | - /** |
|
50 | - * Sets and deletes system wide values |
|
51 | - * |
|
52 | - * @param array $configs Associative array with `key => value` pairs |
|
53 | - * If value is null, the config key will be deleted |
|
54 | - * @since 8.0.0 |
|
55 | - */ |
|
56 | - public function setSystemValues(array $configs); |
|
57 | - |
|
58 | - /** |
|
59 | - * Sets a new system wide value |
|
60 | - * |
|
61 | - * @param string $key the key of the value, under which will be saved |
|
62 | - * @param mixed $value the value that should be stored |
|
63 | - * @since 8.0.0 |
|
64 | - */ |
|
65 | - public function setSystemValue($key, $value); |
|
66 | - |
|
67 | - /** |
|
68 | - * Looks up a system wide defined value |
|
69 | - * |
|
70 | - * @param string $key the key of the value, under which it was saved |
|
71 | - * @param mixed $default the default value to be returned if the value isn't set |
|
72 | - * @return mixed the value or $default |
|
73 | - * @since 6.0.0 - parameter $default was added in 7.0.0 |
|
74 | - */ |
|
75 | - public function getSystemValue($key, $default = ''); |
|
76 | - |
|
77 | - /** |
|
78 | - * Looks up a system wide defined value and filters out sensitive data |
|
79 | - * |
|
80 | - * @param string $key the key of the value, under which it was saved |
|
81 | - * @param mixed $default the default value to be returned if the value isn't set |
|
82 | - * @return mixed the value or $default |
|
83 | - * @since 8.2.0 |
|
84 | - */ |
|
85 | - public function getFilteredSystemValue($key, $default = ''); |
|
86 | - |
|
87 | - /** |
|
88 | - * Delete a system wide defined value |
|
89 | - * |
|
90 | - * @param string $key the key of the value, under which it was saved |
|
91 | - * @since 8.0.0 |
|
92 | - */ |
|
93 | - public function deleteSystemValue($key); |
|
94 | - |
|
95 | - /** |
|
96 | - * Get all keys stored for an app |
|
97 | - * |
|
98 | - * @param string $appName the appName that we stored the value under |
|
99 | - * @return string[] the keys stored for the app |
|
100 | - * @since 8.0.0 |
|
101 | - */ |
|
102 | - public function getAppKeys($appName); |
|
103 | - |
|
104 | - /** |
|
105 | - * Writes a new app wide value |
|
106 | - * |
|
107 | - * @param string $appName the appName that we want to store the value under |
|
108 | - * @param string|float|int $key the key of the value, under which will be saved |
|
109 | - * @param string $value the value that should be stored |
|
110 | - * @return void |
|
111 | - * @since 6.0.0 |
|
112 | - */ |
|
113 | - public function setAppValue($appName, $key, $value); |
|
114 | - |
|
115 | - /** |
|
116 | - * Looks up an app wide defined value |
|
117 | - * |
|
118 | - * @param string $appName the appName that we stored the value under |
|
119 | - * @param string $key the key of the value, under which it was saved |
|
120 | - * @param string $default the default value to be returned if the value isn't set |
|
121 | - * @return string the saved value |
|
122 | - * @since 6.0.0 - parameter $default was added in 7.0.0 |
|
123 | - */ |
|
124 | - public function getAppValue($appName, $key, $default = ''); |
|
125 | - |
|
126 | - /** |
|
127 | - * Delete an app wide defined value |
|
128 | - * |
|
129 | - * @param string $appName the appName that we stored the value under |
|
130 | - * @param string $key the key of the value, under which it was saved |
|
131 | - * @since 8.0.0 |
|
132 | - */ |
|
133 | - public function deleteAppValue($appName, $key); |
|
134 | - |
|
135 | - /** |
|
136 | - * Removes all keys in appconfig belonging to the app |
|
137 | - * |
|
138 | - * @param string $appName the appName the configs are stored under |
|
139 | - * @since 8.0.0 |
|
140 | - */ |
|
141 | - public function deleteAppValues($appName); |
|
142 | - |
|
143 | - |
|
144 | - /** |
|
145 | - * Set a user defined value |
|
146 | - * |
|
147 | - * @param string $userId the userId of the user that we want to store the value under |
|
148 | - * @param string $appName the appName that we want to store the value under |
|
149 | - * @param string $key the key under which the value is being stored |
|
150 | - * @param string $value the value that you want to store |
|
151 | - * @param string $preCondition only update if the config value was previously the value passed as $preCondition |
|
152 | - * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met |
|
153 | - * @throws \UnexpectedValueException when trying to store an unexpected value |
|
154 | - * @since 6.0.0 - parameter $precondition was added in 8.0.0 |
|
155 | - */ |
|
156 | - public function setUserValue($userId, $appName, $key, $value, $preCondition = null); |
|
157 | - |
|
158 | - /** |
|
159 | - * Shortcut for getting a user defined value |
|
160 | - * |
|
161 | - * @param string $userId the userId of the user that we want to store the value under |
|
162 | - * @param string $appName the appName that we stored the value under |
|
163 | - * @param string $key the key under which the value is being stored |
|
164 | - * @param mixed $default the default value to be returned if the value isn't set |
|
165 | - * @return string |
|
166 | - * @since 6.0.0 - parameter $default was added in 7.0.0 |
|
167 | - */ |
|
168 | - public function getUserValue($userId, $appName, $key, $default = ''); |
|
169 | - |
|
170 | - /** |
|
171 | - * Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs. |
|
172 | - * |
|
173 | - * @param string $appName app to get the value for |
|
174 | - * @param string $key the key to get the value for |
|
175 | - * @param array $userIds the user IDs to fetch the values for |
|
176 | - * @return array Mapped values: userId => value |
|
177 | - * @since 8.0.0 |
|
178 | - */ |
|
179 | - public function getUserValueForUsers($appName, $key, $userIds); |
|
180 | - |
|
181 | - /** |
|
182 | - * Get the keys of all stored by an app for the user |
|
183 | - * |
|
184 | - * @param string $userId the userId of the user that we want to store the value under |
|
185 | - * @param string $appName the appName that we stored the value under |
|
186 | - * @return string[] |
|
187 | - * @since 8.0.0 |
|
188 | - */ |
|
189 | - public function getUserKeys($userId, $appName); |
|
190 | - |
|
191 | - /** |
|
192 | - * Delete a user value |
|
193 | - * |
|
194 | - * @param string $userId the userId of the user that we want to store the value under |
|
195 | - * @param string $appName the appName that we stored the value under |
|
196 | - * @param string $key the key under which the value is being stored |
|
197 | - * @since 8.0.0 |
|
198 | - */ |
|
199 | - public function deleteUserValue($userId, $appName, $key); |
|
200 | - |
|
201 | - /** |
|
202 | - * Delete all user values |
|
203 | - * |
|
204 | - * @param string $userId the userId of the user that we want to remove all values from |
|
205 | - * @since 8.0.0 |
|
206 | - */ |
|
207 | - public function deleteAllUserValues($userId); |
|
208 | - |
|
209 | - /** |
|
210 | - * Delete all user related values of one app |
|
211 | - * |
|
212 | - * @param string $appName the appName of the app that we want to remove all values from |
|
213 | - * @since 8.0.0 |
|
214 | - */ |
|
215 | - public function deleteAppFromAllUsers($appName); |
|
216 | - |
|
217 | - /** |
|
218 | - * Determines the users that have the given value set for a specific app-key-pair |
|
219 | - * |
|
220 | - * @param string $appName the app to get the user for |
|
221 | - * @param string $key the key to get the user for |
|
222 | - * @param string $value the value to get the user for |
|
223 | - * @return array of user IDs |
|
224 | - * @since 8.0.0 |
|
225 | - */ |
|
226 | - public function getUsersForUserValue($appName, $key, $value); |
|
44 | + /** |
|
45 | + * @since 8.2.0 |
|
46 | + */ |
|
47 | + const SENSITIVE_VALUE = '***REMOVED SENSITIVE VALUE***'; |
|
48 | + |
|
49 | + /** |
|
50 | + * Sets and deletes system wide values |
|
51 | + * |
|
52 | + * @param array $configs Associative array with `key => value` pairs |
|
53 | + * If value is null, the config key will be deleted |
|
54 | + * @since 8.0.0 |
|
55 | + */ |
|
56 | + public function setSystemValues(array $configs); |
|
57 | + |
|
58 | + /** |
|
59 | + * Sets a new system wide value |
|
60 | + * |
|
61 | + * @param string $key the key of the value, under which will be saved |
|
62 | + * @param mixed $value the value that should be stored |
|
63 | + * @since 8.0.0 |
|
64 | + */ |
|
65 | + public function setSystemValue($key, $value); |
|
66 | + |
|
67 | + /** |
|
68 | + * Looks up a system wide defined value |
|
69 | + * |
|
70 | + * @param string $key the key of the value, under which it was saved |
|
71 | + * @param mixed $default the default value to be returned if the value isn't set |
|
72 | + * @return mixed the value or $default |
|
73 | + * @since 6.0.0 - parameter $default was added in 7.0.0 |
|
74 | + */ |
|
75 | + public function getSystemValue($key, $default = ''); |
|
76 | + |
|
77 | + /** |
|
78 | + * Looks up a system wide defined value and filters out sensitive data |
|
79 | + * |
|
80 | + * @param string $key the key of the value, under which it was saved |
|
81 | + * @param mixed $default the default value to be returned if the value isn't set |
|
82 | + * @return mixed the value or $default |
|
83 | + * @since 8.2.0 |
|
84 | + */ |
|
85 | + public function getFilteredSystemValue($key, $default = ''); |
|
86 | + |
|
87 | + /** |
|
88 | + * Delete a system wide defined value |
|
89 | + * |
|
90 | + * @param string $key the key of the value, under which it was saved |
|
91 | + * @since 8.0.0 |
|
92 | + */ |
|
93 | + public function deleteSystemValue($key); |
|
94 | + |
|
95 | + /** |
|
96 | + * Get all keys stored for an app |
|
97 | + * |
|
98 | + * @param string $appName the appName that we stored the value under |
|
99 | + * @return string[] the keys stored for the app |
|
100 | + * @since 8.0.0 |
|
101 | + */ |
|
102 | + public function getAppKeys($appName); |
|
103 | + |
|
104 | + /** |
|
105 | + * Writes a new app wide value |
|
106 | + * |
|
107 | + * @param string $appName the appName that we want to store the value under |
|
108 | + * @param string|float|int $key the key of the value, under which will be saved |
|
109 | + * @param string $value the value that should be stored |
|
110 | + * @return void |
|
111 | + * @since 6.0.0 |
|
112 | + */ |
|
113 | + public function setAppValue($appName, $key, $value); |
|
114 | + |
|
115 | + /** |
|
116 | + * Looks up an app wide defined value |
|
117 | + * |
|
118 | + * @param string $appName the appName that we stored the value under |
|
119 | + * @param string $key the key of the value, under which it was saved |
|
120 | + * @param string $default the default value to be returned if the value isn't set |
|
121 | + * @return string the saved value |
|
122 | + * @since 6.0.0 - parameter $default was added in 7.0.0 |
|
123 | + */ |
|
124 | + public function getAppValue($appName, $key, $default = ''); |
|
125 | + |
|
126 | + /** |
|
127 | + * Delete an app wide defined value |
|
128 | + * |
|
129 | + * @param string $appName the appName that we stored the value under |
|
130 | + * @param string $key the key of the value, under which it was saved |
|
131 | + * @since 8.0.0 |
|
132 | + */ |
|
133 | + public function deleteAppValue($appName, $key); |
|
134 | + |
|
135 | + /** |
|
136 | + * Removes all keys in appconfig belonging to the app |
|
137 | + * |
|
138 | + * @param string $appName the appName the configs are stored under |
|
139 | + * @since 8.0.0 |
|
140 | + */ |
|
141 | + public function deleteAppValues($appName); |
|
142 | + |
|
143 | + |
|
144 | + /** |
|
145 | + * Set a user defined value |
|
146 | + * |
|
147 | + * @param string $userId the userId of the user that we want to store the value under |
|
148 | + * @param string $appName the appName that we want to store the value under |
|
149 | + * @param string $key the key under which the value is being stored |
|
150 | + * @param string $value the value that you want to store |
|
151 | + * @param string $preCondition only update if the config value was previously the value passed as $preCondition |
|
152 | + * @throws \OCP\PreConditionNotMetException if a precondition is specified and is not met |
|
153 | + * @throws \UnexpectedValueException when trying to store an unexpected value |
|
154 | + * @since 6.0.0 - parameter $precondition was added in 8.0.0 |
|
155 | + */ |
|
156 | + public function setUserValue($userId, $appName, $key, $value, $preCondition = null); |
|
157 | + |
|
158 | + /** |
|
159 | + * Shortcut for getting a user defined value |
|
160 | + * |
|
161 | + * @param string $userId the userId of the user that we want to store the value under |
|
162 | + * @param string $appName the appName that we stored the value under |
|
163 | + * @param string $key the key under which the value is being stored |
|
164 | + * @param mixed $default the default value to be returned if the value isn't set |
|
165 | + * @return string |
|
166 | + * @since 6.0.0 - parameter $default was added in 7.0.0 |
|
167 | + */ |
|
168 | + public function getUserValue($userId, $appName, $key, $default = ''); |
|
169 | + |
|
170 | + /** |
|
171 | + * Fetches a mapped list of userId -> value, for a specified app and key and a list of user IDs. |
|
172 | + * |
|
173 | + * @param string $appName app to get the value for |
|
174 | + * @param string $key the key to get the value for |
|
175 | + * @param array $userIds the user IDs to fetch the values for |
|
176 | + * @return array Mapped values: userId => value |
|
177 | + * @since 8.0.0 |
|
178 | + */ |
|
179 | + public function getUserValueForUsers($appName, $key, $userIds); |
|
180 | + |
|
181 | + /** |
|
182 | + * Get the keys of all stored by an app for the user |
|
183 | + * |
|
184 | + * @param string $userId the userId of the user that we want to store the value under |
|
185 | + * @param string $appName the appName that we stored the value under |
|
186 | + * @return string[] |
|
187 | + * @since 8.0.0 |
|
188 | + */ |
|
189 | + public function getUserKeys($userId, $appName); |
|
190 | + |
|
191 | + /** |
|
192 | + * Delete a user value |
|
193 | + * |
|
194 | + * @param string $userId the userId of the user that we want to store the value under |
|
195 | + * @param string $appName the appName that we stored the value under |
|
196 | + * @param string $key the key under which the value is being stored |
|
197 | + * @since 8.0.0 |
|
198 | + */ |
|
199 | + public function deleteUserValue($userId, $appName, $key); |
|
200 | + |
|
201 | + /** |
|
202 | + * Delete all user values |
|
203 | + * |
|
204 | + * @param string $userId the userId of the user that we want to remove all values from |
|
205 | + * @since 8.0.0 |
|
206 | + */ |
|
207 | + public function deleteAllUserValues($userId); |
|
208 | + |
|
209 | + /** |
|
210 | + * Delete all user related values of one app |
|
211 | + * |
|
212 | + * @param string $appName the appName of the app that we want to remove all values from |
|
213 | + * @since 8.0.0 |
|
214 | + */ |
|
215 | + public function deleteAppFromAllUsers($appName); |
|
216 | + |
|
217 | + /** |
|
218 | + * Determines the users that have the given value set for a specific app-key-pair |
|
219 | + * |
|
220 | + * @param string $appName the app to get the user for |
|
221 | + * @param string $key the key to get the user for |
|
222 | + * @param string $value the value to get the user for |
|
223 | + * @return array of user IDs |
|
224 | + * @since 8.0.0 |
|
225 | + */ |
|
226 | + public function getUsersForUserValue($appName, $key, $value); |
|
227 | 227 | } |
@@ -33,245 +33,245 @@ |
||
33 | 33 | */ |
34 | 34 | interface ICommentsManager { |
35 | 35 | |
36 | - /** |
|
37 | - * @const DELETED_USER type and id for a user that has been deleted |
|
38 | - * @see deleteReferencesOfActor |
|
39 | - * @since 9.0.0 |
|
40 | - * |
|
41 | - * To be used as replacement for user type actors in deleteReferencesOfActor(). |
|
42 | - * |
|
43 | - * User interfaces shall show "Deleted user" as display name, if needed. |
|
44 | - */ |
|
45 | - const DELETED_USER = 'deleted_users'; |
|
36 | + /** |
|
37 | + * @const DELETED_USER type and id for a user that has been deleted |
|
38 | + * @see deleteReferencesOfActor |
|
39 | + * @since 9.0.0 |
|
40 | + * |
|
41 | + * To be used as replacement for user type actors in deleteReferencesOfActor(). |
|
42 | + * |
|
43 | + * User interfaces shall show "Deleted user" as display name, if needed. |
|
44 | + */ |
|
45 | + const DELETED_USER = 'deleted_users'; |
|
46 | 46 | |
47 | - /** |
|
48 | - * returns a comment instance |
|
49 | - * |
|
50 | - * @param string $id the ID of the comment |
|
51 | - * @return IComment |
|
52 | - * @throws NotFoundException |
|
53 | - * @since 9.0.0 |
|
54 | - */ |
|
55 | - public function get($id); |
|
47 | + /** |
|
48 | + * returns a comment instance |
|
49 | + * |
|
50 | + * @param string $id the ID of the comment |
|
51 | + * @return IComment |
|
52 | + * @throws NotFoundException |
|
53 | + * @since 9.0.0 |
|
54 | + */ |
|
55 | + public function get($id); |
|
56 | 56 | |
57 | - /** |
|
58 | - * returns the comment specified by the id and all it's child comments |
|
59 | - * |
|
60 | - * @param string $id |
|
61 | - * @param int $limit max number of entries to return, 0 returns all |
|
62 | - * @param int $offset the start entry |
|
63 | - * @return array |
|
64 | - * @since 9.0.0 |
|
65 | - * |
|
66 | - * The return array looks like this |
|
67 | - * [ |
|
68 | - * 'comment' => IComment, // root comment |
|
69 | - * 'replies' => |
|
70 | - * [ |
|
71 | - * 0 => |
|
72 | - * [ |
|
73 | - * 'comment' => IComment, |
|
74 | - * 'replies' => |
|
75 | - * [ |
|
76 | - * 0 => |
|
77 | - * [ |
|
78 | - * 'comment' => IComment, |
|
79 | - * 'replies' => [ … ] |
|
80 | - * ], |
|
81 | - * … |
|
82 | - * ] |
|
83 | - * ] |
|
84 | - * 1 => |
|
85 | - * [ |
|
86 | - * 'comment' => IComment, |
|
87 | - * 'replies'=> [ … ] |
|
88 | - * ], |
|
89 | - * … |
|
90 | - * ] |
|
91 | - * ] |
|
92 | - */ |
|
93 | - public function getTree($id, $limit = 0, $offset = 0); |
|
57 | + /** |
|
58 | + * returns the comment specified by the id and all it's child comments |
|
59 | + * |
|
60 | + * @param string $id |
|
61 | + * @param int $limit max number of entries to return, 0 returns all |
|
62 | + * @param int $offset the start entry |
|
63 | + * @return array |
|
64 | + * @since 9.0.0 |
|
65 | + * |
|
66 | + * The return array looks like this |
|
67 | + * [ |
|
68 | + * 'comment' => IComment, // root comment |
|
69 | + * 'replies' => |
|
70 | + * [ |
|
71 | + * 0 => |
|
72 | + * [ |
|
73 | + * 'comment' => IComment, |
|
74 | + * 'replies' => |
|
75 | + * [ |
|
76 | + * 0 => |
|
77 | + * [ |
|
78 | + * 'comment' => IComment, |
|
79 | + * 'replies' => [ … ] |
|
80 | + * ], |
|
81 | + * … |
|
82 | + * ] |
|
83 | + * ] |
|
84 | + * 1 => |
|
85 | + * [ |
|
86 | + * 'comment' => IComment, |
|
87 | + * 'replies'=> [ … ] |
|
88 | + * ], |
|
89 | + * … |
|
90 | + * ] |
|
91 | + * ] |
|
92 | + */ |
|
93 | + public function getTree($id, $limit = 0, $offset = 0); |
|
94 | 94 | |
95 | - /** |
|
96 | - * returns comments for a specific object (e.g. a file). |
|
97 | - * |
|
98 | - * The sort order is always newest to oldest. |
|
99 | - * |
|
100 | - * @param string $objectType the object type, e.g. 'files' |
|
101 | - * @param string $objectId the id of the object |
|
102 | - * @param int $limit optional, number of maximum comments to be returned. if |
|
103 | - * not specified, all comments are returned. |
|
104 | - * @param int $offset optional, starting point |
|
105 | - * @param \DateTime $notOlderThan optional, timestamp of the oldest comments |
|
106 | - * that may be returned |
|
107 | - * @return IComment[] |
|
108 | - * @since 9.0.0 |
|
109 | - */ |
|
110 | - public function getForObject( |
|
111 | - $objectType, |
|
112 | - $objectId, |
|
113 | - $limit = 0, |
|
114 | - $offset = 0, |
|
115 | - \DateTime $notOlderThan = null |
|
116 | - ); |
|
95 | + /** |
|
96 | + * returns comments for a specific object (e.g. a file). |
|
97 | + * |
|
98 | + * The sort order is always newest to oldest. |
|
99 | + * |
|
100 | + * @param string $objectType the object type, e.g. 'files' |
|
101 | + * @param string $objectId the id of the object |
|
102 | + * @param int $limit optional, number of maximum comments to be returned. if |
|
103 | + * not specified, all comments are returned. |
|
104 | + * @param int $offset optional, starting point |
|
105 | + * @param \DateTime $notOlderThan optional, timestamp of the oldest comments |
|
106 | + * that may be returned |
|
107 | + * @return IComment[] |
|
108 | + * @since 9.0.0 |
|
109 | + */ |
|
110 | + public function getForObject( |
|
111 | + $objectType, |
|
112 | + $objectId, |
|
113 | + $limit = 0, |
|
114 | + $offset = 0, |
|
115 | + \DateTime $notOlderThan = null |
|
116 | + ); |
|
117 | 117 | |
118 | - /** |
|
119 | - * @param $objectType string the object type, e.g. 'files' |
|
120 | - * @param $objectId string the id of the object |
|
121 | - * @param \DateTime $notOlderThan optional, timestamp of the oldest comments |
|
122 | - * that may be returned |
|
123 | - * @return Int |
|
124 | - * @since 9.0.0 |
|
125 | - */ |
|
126 | - public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null); |
|
118 | + /** |
|
119 | + * @param $objectType string the object type, e.g. 'files' |
|
120 | + * @param $objectId string the id of the object |
|
121 | + * @param \DateTime $notOlderThan optional, timestamp of the oldest comments |
|
122 | + * that may be returned |
|
123 | + * @return Int |
|
124 | + * @since 9.0.0 |
|
125 | + */ |
|
126 | + public function getNumberOfCommentsForObject($objectType, $objectId, \DateTime $notOlderThan = null); |
|
127 | 127 | |
128 | - /** |
|
129 | - * creates a new comment and returns it. At this point of time, it is not |
|
130 | - * saved in the used data storage. Use save() after setting other fields |
|
131 | - * of the comment (e.g. message or verb). |
|
132 | - * |
|
133 | - * @param string $actorType the actor type (e.g. 'users') |
|
134 | - * @param string $actorId a user id |
|
135 | - * @param string $objectType the object type the comment is attached to |
|
136 | - * @param string $objectId the object id the comment is attached to |
|
137 | - * @return IComment |
|
138 | - * @since 9.0.0 |
|
139 | - */ |
|
140 | - public function create($actorType, $actorId, $objectType, $objectId); |
|
128 | + /** |
|
129 | + * creates a new comment and returns it. At this point of time, it is not |
|
130 | + * saved in the used data storage. Use save() after setting other fields |
|
131 | + * of the comment (e.g. message or verb). |
|
132 | + * |
|
133 | + * @param string $actorType the actor type (e.g. 'users') |
|
134 | + * @param string $actorId a user id |
|
135 | + * @param string $objectType the object type the comment is attached to |
|
136 | + * @param string $objectId the object id the comment is attached to |
|
137 | + * @return IComment |
|
138 | + * @since 9.0.0 |
|
139 | + */ |
|
140 | + public function create($actorType, $actorId, $objectType, $objectId); |
|
141 | 141 | |
142 | - /** |
|
143 | - * permanently deletes the comment specified by the ID |
|
144 | - * |
|
145 | - * When the comment has child comments, their parent ID will be changed to |
|
146 | - * the parent ID of the item that is to be deleted. |
|
147 | - * |
|
148 | - * @param string $id |
|
149 | - * @return bool |
|
150 | - * @since 9.0.0 |
|
151 | - */ |
|
152 | - public function delete($id); |
|
142 | + /** |
|
143 | + * permanently deletes the comment specified by the ID |
|
144 | + * |
|
145 | + * When the comment has child comments, their parent ID will be changed to |
|
146 | + * the parent ID of the item that is to be deleted. |
|
147 | + * |
|
148 | + * @param string $id |
|
149 | + * @return bool |
|
150 | + * @since 9.0.0 |
|
151 | + */ |
|
152 | + public function delete($id); |
|
153 | 153 | |
154 | - /** |
|
155 | - * saves the comment permanently |
|
156 | - * |
|
157 | - * if the supplied comment has an empty ID, a new entry comment will be |
|
158 | - * saved and the instance updated with the new ID. |
|
159 | - * |
|
160 | - * Otherwise, an existing comment will be updated. |
|
161 | - * |
|
162 | - * Throws NotFoundException when a comment that is to be updated does not |
|
163 | - * exist anymore at this point of time. |
|
164 | - * |
|
165 | - * @param IComment $comment |
|
166 | - * @return bool |
|
167 | - * @throws NotFoundException |
|
168 | - * @since 9.0.0 |
|
169 | - */ |
|
170 | - public function save(IComment $comment); |
|
154 | + /** |
|
155 | + * saves the comment permanently |
|
156 | + * |
|
157 | + * if the supplied comment has an empty ID, a new entry comment will be |
|
158 | + * saved and the instance updated with the new ID. |
|
159 | + * |
|
160 | + * Otherwise, an existing comment will be updated. |
|
161 | + * |
|
162 | + * Throws NotFoundException when a comment that is to be updated does not |
|
163 | + * exist anymore at this point of time. |
|
164 | + * |
|
165 | + * @param IComment $comment |
|
166 | + * @return bool |
|
167 | + * @throws NotFoundException |
|
168 | + * @since 9.0.0 |
|
169 | + */ |
|
170 | + public function save(IComment $comment); |
|
171 | 171 | |
172 | - /** |
|
173 | - * removes references to specific actor (e.g. on user delete) of a comment. |
|
174 | - * The comment itself must not get lost/deleted. |
|
175 | - * |
|
176 | - * A 'users' type actor (type and id) should get replaced by the |
|
177 | - * value of the DELETED_USER constant of this interface. |
|
178 | - * |
|
179 | - * @param string $actorType the actor type (e.g. 'users') |
|
180 | - * @param string $actorId a user id |
|
181 | - * @return boolean |
|
182 | - * @since 9.0.0 |
|
183 | - */ |
|
184 | - public function deleteReferencesOfActor($actorType, $actorId); |
|
172 | + /** |
|
173 | + * removes references to specific actor (e.g. on user delete) of a comment. |
|
174 | + * The comment itself must not get lost/deleted. |
|
175 | + * |
|
176 | + * A 'users' type actor (type and id) should get replaced by the |
|
177 | + * value of the DELETED_USER constant of this interface. |
|
178 | + * |
|
179 | + * @param string $actorType the actor type (e.g. 'users') |
|
180 | + * @param string $actorId a user id |
|
181 | + * @return boolean |
|
182 | + * @since 9.0.0 |
|
183 | + */ |
|
184 | + public function deleteReferencesOfActor($actorType, $actorId); |
|
185 | 185 | |
186 | - /** |
|
187 | - * deletes all comments made of a specific object (e.g. on file delete) |
|
188 | - * |
|
189 | - * @param string $objectType the object type (e.g. 'files') |
|
190 | - * @param string $objectId e.g. the file id |
|
191 | - * @return boolean |
|
192 | - * @since 9.0.0 |
|
193 | - */ |
|
194 | - public function deleteCommentsAtObject($objectType, $objectId); |
|
186 | + /** |
|
187 | + * deletes all comments made of a specific object (e.g. on file delete) |
|
188 | + * |
|
189 | + * @param string $objectType the object type (e.g. 'files') |
|
190 | + * @param string $objectId e.g. the file id |
|
191 | + * @return boolean |
|
192 | + * @since 9.0.0 |
|
193 | + */ |
|
194 | + public function deleteCommentsAtObject($objectType, $objectId); |
|
195 | 195 | |
196 | - /** |
|
197 | - * sets the read marker for a given file to the specified date for the |
|
198 | - * provided user |
|
199 | - * |
|
200 | - * @param string $objectType |
|
201 | - * @param string $objectId |
|
202 | - * @param \DateTime $dateTime |
|
203 | - * @param \OCP\IUser $user |
|
204 | - * @since 9.0.0 |
|
205 | - */ |
|
206 | - public function setReadMark($objectType, $objectId, \DateTime $dateTime, \OCP\IUser $user); |
|
196 | + /** |
|
197 | + * sets the read marker for a given file to the specified date for the |
|
198 | + * provided user |
|
199 | + * |
|
200 | + * @param string $objectType |
|
201 | + * @param string $objectId |
|
202 | + * @param \DateTime $dateTime |
|
203 | + * @param \OCP\IUser $user |
|
204 | + * @since 9.0.0 |
|
205 | + */ |
|
206 | + public function setReadMark($objectType, $objectId, \DateTime $dateTime, \OCP\IUser $user); |
|
207 | 207 | |
208 | - /** |
|
209 | - * returns the read marker for a given file to the specified date for the |
|
210 | - * provided user. It returns null, when the marker is not present, i.e. |
|
211 | - * no comments were marked as read. |
|
212 | - * |
|
213 | - * @param string $objectType |
|
214 | - * @param string $objectId |
|
215 | - * @param \OCP\IUser $user |
|
216 | - * @return \DateTime|null |
|
217 | - * @since 9.0.0 |
|
218 | - */ |
|
219 | - public function getReadMark($objectType, $objectId, \OCP\IUser $user); |
|
208 | + /** |
|
209 | + * returns the read marker for a given file to the specified date for the |
|
210 | + * provided user. It returns null, when the marker is not present, i.e. |
|
211 | + * no comments were marked as read. |
|
212 | + * |
|
213 | + * @param string $objectType |
|
214 | + * @param string $objectId |
|
215 | + * @param \OCP\IUser $user |
|
216 | + * @return \DateTime|null |
|
217 | + * @since 9.0.0 |
|
218 | + */ |
|
219 | + public function getReadMark($objectType, $objectId, \OCP\IUser $user); |
|
220 | 220 | |
221 | - /** |
|
222 | - * deletes the read markers for the specified user |
|
223 | - * |
|
224 | - * @param \OCP\IUser $user |
|
225 | - * @return bool |
|
226 | - * @since 9.0.0 |
|
227 | - */ |
|
228 | - public function deleteReadMarksFromUser(\OCP\IUser $user); |
|
221 | + /** |
|
222 | + * deletes the read markers for the specified user |
|
223 | + * |
|
224 | + * @param \OCP\IUser $user |
|
225 | + * @return bool |
|
226 | + * @since 9.0.0 |
|
227 | + */ |
|
228 | + public function deleteReadMarksFromUser(\OCP\IUser $user); |
|
229 | 229 | |
230 | - /** |
|
231 | - * deletes the read markers on the specified object |
|
232 | - * |
|
233 | - * @param string $objectType |
|
234 | - * @param string $objectId |
|
235 | - * @return bool |
|
236 | - * @since 9.0.0 |
|
237 | - */ |
|
238 | - public function deleteReadMarksOnObject($objectType, $objectId); |
|
230 | + /** |
|
231 | + * deletes the read markers on the specified object |
|
232 | + * |
|
233 | + * @param string $objectType |
|
234 | + * @param string $objectId |
|
235 | + * @return bool |
|
236 | + * @since 9.0.0 |
|
237 | + */ |
|
238 | + public function deleteReadMarksOnObject($objectType, $objectId); |
|
239 | 239 | |
240 | - /** |
|
241 | - * registers an Entity to the manager, so event notifications can be send |
|
242 | - * to consumers of the comments infrastructure |
|
243 | - * |
|
244 | - * @param \Closure $closure |
|
245 | - * @since 11.0.0 |
|
246 | - */ |
|
247 | - public function registerEventHandler(\Closure $closure); |
|
240 | + /** |
|
241 | + * registers an Entity to the manager, so event notifications can be send |
|
242 | + * to consumers of the comments infrastructure |
|
243 | + * |
|
244 | + * @param \Closure $closure |
|
245 | + * @since 11.0.0 |
|
246 | + */ |
|
247 | + public function registerEventHandler(\Closure $closure); |
|
248 | 248 | |
249 | - /** |
|
250 | - * registers a method that resolves an ID to a display name for a given type |
|
251 | - * |
|
252 | - * @param string $type |
|
253 | - * @param \Closure $closure |
|
254 | - * @throws \OutOfBoundsException |
|
255 | - * @since 11.0.0 |
|
256 | - * |
|
257 | - * Only one resolver shall be registered per type. Otherwise a |
|
258 | - * \OutOfBoundsException has to thrown. |
|
259 | - */ |
|
260 | - public function registerDisplayNameResolver($type, \Closure $closure); |
|
249 | + /** |
|
250 | + * registers a method that resolves an ID to a display name for a given type |
|
251 | + * |
|
252 | + * @param string $type |
|
253 | + * @param \Closure $closure |
|
254 | + * @throws \OutOfBoundsException |
|
255 | + * @since 11.0.0 |
|
256 | + * |
|
257 | + * Only one resolver shall be registered per type. Otherwise a |
|
258 | + * \OutOfBoundsException has to thrown. |
|
259 | + */ |
|
260 | + public function registerDisplayNameResolver($type, \Closure $closure); |
|
261 | 261 | |
262 | - /** |
|
263 | - * resolves a given ID of a given Type to a display name. |
|
264 | - * |
|
265 | - * @param string $type |
|
266 | - * @param string $id |
|
267 | - * @return string |
|
268 | - * @throws \OutOfBoundsException |
|
269 | - * @since 11.0.0 |
|
270 | - * |
|
271 | - * If a provided type was not registered, an \OutOfBoundsException shall |
|
272 | - * be thrown. It is upon the resolver discretion what to return of the |
|
273 | - * provided ID is unknown. It must be ensured that a string is returned. |
|
274 | - */ |
|
275 | - public function resolveDisplayName($type, $id); |
|
262 | + /** |
|
263 | + * resolves a given ID of a given Type to a display name. |
|
264 | + * |
|
265 | + * @param string $type |
|
266 | + * @param string $id |
|
267 | + * @return string |
|
268 | + * @throws \OutOfBoundsException |
|
269 | + * @since 11.0.0 |
|
270 | + * |
|
271 | + * If a provided type was not registered, an \OutOfBoundsException shall |
|
272 | + * be thrown. It is upon the resolver discretion what to return of the |
|
273 | + * provided ID is unknown. It must be ensured that a string is returned. |
|
274 | + */ |
|
275 | + public function resolveDisplayName($type, $id); |
|
276 | 276 | |
277 | 277 | } |