Passed
Push — master ( 5fdeac...5cef89 )
by Roeland
19:23 queued 08:48
created
lib/public/IServerContainer.php 1 patch
Indentation   +531 added lines, -531 removed lines patch added patch discarded remove patch
@@ -60,535 +60,535 @@
 block discarded – undo
60 60
  */
61 61
 interface IServerContainer extends IContainer {
62 62
 
63
-	/**
64
-	 * The calendar manager will act as a broker between consumers for calendar information and
65
-	 * providers which actual deliver the calendar information.
66
-	 *
67
-	 * @return \OCP\Calendar\IManager
68
-	 * @since 13.0.0
69
-	 */
70
-	public function getCalendarManager();
71
-
72
-	/**
73
-	 * The calendar resource backend manager will act as a broker between consumers
74
-	 * for calendar resource information an providers which actual deliver the room information.
75
-	 *
76
-	 * @return \OCP\Calendar\Resource\IBackend
77
-	 * @since 14.0.0
78
-	 */
79
-	public function getCalendarResourceBackendManager();
80
-
81
-	/**
82
-	 * The calendar room backend manager will act as a broker between consumers
83
-	 * for calendar room information an providers which actual deliver the room information.
84
-	 *
85
-	 * @return \OCP\Calendar\Room\IBackend
86
-	 * @since 14.0.0
87
-	 */
88
-	public function getCalendarRoomBackendManager();
89
-
90
-	/**
91
-	 * The contacts manager will act as a broker between consumers for contacts information and
92
-	 * providers which actual deliver the contact information.
93
-	 *
94
-	 * @return \OCP\Contacts\IManager
95
-	 * @since 6.0.0
96
-	 */
97
-	public function getContactsManager();
98
-
99
-	/**
100
-	 * The current request object holding all information about the request currently being processed
101
-	 * is returned from this method.
102
-	 * In case the current execution was not initiated by a web request null is returned
103
-	 *
104
-	 * @return \OCP\IRequest
105
-	 * @since 6.0.0
106
-	 */
107
-	public function getRequest();
108
-
109
-	/**
110
-	 * Returns the preview manager which can create preview images for a given file
111
-	 *
112
-	 * @return \OCP\IPreview
113
-	 * @since 6.0.0
114
-	 */
115
-	public function getPreviewManager();
116
-
117
-	/**
118
-	 * Returns the tag manager which can get and set tags for different object types
119
-	 *
120
-	 * @see \OCP\ITagManager::load()
121
-	 * @return \OCP\ITagManager
122
-	 * @since 6.0.0
123
-	 */
124
-	public function getTagManager();
125
-
126
-	/**
127
-	 * Returns the root folder of ownCloud's data directory
128
-	 *
129
-	 * @return \OCP\Files\IRootFolder
130
-	 * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
131
-	 */
132
-	public function getRootFolder();
133
-
134
-	/**
135
-	 * Returns a view to ownCloud's files folder
136
-	 *
137
-	 * @param string $userId user ID
138
-	 * @return \OCP\Files\Folder
139
-	 * @since 6.0.0 - parameter $userId was added in 8.0.0
140
-	 * @see getUserFolder in \OCP\Files\IRootFolder
141
-	 */
142
-	public function getUserFolder($userId = null);
143
-
144
-	/**
145
-	 * Returns an app-specific view in ownClouds data directory
146
-	 *
147
-	 * @return \OCP\Files\Folder
148
-	 * @since 6.0.0
149
-	 * @deprecated 9.2.0 use IAppData
150
-	 */
151
-	public function getAppFolder();
152
-
153
-	/**
154
-	 * Returns a user manager
155
-	 *
156
-	 * @return \OCP\IUserManager
157
-	 * @since 8.0.0
158
-	 */
159
-	public function getUserManager();
160
-
161
-	/**
162
-	 * Returns a group manager
163
-	 *
164
-	 * @return \OCP\IGroupManager
165
-	 * @since 8.0.0
166
-	 */
167
-	public function getGroupManager();
168
-
169
-	/**
170
-	 * Returns the user session
171
-	 *
172
-	 * @return \OCP\IUserSession
173
-	 * @since 6.0.0
174
-	 */
175
-	public function getUserSession();
176
-
177
-	/**
178
-	 * Returns the navigation manager
179
-	 *
180
-	 * @return \OCP\INavigationManager
181
-	 * @since 6.0.0
182
-	 */
183
-	public function getNavigationManager();
184
-
185
-	/**
186
-	 * Returns the config manager
187
-	 *
188
-	 * @return \OCP\IConfig
189
-	 * @since 6.0.0
190
-	 */
191
-	public function getConfig();
192
-
193
-	/**
194
-	 * Returns a Crypto instance
195
-	 *
196
-	 * @return \OCP\Security\ICrypto
197
-	 * @since 8.0.0
198
-	 */
199
-	public function getCrypto();
200
-
201
-	/**
202
-	 * Returns a Hasher instance
203
-	 *
204
-	 * @return \OCP\Security\IHasher
205
-	 * @since 8.0.0
206
-	 */
207
-	public function getHasher();
208
-
209
-	/**
210
-	 * Returns a SecureRandom instance
211
-	 *
212
-	 * @return \OCP\Security\ISecureRandom
213
-	 * @since 8.1.0
214
-	 */
215
-	public function getSecureRandom();
216
-
217
-	/**
218
-	 * Returns a CredentialsManager instance
219
-	 *
220
-	 * @return \OCP\Security\ICredentialsManager
221
-	 * @since 9.0.0
222
-	 */
223
-	public function getCredentialsManager();
224
-
225
-	/**
226
-	 * Returns the app config manager
227
-	 *
228
-	 * @return \OCP\IAppConfig
229
-	 * @since 7.0.0
230
-	 */
231
-	public function getAppConfig();
232
-
233
-	/**
234
-	 * @return \OCP\L10N\IFactory
235
-	 * @since 8.2.0
236
-	 */
237
-	public function getL10NFactory();
238
-
239
-	/**
240
-	 * get an L10N instance
241
-	 * @param string $app appid
242
-	 * @param string $lang
243
-	 * @return \OCP\IL10N
244
-	 * @since 6.0.0 - parameter $lang was added in 8.0.0
245
-	 */
246
-	public function getL10N($app, $lang = null);
247
-
248
-	/**
249
-	 * @return \OC\Encryption\Manager
250
-	 * @since 8.1.0
251
-	 */
252
-	public function getEncryptionManager();
253
-
254
-	/**
255
-	 * @return \OC\Encryption\File
256
-	 * @since 8.1.0
257
-	 */
258
-	public function getEncryptionFilesHelper();
259
-
260
-	/**
261
-	 * @return \OCP\Encryption\Keys\IStorage
262
-	 * @since 8.1.0
263
-	 */
264
-	public function getEncryptionKeyStorage();
265
-
266
-	/**
267
-	 * Returns the URL generator
268
-	 *
269
-	 * @return \OCP\IURLGenerator
270
-	 * @since 6.0.0
271
-	 */
272
-	public function getURLGenerator();
273
-
274
-	/**
275
-	 * Returns an ICache instance
276
-	 *
277
-	 * @return \OCP\ICache
278
-	 * @since 6.0.0
279
-	 */
280
-	public function getCache();
281
-
282
-	/**
283
-	 * Returns an \OCP\CacheFactory instance
284
-	 *
285
-	 * @return \OCP\ICacheFactory
286
-	 * @since 7.0.0
287
-	 */
288
-	public function getMemCacheFactory();
289
-
290
-	/**
291
-	 * Returns the current session
292
-	 *
293
-	 * @return \OCP\ISession
294
-	 * @since 6.0.0
295
-	 */
296
-	public function getSession();
297
-
298
-	/**
299
-	 * Returns the activity manager
300
-	 *
301
-	 * @return \OCP\Activity\IManager
302
-	 * @since 6.0.0
303
-	 */
304
-	public function getActivityManager();
305
-
306
-	/**
307
-	 * Returns the current session
308
-	 *
309
-	 * @return \OCP\IDBConnection
310
-	 * @since 6.0.0
311
-	 */
312
-	public function getDatabaseConnection();
313
-
314
-	/**
315
-	 * Returns an avatar manager, used for avatar functionality
316
-	 *
317
-	 * @return \OCP\IAvatarManager
318
-	 * @since 6.0.0
319
-	 */
320
-	public function getAvatarManager();
321
-
322
-	/**
323
-	 * Returns an job list for controlling background jobs
324
-	 *
325
-	 * @return \OCP\BackgroundJob\IJobList
326
-	 * @since 7.0.0
327
-	 */
328
-	public function getJobList();
329
-
330
-	/**
331
-	 * Returns a logger instance
332
-	 *
333
-	 * @return \OCP\ILogger
334
-	 * @since 8.0.0
335
-	 */
336
-	public function getLogger();
337
-
338
-	/**
339
-	 * returns a log factory instance
340
-	 *
341
-	 * @return ILogFactory
342
-	 * @since 14.0.0
343
-	 */
344
-	public function getLogFactory();
345
-
346
-	/**
347
-	 * Returns a router for generating and matching urls
348
-	 *
349
-	 * @return \OCP\Route\IRouter
350
-	 * @since 7.0.0
351
-	 */
352
-	public function getRouter();
353
-
354
-	/**
355
-	 * Returns a search instance
356
-	 *
357
-	 * @return \OCP\ISearch
358
-	 * @since 7.0.0
359
-	 */
360
-	public function getSearch();
361
-
362
-	/**
363
-	 * Get the certificate manager for the user
364
-	 *
365
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
366
-	 * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
367
-	 * @since 8.0.0
368
-	 */
369
-	public function getCertificateManager($userId = null);
370
-
371
-	/**
372
-	 * Create a new event source
373
-	 *
374
-	 * @return \OCP\IEventSource
375
-	 * @since 8.0.0
376
-	 */
377
-	public function createEventSource();
378
-
379
-	/**
380
-	 * Returns an instance of the HTTP client service
381
-	 *
382
-	 * @return \OCP\Http\Client\IClientService
383
-	 * @since 8.1.0
384
-	 */
385
-	public function getHTTPClientService();
386
-
387
-	/**
388
-	 * Get the active event logger
389
-	 *
390
-	 * @return \OCP\Diagnostics\IEventLogger
391
-	 * @since 8.0.0
392
-	 */
393
-	public function getEventLogger();
394
-
395
-	/**
396
-	 * Get the active query logger
397
-	 *
398
-	 * The returned logger only logs data when debug mode is enabled
399
-	 *
400
-	 * @return \OCP\Diagnostics\IQueryLogger
401
-	 * @since 8.0.0
402
-	 */
403
-	public function getQueryLogger();
404
-
405
-	/**
406
-	 * Get the manager for temporary files and folders
407
-	 *
408
-	 * @return \OCP\ITempManager
409
-	 * @since 8.0.0
410
-	 */
411
-	public function getTempManager();
412
-
413
-	/**
414
-	 * Get the app manager
415
-	 *
416
-	 * @return \OCP\App\IAppManager
417
-	 * @since 8.0.0
418
-	 */
419
-	public function getAppManager();
420
-
421
-	/**
422
-	 * Get the webroot
423
-	 *
424
-	 * @return string
425
-	 * @since 8.0.0
426
-	 */
427
-	public function getWebRoot();
428
-
429
-	/**
430
-	 * @return \OCP\Files\Config\IMountProviderCollection
431
-	 * @since 8.0.0
432
-	 */
433
-	public function getMountProviderCollection();
434
-
435
-	/**
436
-	 * Get the IniWrapper
437
-	 *
438
-	 * @return \bantu\IniGetWrapper\IniGetWrapper
439
-	 * @since 8.0.0
440
-	 */
441
-	public function getIniWrapper();
442
-	/**
443
-	 * @return \OCP\Command\IBus
444
-	 * @since 8.1.0
445
-	 */
446
-	public function getCommandBus();
447
-
448
-	/**
449
-	 * Creates a new mailer
450
-	 *
451
-	 * @return \OCP\Mail\IMailer
452
-	 * @since 8.1.0
453
-	 */
454
-	public function getMailer();
455
-
456
-	/**
457
-	 * Get the locking provider
458
-	 *
459
-	 * @return \OCP\Lock\ILockingProvider
460
-	 * @since 8.1.0
461
-	 */
462
-	public function getLockingProvider();
463
-
464
-	/**
465
-	 * @return \OCP\Files\Mount\IMountManager
466
-	 * @since 8.2.0
467
-	 */
468
-	public function getMountManager();
469
-
470
-	/**
471
-	 * Get the MimeTypeDetector
472
-	 *
473
-	 * @return \OCP\Files\IMimeTypeDetector
474
-	 * @since 8.2.0
475
-	 */
476
-	public function getMimeTypeDetector();
477
-
478
-	/**
479
-	 * Get the MimeTypeLoader
480
-	 *
481
-	 * @return \OCP\Files\IMimeTypeLoader
482
-	 * @since 8.2.0
483
-	 */
484
-	public function getMimeTypeLoader();
485
-
486
-	/**
487
-	 * Get the EventDispatcher
488
-	 *
489
-	 * @return EventDispatcherInterface
490
-	 * @since 8.2.0
491
-	 */
492
-	public function getEventDispatcher();
493
-
494
-	/**
495
-	 * Get the Notification Manager
496
-	 *
497
-	 * @return \OCP\Notification\IManager
498
-	 * @since 9.0.0
499
-	 */
500
-	public function getNotificationManager();
501
-
502
-	/**
503
-	 * @return \OCP\Comments\ICommentsManager
504
-	 * @since 9.0.0
505
-	 */
506
-	public function getCommentsManager();
507
-
508
-	/**
509
-	 * Returns the system-tag manager
510
-	 *
511
-	 * @return \OCP\SystemTag\ISystemTagManager
512
-	 *
513
-	 * @since 9.0.0
514
-	 */
515
-	public function getSystemTagManager();
516
-
517
-	/**
518
-	 * Returns the system-tag object mapper
519
-	 *
520
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
521
-	 *
522
-	 * @since 9.0.0
523
-	 */
524
-	public function getSystemTagObjectMapper();
525
-
526
-	/**
527
-	 * Returns the share manager
528
-	 *
529
-	 * @return \OCP\Share\IManager
530
-	 * @since 9.0.0
531
-	 */
532
-	public function getShareManager();
533
-
534
-	/**
535
-	 * @return IContentSecurityPolicyManager
536
-	 * @since 9.0.0
537
-	 * @deprecated 17.0.0 Use the AddContentSecurityPolicyEvent
538
-	 */
539
-	public function getContentSecurityPolicyManager();
540
-
541
-	/**
542
-	 * @return \OCP\IDateTimeZone
543
-	 * @since 8.0.0
544
-	 */
545
-	public function getDateTimeZone();
546
-
547
-	/**
548
-	 * @return \OCP\IDateTimeFormatter
549
-	 * @since 8.0.0
550
-	 */
551
-	public function getDateTimeFormatter();
552
-
553
-	/**
554
-	 * @return \OCP\Federation\ICloudIdManager
555
-	 * @since 12.0.0
556
-	 */
557
-	public function getCloudIdManager();
558
-
559
-	/**
560
-	 * @return \OCP\GlobalScale\IConfig
561
-	 * @since 14.0.0
562
-	 */
563
-	public function getGlobalScaleConfig();
564
-
565
-	/**
566
-	 * @return ICloudFederationFactory
567
-	 * @since 14.0.0
568
-	 */
569
-	public function getCloudFederationFactory();
570
-
571
-	/**
572
-	 * @return ICloudFederationProviderManager
573
-	 * @since 14.0.0
574
-	 */
575
-	public function getCloudFederationProviderManager();
576
-
577
-	/**
578
-	 * @return \OCP\Remote\Api\IApiFactory
579
-	 * @since 13.0.0
580
-	 */
581
-	public function getRemoteApiFactory();
582
-
583
-	/**
584
-	 * @return \OCP\Remote\IInstanceFactory
585
-	 * @since 13.0.0
586
-	 */
587
-	public function getRemoteInstanceFactory();
588
-
589
-	/**
590
-	 * @return \OCP\Files\Storage\IStorageFactory
591
-	 * @since 15.0.0
592
-	 */
593
-	public function getStorageFactory();
63
+    /**
64
+     * The calendar manager will act as a broker between consumers for calendar information and
65
+     * providers which actual deliver the calendar information.
66
+     *
67
+     * @return \OCP\Calendar\IManager
68
+     * @since 13.0.0
69
+     */
70
+    public function getCalendarManager();
71
+
72
+    /**
73
+     * The calendar resource backend manager will act as a broker between consumers
74
+     * for calendar resource information an providers which actual deliver the room information.
75
+     *
76
+     * @return \OCP\Calendar\Resource\IBackend
77
+     * @since 14.0.0
78
+     */
79
+    public function getCalendarResourceBackendManager();
80
+
81
+    /**
82
+     * The calendar room backend manager will act as a broker between consumers
83
+     * for calendar room information an providers which actual deliver the room information.
84
+     *
85
+     * @return \OCP\Calendar\Room\IBackend
86
+     * @since 14.0.0
87
+     */
88
+    public function getCalendarRoomBackendManager();
89
+
90
+    /**
91
+     * The contacts manager will act as a broker between consumers for contacts information and
92
+     * providers which actual deliver the contact information.
93
+     *
94
+     * @return \OCP\Contacts\IManager
95
+     * @since 6.0.0
96
+     */
97
+    public function getContactsManager();
98
+
99
+    /**
100
+     * The current request object holding all information about the request currently being processed
101
+     * is returned from this method.
102
+     * In case the current execution was not initiated by a web request null is returned
103
+     *
104
+     * @return \OCP\IRequest
105
+     * @since 6.0.0
106
+     */
107
+    public function getRequest();
108
+
109
+    /**
110
+     * Returns the preview manager which can create preview images for a given file
111
+     *
112
+     * @return \OCP\IPreview
113
+     * @since 6.0.0
114
+     */
115
+    public function getPreviewManager();
116
+
117
+    /**
118
+     * Returns the tag manager which can get and set tags for different object types
119
+     *
120
+     * @see \OCP\ITagManager::load()
121
+     * @return \OCP\ITagManager
122
+     * @since 6.0.0
123
+     */
124
+    public function getTagManager();
125
+
126
+    /**
127
+     * Returns the root folder of ownCloud's data directory
128
+     *
129
+     * @return \OCP\Files\IRootFolder
130
+     * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
131
+     */
132
+    public function getRootFolder();
133
+
134
+    /**
135
+     * Returns a view to ownCloud's files folder
136
+     *
137
+     * @param string $userId user ID
138
+     * @return \OCP\Files\Folder
139
+     * @since 6.0.0 - parameter $userId was added in 8.0.0
140
+     * @see getUserFolder in \OCP\Files\IRootFolder
141
+     */
142
+    public function getUserFolder($userId = null);
143
+
144
+    /**
145
+     * Returns an app-specific view in ownClouds data directory
146
+     *
147
+     * @return \OCP\Files\Folder
148
+     * @since 6.0.0
149
+     * @deprecated 9.2.0 use IAppData
150
+     */
151
+    public function getAppFolder();
152
+
153
+    /**
154
+     * Returns a user manager
155
+     *
156
+     * @return \OCP\IUserManager
157
+     * @since 8.0.0
158
+     */
159
+    public function getUserManager();
160
+
161
+    /**
162
+     * Returns a group manager
163
+     *
164
+     * @return \OCP\IGroupManager
165
+     * @since 8.0.0
166
+     */
167
+    public function getGroupManager();
168
+
169
+    /**
170
+     * Returns the user session
171
+     *
172
+     * @return \OCP\IUserSession
173
+     * @since 6.0.0
174
+     */
175
+    public function getUserSession();
176
+
177
+    /**
178
+     * Returns the navigation manager
179
+     *
180
+     * @return \OCP\INavigationManager
181
+     * @since 6.0.0
182
+     */
183
+    public function getNavigationManager();
184
+
185
+    /**
186
+     * Returns the config manager
187
+     *
188
+     * @return \OCP\IConfig
189
+     * @since 6.0.0
190
+     */
191
+    public function getConfig();
192
+
193
+    /**
194
+     * Returns a Crypto instance
195
+     *
196
+     * @return \OCP\Security\ICrypto
197
+     * @since 8.0.0
198
+     */
199
+    public function getCrypto();
200
+
201
+    /**
202
+     * Returns a Hasher instance
203
+     *
204
+     * @return \OCP\Security\IHasher
205
+     * @since 8.0.0
206
+     */
207
+    public function getHasher();
208
+
209
+    /**
210
+     * Returns a SecureRandom instance
211
+     *
212
+     * @return \OCP\Security\ISecureRandom
213
+     * @since 8.1.0
214
+     */
215
+    public function getSecureRandom();
216
+
217
+    /**
218
+     * Returns a CredentialsManager instance
219
+     *
220
+     * @return \OCP\Security\ICredentialsManager
221
+     * @since 9.0.0
222
+     */
223
+    public function getCredentialsManager();
224
+
225
+    /**
226
+     * Returns the app config manager
227
+     *
228
+     * @return \OCP\IAppConfig
229
+     * @since 7.0.0
230
+     */
231
+    public function getAppConfig();
232
+
233
+    /**
234
+     * @return \OCP\L10N\IFactory
235
+     * @since 8.2.0
236
+     */
237
+    public function getL10NFactory();
238
+
239
+    /**
240
+     * get an L10N instance
241
+     * @param string $app appid
242
+     * @param string $lang
243
+     * @return \OCP\IL10N
244
+     * @since 6.0.0 - parameter $lang was added in 8.0.0
245
+     */
246
+    public function getL10N($app, $lang = null);
247
+
248
+    /**
249
+     * @return \OC\Encryption\Manager
250
+     * @since 8.1.0
251
+     */
252
+    public function getEncryptionManager();
253
+
254
+    /**
255
+     * @return \OC\Encryption\File
256
+     * @since 8.1.0
257
+     */
258
+    public function getEncryptionFilesHelper();
259
+
260
+    /**
261
+     * @return \OCP\Encryption\Keys\IStorage
262
+     * @since 8.1.0
263
+     */
264
+    public function getEncryptionKeyStorage();
265
+
266
+    /**
267
+     * Returns the URL generator
268
+     *
269
+     * @return \OCP\IURLGenerator
270
+     * @since 6.0.0
271
+     */
272
+    public function getURLGenerator();
273
+
274
+    /**
275
+     * Returns an ICache instance
276
+     *
277
+     * @return \OCP\ICache
278
+     * @since 6.0.0
279
+     */
280
+    public function getCache();
281
+
282
+    /**
283
+     * Returns an \OCP\CacheFactory instance
284
+     *
285
+     * @return \OCP\ICacheFactory
286
+     * @since 7.0.0
287
+     */
288
+    public function getMemCacheFactory();
289
+
290
+    /**
291
+     * Returns the current session
292
+     *
293
+     * @return \OCP\ISession
294
+     * @since 6.0.0
295
+     */
296
+    public function getSession();
297
+
298
+    /**
299
+     * Returns the activity manager
300
+     *
301
+     * @return \OCP\Activity\IManager
302
+     * @since 6.0.0
303
+     */
304
+    public function getActivityManager();
305
+
306
+    /**
307
+     * Returns the current session
308
+     *
309
+     * @return \OCP\IDBConnection
310
+     * @since 6.0.0
311
+     */
312
+    public function getDatabaseConnection();
313
+
314
+    /**
315
+     * Returns an avatar manager, used for avatar functionality
316
+     *
317
+     * @return \OCP\IAvatarManager
318
+     * @since 6.0.0
319
+     */
320
+    public function getAvatarManager();
321
+
322
+    /**
323
+     * Returns an job list for controlling background jobs
324
+     *
325
+     * @return \OCP\BackgroundJob\IJobList
326
+     * @since 7.0.0
327
+     */
328
+    public function getJobList();
329
+
330
+    /**
331
+     * Returns a logger instance
332
+     *
333
+     * @return \OCP\ILogger
334
+     * @since 8.0.0
335
+     */
336
+    public function getLogger();
337
+
338
+    /**
339
+     * returns a log factory instance
340
+     *
341
+     * @return ILogFactory
342
+     * @since 14.0.0
343
+     */
344
+    public function getLogFactory();
345
+
346
+    /**
347
+     * Returns a router for generating and matching urls
348
+     *
349
+     * @return \OCP\Route\IRouter
350
+     * @since 7.0.0
351
+     */
352
+    public function getRouter();
353
+
354
+    /**
355
+     * Returns a search instance
356
+     *
357
+     * @return \OCP\ISearch
358
+     * @since 7.0.0
359
+     */
360
+    public function getSearch();
361
+
362
+    /**
363
+     * Get the certificate manager for the user
364
+     *
365
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
366
+     * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
367
+     * @since 8.0.0
368
+     */
369
+    public function getCertificateManager($userId = null);
370
+
371
+    /**
372
+     * Create a new event source
373
+     *
374
+     * @return \OCP\IEventSource
375
+     * @since 8.0.0
376
+     */
377
+    public function createEventSource();
378
+
379
+    /**
380
+     * Returns an instance of the HTTP client service
381
+     *
382
+     * @return \OCP\Http\Client\IClientService
383
+     * @since 8.1.0
384
+     */
385
+    public function getHTTPClientService();
386
+
387
+    /**
388
+     * Get the active event logger
389
+     *
390
+     * @return \OCP\Diagnostics\IEventLogger
391
+     * @since 8.0.0
392
+     */
393
+    public function getEventLogger();
394
+
395
+    /**
396
+     * Get the active query logger
397
+     *
398
+     * The returned logger only logs data when debug mode is enabled
399
+     *
400
+     * @return \OCP\Diagnostics\IQueryLogger
401
+     * @since 8.0.0
402
+     */
403
+    public function getQueryLogger();
404
+
405
+    /**
406
+     * Get the manager for temporary files and folders
407
+     *
408
+     * @return \OCP\ITempManager
409
+     * @since 8.0.0
410
+     */
411
+    public function getTempManager();
412
+
413
+    /**
414
+     * Get the app manager
415
+     *
416
+     * @return \OCP\App\IAppManager
417
+     * @since 8.0.0
418
+     */
419
+    public function getAppManager();
420
+
421
+    /**
422
+     * Get the webroot
423
+     *
424
+     * @return string
425
+     * @since 8.0.0
426
+     */
427
+    public function getWebRoot();
428
+
429
+    /**
430
+     * @return \OCP\Files\Config\IMountProviderCollection
431
+     * @since 8.0.0
432
+     */
433
+    public function getMountProviderCollection();
434
+
435
+    /**
436
+     * Get the IniWrapper
437
+     *
438
+     * @return \bantu\IniGetWrapper\IniGetWrapper
439
+     * @since 8.0.0
440
+     */
441
+    public function getIniWrapper();
442
+    /**
443
+     * @return \OCP\Command\IBus
444
+     * @since 8.1.0
445
+     */
446
+    public function getCommandBus();
447
+
448
+    /**
449
+     * Creates a new mailer
450
+     *
451
+     * @return \OCP\Mail\IMailer
452
+     * @since 8.1.0
453
+     */
454
+    public function getMailer();
455
+
456
+    /**
457
+     * Get the locking provider
458
+     *
459
+     * @return \OCP\Lock\ILockingProvider
460
+     * @since 8.1.0
461
+     */
462
+    public function getLockingProvider();
463
+
464
+    /**
465
+     * @return \OCP\Files\Mount\IMountManager
466
+     * @since 8.2.0
467
+     */
468
+    public function getMountManager();
469
+
470
+    /**
471
+     * Get the MimeTypeDetector
472
+     *
473
+     * @return \OCP\Files\IMimeTypeDetector
474
+     * @since 8.2.0
475
+     */
476
+    public function getMimeTypeDetector();
477
+
478
+    /**
479
+     * Get the MimeTypeLoader
480
+     *
481
+     * @return \OCP\Files\IMimeTypeLoader
482
+     * @since 8.2.0
483
+     */
484
+    public function getMimeTypeLoader();
485
+
486
+    /**
487
+     * Get the EventDispatcher
488
+     *
489
+     * @return EventDispatcherInterface
490
+     * @since 8.2.0
491
+     */
492
+    public function getEventDispatcher();
493
+
494
+    /**
495
+     * Get the Notification Manager
496
+     *
497
+     * @return \OCP\Notification\IManager
498
+     * @since 9.0.0
499
+     */
500
+    public function getNotificationManager();
501
+
502
+    /**
503
+     * @return \OCP\Comments\ICommentsManager
504
+     * @since 9.0.0
505
+     */
506
+    public function getCommentsManager();
507
+
508
+    /**
509
+     * Returns the system-tag manager
510
+     *
511
+     * @return \OCP\SystemTag\ISystemTagManager
512
+     *
513
+     * @since 9.0.0
514
+     */
515
+    public function getSystemTagManager();
516
+
517
+    /**
518
+     * Returns the system-tag object mapper
519
+     *
520
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
521
+     *
522
+     * @since 9.0.0
523
+     */
524
+    public function getSystemTagObjectMapper();
525
+
526
+    /**
527
+     * Returns the share manager
528
+     *
529
+     * @return \OCP\Share\IManager
530
+     * @since 9.0.0
531
+     */
532
+    public function getShareManager();
533
+
534
+    /**
535
+     * @return IContentSecurityPolicyManager
536
+     * @since 9.0.0
537
+     * @deprecated 17.0.0 Use the AddContentSecurityPolicyEvent
538
+     */
539
+    public function getContentSecurityPolicyManager();
540
+
541
+    /**
542
+     * @return \OCP\IDateTimeZone
543
+     * @since 8.0.0
544
+     */
545
+    public function getDateTimeZone();
546
+
547
+    /**
548
+     * @return \OCP\IDateTimeFormatter
549
+     * @since 8.0.0
550
+     */
551
+    public function getDateTimeFormatter();
552
+
553
+    /**
554
+     * @return \OCP\Federation\ICloudIdManager
555
+     * @since 12.0.0
556
+     */
557
+    public function getCloudIdManager();
558
+
559
+    /**
560
+     * @return \OCP\GlobalScale\IConfig
561
+     * @since 14.0.0
562
+     */
563
+    public function getGlobalScaleConfig();
564
+
565
+    /**
566
+     * @return ICloudFederationFactory
567
+     * @since 14.0.0
568
+     */
569
+    public function getCloudFederationFactory();
570
+
571
+    /**
572
+     * @return ICloudFederationProviderManager
573
+     * @since 14.0.0
574
+     */
575
+    public function getCloudFederationProviderManager();
576
+
577
+    /**
578
+     * @return \OCP\Remote\Api\IApiFactory
579
+     * @since 13.0.0
580
+     */
581
+    public function getRemoteApiFactory();
582
+
583
+    /**
584
+     * @return \OCP\Remote\IInstanceFactory
585
+     * @since 13.0.0
586
+     */
587
+    public function getRemoteInstanceFactory();
588
+
589
+    /**
590
+     * @return \OCP\Files\Storage\IStorageFactory
591
+     * @since 15.0.0
592
+     */
593
+    public function getStorageFactory();
594 594
 }
Please login to merge, or discard this patch.
lib/public/Security/IContentSecurityPolicyManager.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -31,23 +31,23 @@
 block discarded – undo
31 31
  * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
32 32
  */
33 33
 interface IContentSecurityPolicyManager {
34
-	/**
35
-	 * Allows to inject something into the default content policy. This is for
36
-	 * example useful when you're injecting Javascript code into a view belonging
37
-	 * to another controller and cannot modify its Content-Security-Policy itself.
38
-	 * Note that the adjustment is only applied to applications that use AppFramework
39
-	 * controllers.
40
-	 *
41
-	 * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
42
-	 * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
43
-	 *
44
-	 * WARNING: Using this API incorrectly may make the instance more insecure.
45
-	 * Do think twice before adding whitelisting resources. Please do also note
46
-	 * that it is not possible to use the `disallowXYZ` functions.
47
-	 *
48
-	 * @param EmptyContentSecurityPolicy $policy
49
-	 * @since 9.0.0
50
-	 * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
51
-	 */
52
-	public function addDefaultPolicy(EmptyContentSecurityPolicy $policy);
34
+    /**
35
+     * Allows to inject something into the default content policy. This is for
36
+     * example useful when you're injecting Javascript code into a view belonging
37
+     * to another controller and cannot modify its Content-Security-Policy itself.
38
+     * Note that the adjustment is only applied to applications that use AppFramework
39
+     * controllers.
40
+     *
41
+     * To use this from your `app.php` use `\OC::$server->getContentSecurityPolicyManager()->addDefaultPolicy($policy)`,
42
+     * $policy has to be of type `\OCP\AppFramework\Http\ContentSecurityPolicy`.
43
+     *
44
+     * WARNING: Using this API incorrectly may make the instance more insecure.
45
+     * Do think twice before adding whitelisting resources. Please do also note
46
+     * that it is not possible to use the `disallowXYZ` functions.
47
+     *
48
+     * @param EmptyContentSecurityPolicy $policy
49
+     * @since 9.0.0
50
+     * @deprecated 17.0.0 listen to the AddContentSecurityPolicyEvent to add a policy
51
+     */
52
+    public function addDefaultPolicy(EmptyContentSecurityPolicy $policy);
53 53
 }
Please login to merge, or discard this patch.
lib/public/Security/CSP/AddContentSecurityPolicyEvent.php 1 patch
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -33,20 +33,20 @@
 block discarded – undo
33 33
  */
34 34
 class AddContentSecurityPolicyEvent extends Event {
35 35
 
36
-	/** @var ContentSecurityPolicyManager */
37
-	private $policyManager;
36
+    /** @var ContentSecurityPolicyManager */
37
+    private $policyManager;
38 38
 
39
-	/**
40
-	 * @since 17.0.0
41
-	 */
42
-	public function __construct(ContentSecurityPolicyManager $policyManager) {
43
-		$this->policyManager = $policyManager;
44
-	}
39
+    /**
40
+     * @since 17.0.0
41
+     */
42
+    public function __construct(ContentSecurityPolicyManager $policyManager) {
43
+        $this->policyManager = $policyManager;
44
+    }
45 45
 
46
-	/**
47
-	 * @since 17.0.0
48
-	 */
49
-	public function addPolicy(EmptyContentSecurityPolicy $csp): void {
50
-		$this->policyManager->addDefaultPolicy($csp);
51
-	}
46
+    /**
47
+     * @since 17.0.0
48
+     */
49
+    public function addPolicy(EmptyContentSecurityPolicy $csp): void {
50
+        $this->policyManager->addDefaultPolicy($csp);
51
+    }
52 52
 }
Please login to merge, or discard this patch.
lib/private/Server.php 2 patches
Indentation   +1898 added lines, -1898 removed lines patch added patch discarded remove patch
@@ -168,1907 +168,1907 @@
 block discarded – undo
168 168
  * TODO: hookup all manager classes
169 169
  */
170 170
 class Server extends ServerContainer implements IServerContainer {
171
-	/** @var string */
172
-	private $webRoot;
173
-
174
-	/**
175
-	 * @param string $webRoot
176
-	 * @param \OC\Config $config
177
-	 */
178
-	public function __construct($webRoot, \OC\Config $config) {
179
-		parent::__construct();
180
-		$this->webRoot = $webRoot;
181
-
182
-		// To find out if we are running from CLI or not
183
-		$this->registerParameter('isCLI', \OC::$CLI);
184
-
185
-		$this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) {
186
-			return $c;
187
-		});
188
-
189
-		$this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class);
190
-		$this->registerAlias('CalendarManager', \OC\Calendar\Manager::class);
191
-
192
-		$this->registerAlias(\OCP\Calendar\Resource\IManager::class, \OC\Calendar\Resource\Manager::class);
193
-		$this->registerAlias('CalendarResourceBackendManager', \OC\Calendar\Resource\Manager::class);
194
-
195
-		$this->registerAlias(\OCP\Calendar\Room\IManager::class, \OC\Calendar\Room\Manager::class);
196
-		$this->registerAlias('CalendarRoomBackendManager', \OC\Calendar\Room\Manager::class);
197
-
198
-		$this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
199
-		$this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
200
-
201
-		$this->registerAlias(IActionFactory::class, ActionFactory::class);
202
-
203
-
204
-		$this->registerService(\OCP\IPreview::class, function (Server $c) {
205
-			return new PreviewManager(
206
-				$c->getConfig(),
207
-				$c->getRootFolder(),
208
-				$c->getAppDataDir('preview'),
209
-				$c->getEventDispatcher(),
210
-				$c->getGeneratorHelper(),
211
-				$c->getSession()->get('user_id')
212
-			);
213
-		});
214
-		$this->registerAlias('PreviewManager', \OCP\IPreview::class);
215
-
216
-		$this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
217
-			return new \OC\Preview\Watcher(
218
-				$c->getAppDataDir('preview')
219
-			);
220
-		});
221
-
222
-		$this->registerService(\OCP\Encryption\IManager::class, function (Server $c) {
223
-			$view = new View();
224
-			$util = new Encryption\Util(
225
-				$view,
226
-				$c->getUserManager(),
227
-				$c->getGroupManager(),
228
-				$c->getConfig()
229
-			);
230
-			return new Encryption\Manager(
231
-				$c->getConfig(),
232
-				$c->getLogger(),
233
-				$c->getL10N('core'),
234
-				new View(),
235
-				$util,
236
-				new ArrayCache()
237
-			);
238
-		});
239
-		$this->registerAlias('EncryptionManager', \OCP\Encryption\IManager::class);
240
-
241
-		$this->registerService('EncryptionFileHelper', function (Server $c) {
242
-			$util = new Encryption\Util(
243
-				new View(),
244
-				$c->getUserManager(),
245
-				$c->getGroupManager(),
246
-				$c->getConfig()
247
-			);
248
-			return new Encryption\File(
249
-				$util,
250
-				$c->getRootFolder(),
251
-				$c->getShareManager()
252
-			);
253
-		});
254
-
255
-		$this->registerService('EncryptionKeyStorage', function (Server $c) {
256
-			$view = new View();
257
-			$util = new Encryption\Util(
258
-				$view,
259
-				$c->getUserManager(),
260
-				$c->getGroupManager(),
261
-				$c->getConfig()
262
-			);
263
-
264
-			return new Encryption\Keys\Storage($view, $util);
265
-		});
266
-		$this->registerService('TagMapper', function (Server $c) {
267
-			return new TagMapper($c->getDatabaseConnection());
268
-		});
269
-
270
-		$this->registerService(\OCP\ITagManager::class, function (Server $c) {
271
-			$tagMapper = $c->query('TagMapper');
272
-			return new TagManager($tagMapper, $c->getUserSession());
273
-		});
274
-		$this->registerAlias('TagManager', \OCP\ITagManager::class);
275
-
276
-		$this->registerService('SystemTagManagerFactory', function (Server $c) {
277
-			$config = $c->getConfig();
278
-			$factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
279
-			return new $factoryClass($this);
280
-		});
281
-		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
282
-			return $c->query('SystemTagManagerFactory')->getManager();
283
-		});
284
-		$this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
285
-
286
-		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
287
-			return $c->query('SystemTagManagerFactory')->getObjectMapper();
288
-		});
289
-		$this->registerService('RootFolder', function (Server $c) {
290
-			$manager = \OC\Files\Filesystem::getMountManager(null);
291
-			$view = new View();
292
-			$root = new Root(
293
-				$manager,
294
-				$view,
295
-				null,
296
-				$c->getUserMountCache(),
297
-				$this->getLogger(),
298
-				$this->getUserManager()
299
-			);
300
-			$connector = new HookConnector($root, $view);
301
-			$connector->viewToNode();
302
-
303
-			$previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
304
-			$previewConnector->connectWatcher();
305
-
306
-			return $root;
307
-		});
308
-		$this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
309
-
310
-		$this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) {
311
-			return new LazyRoot(function () use ($c) {
312
-				return $c->query('RootFolder');
313
-			});
314
-		});
315
-		$this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
316
-
317
-		$this->registerService(\OC\User\Manager::class, function (Server $c) {
318
-			return new \OC\User\Manager($c->getConfig(), $c->getEventDispatcher());
319
-		});
320
-		$this->registerAlias('UserManager', \OC\User\Manager::class);
321
-		$this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
322
-
323
-		$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
324
-			$groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger());
325
-			$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
326
-				\OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
327
-			});
328
-			$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
329
-				\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
330
-			});
331
-			$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
332
-				\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
333
-			});
334
-			$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
335
-				\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
336
-			});
337
-			$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
338
-				\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
339
-			});
340
-			$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
341
-				\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
342
-				//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
343
-				\OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
344
-			});
345
-			return $groupManager;
346
-		});
347
-		$this->registerAlias('GroupManager', \OCP\IGroupManager::class);
348
-
349
-		$this->registerService(Store::class, function (Server $c) {
350
-			$session = $c->getSession();
351
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
352
-				$tokenProvider = $c->query(IProvider::class);
353
-			} else {
354
-				$tokenProvider = null;
355
-			}
356
-			$logger = $c->getLogger();
357
-			return new Store($session, $logger, $tokenProvider);
358
-		});
359
-		$this->registerAlias(IStore::class, Store::class);
360
-		$this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
361
-			$dbConnection = $c->getDatabaseConnection();
362
-			return new Authentication\Token\DefaultTokenMapper($dbConnection);
363
-		});
364
-		$this->registerAlias(IProvider::class, Authentication\Token\Manager::class);
365
-
366
-		$this->registerService(\OC\User\Session::class, function (Server $c) {
367
-			$manager = $c->getUserManager();
368
-			$session = new \OC\Session\Memory('');
369
-			$timeFactory = new TimeFactory();
370
-			// Token providers might require a working database. This code
371
-			// might however be called when ownCloud is not yet setup.
372
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
373
-				$defaultTokenProvider = $c->query(IProvider::class);
374
-			} else {
375
-				$defaultTokenProvider = null;
376
-			}
377
-
378
-			$dispatcher = $c->getEventDispatcher();
379
-
380
-			$userSession = new \OC\User\Session(
381
-				$manager,
382
-				$session,
383
-				$timeFactory,
384
-				$defaultTokenProvider,
385
-				$c->getConfig(),
386
-				$c->getSecureRandom(),
387
-				$c->getLockdownManager(),
388
-				$c->getLogger()
389
-			);
390
-			$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
391
-				\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
392
-			});
393
-			$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
394
-				/** @var $user \OC\User\User */
395
-				\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
396
-			});
397
-			$userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) {
398
-				/** @var $user \OC\User\User */
399
-				\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
400
-				$dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
401
-			});
402
-			$userSession->listen('\OC\User', 'postDelete', function ($user) {
403
-				/** @var $user \OC\User\User */
404
-				\OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
405
-			});
406
-			$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
407
-				/** @var $user \OC\User\User */
408
-				\OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
409
-			});
410
-			$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
411
-				/** @var $user \OC\User\User */
412
-				\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
413
-			});
414
-			$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
415
-				\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
416
-			});
417
-			$userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) {
418
-				/** @var $user \OC\User\User */
419
-				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin));
420
-			});
421
-			$userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
422
-				/** @var $user \OC\User\User */
423
-				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
424
-			});
425
-			$userSession->listen('\OC\User', 'logout', function () {
426
-				\OC_Hook::emit('OC_User', 'logout', array());
427
-			});
428
-			$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
429
-				/** @var $user \OC\User\User */
430
-				\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
431
-			});
432
-			return $userSession;
433
-		});
434
-		$this->registerAlias(\OCP\IUserSession::class, \OC\User\Session::class);
435
-		$this->registerAlias('UserSession', \OC\User\Session::class);
436
-
437
-		$this->registerAlias(\OCP\Authentication\TwoFactorAuth\IRegistry::class, \OC\Authentication\TwoFactorAuth\Registry::class);
438
-
439
-		$this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
440
-		$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
441
-
442
-		$this->registerService(\OC\AllConfig::class, function (Server $c) {
443
-			return new \OC\AllConfig(
444
-				$c->getSystemConfig()
445
-			);
446
-		});
447
-		$this->registerAlias('AllConfig', \OC\AllConfig::class);
448
-		$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
449
-
450
-		$this->registerService('SystemConfig', function ($c) use ($config) {
451
-			return new \OC\SystemConfig($config);
452
-		});
453
-
454
-		$this->registerService(\OC\AppConfig::class, function (Server $c) {
455
-			return new \OC\AppConfig($c->getDatabaseConnection());
456
-		});
457
-		$this->registerAlias('AppConfig', \OC\AppConfig::class);
458
-		$this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
459
-
460
-		$this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
461
-			return new \OC\L10N\Factory(
462
-				$c->getConfig(),
463
-				$c->getRequest(),
464
-				$c->getUserSession(),
465
-				\OC::$SERVERROOT
466
-			);
467
-		});
468
-		$this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
469
-
470
-		$this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
471
-			$config = $c->getConfig();
472
-			$cacheFactory = $c->getMemCacheFactory();
473
-			$request = $c->getRequest();
474
-			return new \OC\URLGenerator(
475
-				$config,
476
-				$cacheFactory,
477
-				$request
478
-			);
479
-		});
480
-		$this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
481
-
482
-		$this->registerAlias('AppFetcher', AppFetcher::class);
483
-		$this->registerAlias('CategoryFetcher', CategoryFetcher::class);
484
-
485
-		$this->registerService(\OCP\ICache::class, function ($c) {
486
-			return new Cache\File();
487
-		});
488
-		$this->registerAlias('UserCache', \OCP\ICache::class);
489
-
490
-		$this->registerService(Factory::class, function (Server $c) {
491
-
492
-			$arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
493
-				ArrayCache::class,
494
-				ArrayCache::class,
495
-				ArrayCache::class
496
-			);
497
-			$config = $c->getConfig();
498
-
499
-			if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
500
-				$v = \OC_App::getAppVersions();
501
-				$v['core'] = implode(',', \OC_Util::getVersion());
502
-				$version = implode(',', $v);
503
-				$instanceId = \OC_Util::getInstanceId();
504
-				$path = \OC::$SERVERROOT;
505
-				$prefix = md5($instanceId . '-' . $version . '-' . $path);
506
-				return new \OC\Memcache\Factory($prefix, $c->getLogger(),
507
-					$config->getSystemValue('memcache.local', null),
508
-					$config->getSystemValue('memcache.distributed', null),
509
-					$config->getSystemValue('memcache.locking', null)
510
-				);
511
-			}
512
-			return $arrayCacheFactory;
513
-
514
-		});
515
-		$this->registerAlias('MemCacheFactory', Factory::class);
516
-		$this->registerAlias(ICacheFactory::class, Factory::class);
517
-
518
-		$this->registerService('RedisFactory', function (Server $c) {
519
-			$systemConfig = $c->getSystemConfig();
520
-			return new RedisFactory($systemConfig);
521
-		});
522
-
523
-		$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
524
-			return new \OC\Activity\Manager(
525
-				$c->getRequest(),
526
-				$c->getUserSession(),
527
-				$c->getConfig(),
528
-				$c->query(IValidator::class)
529
-			);
530
-		});
531
-		$this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
532
-
533
-		$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
534
-			return new \OC\Activity\EventMerger(
535
-				$c->getL10N('lib')
536
-			);
537
-		});
538
-		$this->registerAlias(IValidator::class, Validator::class);
539
-
540
-		$this->registerService(AvatarManager::class, function(Server $c) {
541
-			return new AvatarManager(
542
-				$c->query(\OC\User\Manager::class),
543
-				$c->getAppDataDir('avatar'),
544
-				$c->getL10N('lib'),
545
-				$c->getLogger(),
546
-				$c->getConfig()
547
-			);
548
-		});
549
-		$this->registerAlias(\OCP\IAvatarManager::class, AvatarManager::class);
550
-		$this->registerAlias('AvatarManager', AvatarManager::class);
551
-
552
-		$this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
553
-		$this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class);
554
-
555
-		$this->registerService(\OC\Log::class, function (Server $c) {
556
-			$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
557
-			$factory = new LogFactory($c, $this->getSystemConfig());
558
-			$logger = $factory->get($logType);
559
-			$registry = $c->query(\OCP\Support\CrashReport\IRegistry::class);
560
-
561
-			return new Log($logger, $this->getSystemConfig(), null, $registry);
562
-		});
563
-		$this->registerAlias(\OCP\ILogger::class, \OC\Log::class);
564
-		$this->registerAlias('Logger', \OC\Log::class);
565
-
566
-		$this->registerService(ILogFactory::class, function (Server $c) {
567
-			return new LogFactory($c, $this->getSystemConfig());
568
-		});
569
-
570
-		$this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
571
-			$config = $c->getConfig();
572
-			return new \OC\BackgroundJob\JobList(
573
-				$c->getDatabaseConnection(),
574
-				$config,
575
-				new TimeFactory()
576
-			);
577
-		});
578
-		$this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
579
-
580
-		$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
581
-			$cacheFactory = $c->getMemCacheFactory();
582
-			$logger = $c->getLogger();
583
-			if ($cacheFactory->isLocalCacheAvailable()) {
584
-				$router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
585
-			} else {
586
-				$router = new \OC\Route\Router($logger);
587
-			}
588
-			return $router;
589
-		});
590
-		$this->registerAlias('Router', \OCP\Route\IRouter::class);
591
-
592
-		$this->registerService(\OCP\ISearch::class, function ($c) {
593
-			return new Search();
594
-		});
595
-		$this->registerAlias('Search', \OCP\ISearch::class);
596
-
597
-		$this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) {
598
-			return new \OC\Security\RateLimiting\Limiter(
599
-				$this->getUserSession(),
600
-				$this->getRequest(),
601
-				new \OC\AppFramework\Utility\TimeFactory(),
602
-				$c->query(\OC\Security\RateLimiting\Backend\IBackend::class)
603
-			);
604
-		});
605
-		$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
606
-			return new \OC\Security\RateLimiting\Backend\MemoryCache(
607
-				$this->getMemCacheFactory(),
608
-				new \OC\AppFramework\Utility\TimeFactory()
609
-			);
610
-		});
611
-
612
-		$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
613
-			return new SecureRandom();
614
-		});
615
-		$this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
616
-
617
-		$this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
618
-			return new Crypto($c->getConfig(), $c->getSecureRandom());
619
-		});
620
-		$this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
621
-
622
-		$this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
623
-			return new Hasher($c->getConfig());
624
-		});
625
-		$this->registerAlias('Hasher', \OCP\Security\IHasher::class);
626
-
627
-		$this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
628
-			return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
629
-		});
630
-		$this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
631
-
632
-		$this->registerService(IDBConnection::class, function (Server $c) {
633
-			$systemConfig = $c->getSystemConfig();
634
-			$factory = new \OC\DB\ConnectionFactory($systemConfig);
635
-			$type = $systemConfig->getValue('dbtype', 'sqlite');
636
-			if (!$factory->isValidType($type)) {
637
-				throw new \OC\DatabaseException('Invalid database type');
638
-			}
639
-			$connectionParams = $factory->createConnectionParams();
640
-			$connection = $factory->getConnection($type, $connectionParams);
641
-			$connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
642
-			return $connection;
643
-		});
644
-		$this->registerAlias('DatabaseConnection', IDBConnection::class);
645
-
646
-
647
-		$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
648
-			$user = \OC_User::getUser();
649
-			$uid = $user ? $user : null;
650
-			return new ClientService(
651
-				$c->getConfig(),
652
-				new \OC\Security\CertificateManager(
653
-					$uid,
654
-					new View(),
655
-					$c->getConfig(),
656
-					$c->getLogger(),
657
-					$c->getSecureRandom()
658
-				)
659
-			);
660
-		});
661
-		$this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
662
-		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
663
-			$eventLogger = new EventLogger();
664
-			if ($c->getSystemConfig()->getValue('debug', false)) {
665
-				// In debug mode, module is being activated by default
666
-				$eventLogger->activate();
667
-			}
668
-			return $eventLogger;
669
-		});
670
-		$this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
671
-
672
-		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
673
-			$queryLogger = new QueryLogger();
674
-			if ($c->getSystemConfig()->getValue('debug', false)) {
675
-				// In debug mode, module is being activated by default
676
-				$queryLogger->activate();
677
-			}
678
-			return $queryLogger;
679
-		});
680
-		$this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
681
-
682
-		$this->registerService(TempManager::class, function (Server $c) {
683
-			return new TempManager(
684
-				$c->getLogger(),
685
-				$c->getConfig()
686
-			);
687
-		});
688
-		$this->registerAlias('TempManager', TempManager::class);
689
-		$this->registerAlias(ITempManager::class, TempManager::class);
690
-
691
-		$this->registerService(AppManager::class, function (Server $c) {
692
-			return new \OC\App\AppManager(
693
-				$c->getUserSession(),
694
-				$c->query(\OC\AppConfig::class),
695
-				$c->getGroupManager(),
696
-				$c->getMemCacheFactory(),
697
-				$c->getEventDispatcher()
698
-			);
699
-		});
700
-		$this->registerAlias('AppManager', AppManager::class);
701
-		$this->registerAlias(IAppManager::class, AppManager::class);
702
-
703
-		$this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
704
-			return new DateTimeZone(
705
-				$c->getConfig(),
706
-				$c->getSession()
707
-			);
708
-		});
709
-		$this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
710
-
711
-		$this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
712
-			$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
713
-
714
-			return new DateTimeFormatter(
715
-				$c->getDateTimeZone()->getTimeZone(),
716
-				$c->getL10N('lib', $language)
717
-			);
718
-		});
719
-		$this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
720
-
721
-		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
722
-			$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
723
-			$listener = new UserMountCacheListener($mountCache);
724
-			$listener->listen($c->getUserManager());
725
-			return $mountCache;
726
-		});
727
-		$this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
728
-
729
-		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
730
-			$loader = \OC\Files\Filesystem::getLoader();
731
-			$mountCache = $c->query('UserMountCache');
732
-			$manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
733
-
734
-			// builtin providers
735
-
736
-			$config = $c->getConfig();
737
-			$manager->registerProvider(new CacheMountProvider($config));
738
-			$manager->registerHomeProvider(new LocalHomeMountProvider());
739
-			$manager->registerHomeProvider(new ObjectHomeMountProvider($config));
740
-
741
-			return $manager;
742
-		});
743
-		$this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
744
-
745
-		$this->registerService('IniWrapper', function ($c) {
746
-			return new IniGetWrapper();
747
-		});
748
-		$this->registerService('AsyncCommandBus', function (Server $c) {
749
-			$busClass = $c->getConfig()->getSystemValue('commandbus');
750
-			if ($busClass) {
751
-				list($app, $class) = explode('::', $busClass, 2);
752
-				if ($c->getAppManager()->isInstalled($app)) {
753
-					\OC_App::loadApp($app);
754
-					return $c->query($class);
755
-				} else {
756
-					throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled");
757
-				}
758
-			} else {
759
-				$jobList = $c->getJobList();
760
-				return new CronBus($jobList);
761
-			}
762
-		});
763
-		$this->registerService('TrustedDomainHelper', function ($c) {
764
-			return new TrustedDomainHelper($this->getConfig());
765
-		});
766
-		$this->registerService(Throttler::class, function (Server $c) {
767
-			return new Throttler(
768
-				$c->getDatabaseConnection(),
769
-				new TimeFactory(),
770
-				$c->getLogger(),
771
-				$c->getConfig()
772
-			);
773
-		});
774
-		$this->registerAlias('Throttler', Throttler::class);
775
-		$this->registerService('IntegrityCodeChecker', function (Server $c) {
776
-			// IConfig and IAppManager requires a working database. This code
777
-			// might however be called when ownCloud is not yet setup.
778
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
779
-				$config = $c->getConfig();
780
-				$appManager = $c->getAppManager();
781
-			} else {
782
-				$config = null;
783
-				$appManager = null;
784
-			}
785
-
786
-			return new Checker(
787
-				new EnvironmentHelper(),
788
-				new FileAccessHelper(),
789
-				new AppLocator(),
790
-				$config,
791
-				$c->getMemCacheFactory(),
792
-				$appManager,
793
-				$c->getTempManager(),
794
-				$c->getMimeTypeDetector()
795
-			);
796
-		});
797
-		$this->registerService(\OCP\IRequest::class, function ($c) {
798
-			if (isset($this['urlParams'])) {
799
-				$urlParams = $this['urlParams'];
800
-			} else {
801
-				$urlParams = [];
802
-			}
803
-
804
-			if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
805
-				&& in_array('fakeinput', stream_get_wrappers())
806
-			) {
807
-				$stream = 'fakeinput://data';
808
-			} else {
809
-				$stream = 'php://input';
810
-			}
811
-
812
-			return new Request(
813
-				[
814
-					'get' => $_GET,
815
-					'post' => $_POST,
816
-					'files' => $_FILES,
817
-					'server' => $_SERVER,
818
-					'env' => $_ENV,
819
-					'cookies' => $_COOKIE,
820
-					'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
821
-						? $_SERVER['REQUEST_METHOD']
822
-						: '',
823
-					'urlParams' => $urlParams,
824
-				],
825
-				$this->getSecureRandom(),
826
-				$this->getConfig(),
827
-				$this->getCsrfTokenManager(),
828
-				$stream
829
-			);
830
-		});
831
-		$this->registerAlias('Request', \OCP\IRequest::class);
832
-
833
-		$this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
834
-			return new Mailer(
835
-				$c->getConfig(),
836
-				$c->getLogger(),
837
-				$c->query(Defaults::class),
838
-				$c->getURLGenerator(),
839
-				$c->getL10N('lib')
840
-			);
841
-		});
842
-		$this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
843
-
844
-		$this->registerService('LDAPProvider', function (Server $c) {
845
-			$config = $c->getConfig();
846
-			$factoryClass = $config->getSystemValue('ldapProviderFactory', null);
847
-			if (is_null($factoryClass)) {
848
-				throw new \Exception('ldapProviderFactory not set');
849
-			}
850
-			/** @var \OCP\LDAP\ILDAPProviderFactory $factory */
851
-			$factory = new $factoryClass($this);
852
-			return $factory->getLDAPProvider();
853
-		});
854
-		$this->registerService(ILockingProvider::class, function (Server $c) {
855
-			$ini = $c->getIniWrapper();
856
-			$config = $c->getConfig();
857
-			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
858
-			if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
859
-				/** @var \OC\Memcache\Factory $memcacheFactory */
860
-				$memcacheFactory = $c->getMemCacheFactory();
861
-				$memcache = $memcacheFactory->createLocking('lock');
862
-				if (!($memcache instanceof \OC\Memcache\NullCache)) {
863
-					return new MemcacheLockingProvider($memcache, $ttl);
864
-				}
865
-				return new DBLockingProvider(
866
-					$c->getDatabaseConnection(),
867
-					$c->getLogger(),
868
-					new TimeFactory(),
869
-					$ttl,
870
-					!\OC::$CLI
871
-				);
872
-			}
873
-			return new NoopLockingProvider();
874
-		});
875
-		$this->registerAlias('LockingProvider', ILockingProvider::class);
876
-
877
-		$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
878
-			return new \OC\Files\Mount\Manager();
879
-		});
880
-		$this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
881
-
882
-		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
883
-			return new \OC\Files\Type\Detection(
884
-				$c->getURLGenerator(),
885
-				\OC::$configDir,
886
-				\OC::$SERVERROOT . '/resources/config/'
887
-			);
888
-		});
889
-		$this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
890
-
891
-		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
892
-			return new \OC\Files\Type\Loader(
893
-				$c->getDatabaseConnection()
894
-			);
895
-		});
896
-		$this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
897
-		$this->registerService(BundleFetcher::class, function () {
898
-			return new BundleFetcher($this->getL10N('lib'));
899
-		});
900
-		$this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
901
-			return new Manager(
902
-				$c->query(IValidator::class)
903
-			);
904
-		});
905
-		$this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
906
-
907
-		$this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
908
-			$manager = new \OC\CapabilitiesManager($c->getLogger());
909
-			$manager->registerCapability(function () use ($c) {
910
-				return new \OC\OCS\CoreCapabilities($c->getConfig());
911
-			});
912
-			$manager->registerCapability(function () use ($c) {
913
-				return $c->query(\OC\Security\Bruteforce\Capabilities::class);
914
-			});
915
-			return $manager;
916
-		});
917
-		$this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
918
-
919
-		$this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
920
-			$config = $c->getConfig();
921
-			$factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
922
-			/** @var \OCP\Comments\ICommentsManagerFactory $factory */
923
-			$factory = new $factoryClass($this);
924
-			$manager = $factory->getManager();
925
-
926
-			$manager->registerDisplayNameResolver('user', function($id) use ($c) {
927
-				$manager = $c->getUserManager();
928
-				$user = $manager->get($id);
929
-				if(is_null($user)) {
930
-					$l = $c->getL10N('core');
931
-					$displayName = $l->t('Unknown user');
932
-				} else {
933
-					$displayName = $user->getDisplayName();
934
-				}
935
-				return $displayName;
936
-			});
937
-
938
-			return $manager;
939
-		});
940
-		$this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
941
-
942
-		$this->registerService('ThemingDefaults', function (Server $c) {
943
-			/*
171
+    /** @var string */
172
+    private $webRoot;
173
+
174
+    /**
175
+     * @param string $webRoot
176
+     * @param \OC\Config $config
177
+     */
178
+    public function __construct($webRoot, \OC\Config $config) {
179
+        parent::__construct();
180
+        $this->webRoot = $webRoot;
181
+
182
+        // To find out if we are running from CLI or not
183
+        $this->registerParameter('isCLI', \OC::$CLI);
184
+
185
+        $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) {
186
+            return $c;
187
+        });
188
+
189
+        $this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class);
190
+        $this->registerAlias('CalendarManager', \OC\Calendar\Manager::class);
191
+
192
+        $this->registerAlias(\OCP\Calendar\Resource\IManager::class, \OC\Calendar\Resource\Manager::class);
193
+        $this->registerAlias('CalendarResourceBackendManager', \OC\Calendar\Resource\Manager::class);
194
+
195
+        $this->registerAlias(\OCP\Calendar\Room\IManager::class, \OC\Calendar\Room\Manager::class);
196
+        $this->registerAlias('CalendarRoomBackendManager', \OC\Calendar\Room\Manager::class);
197
+
198
+        $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
199
+        $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
200
+
201
+        $this->registerAlias(IActionFactory::class, ActionFactory::class);
202
+
203
+
204
+        $this->registerService(\OCP\IPreview::class, function (Server $c) {
205
+            return new PreviewManager(
206
+                $c->getConfig(),
207
+                $c->getRootFolder(),
208
+                $c->getAppDataDir('preview'),
209
+                $c->getEventDispatcher(),
210
+                $c->getGeneratorHelper(),
211
+                $c->getSession()->get('user_id')
212
+            );
213
+        });
214
+        $this->registerAlias('PreviewManager', \OCP\IPreview::class);
215
+
216
+        $this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
217
+            return new \OC\Preview\Watcher(
218
+                $c->getAppDataDir('preview')
219
+            );
220
+        });
221
+
222
+        $this->registerService(\OCP\Encryption\IManager::class, function (Server $c) {
223
+            $view = new View();
224
+            $util = new Encryption\Util(
225
+                $view,
226
+                $c->getUserManager(),
227
+                $c->getGroupManager(),
228
+                $c->getConfig()
229
+            );
230
+            return new Encryption\Manager(
231
+                $c->getConfig(),
232
+                $c->getLogger(),
233
+                $c->getL10N('core'),
234
+                new View(),
235
+                $util,
236
+                new ArrayCache()
237
+            );
238
+        });
239
+        $this->registerAlias('EncryptionManager', \OCP\Encryption\IManager::class);
240
+
241
+        $this->registerService('EncryptionFileHelper', function (Server $c) {
242
+            $util = new Encryption\Util(
243
+                new View(),
244
+                $c->getUserManager(),
245
+                $c->getGroupManager(),
246
+                $c->getConfig()
247
+            );
248
+            return new Encryption\File(
249
+                $util,
250
+                $c->getRootFolder(),
251
+                $c->getShareManager()
252
+            );
253
+        });
254
+
255
+        $this->registerService('EncryptionKeyStorage', function (Server $c) {
256
+            $view = new View();
257
+            $util = new Encryption\Util(
258
+                $view,
259
+                $c->getUserManager(),
260
+                $c->getGroupManager(),
261
+                $c->getConfig()
262
+            );
263
+
264
+            return new Encryption\Keys\Storage($view, $util);
265
+        });
266
+        $this->registerService('TagMapper', function (Server $c) {
267
+            return new TagMapper($c->getDatabaseConnection());
268
+        });
269
+
270
+        $this->registerService(\OCP\ITagManager::class, function (Server $c) {
271
+            $tagMapper = $c->query('TagMapper');
272
+            return new TagManager($tagMapper, $c->getUserSession());
273
+        });
274
+        $this->registerAlias('TagManager', \OCP\ITagManager::class);
275
+
276
+        $this->registerService('SystemTagManagerFactory', function (Server $c) {
277
+            $config = $c->getConfig();
278
+            $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
279
+            return new $factoryClass($this);
280
+        });
281
+        $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
282
+            return $c->query('SystemTagManagerFactory')->getManager();
283
+        });
284
+        $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
285
+
286
+        $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
287
+            return $c->query('SystemTagManagerFactory')->getObjectMapper();
288
+        });
289
+        $this->registerService('RootFolder', function (Server $c) {
290
+            $manager = \OC\Files\Filesystem::getMountManager(null);
291
+            $view = new View();
292
+            $root = new Root(
293
+                $manager,
294
+                $view,
295
+                null,
296
+                $c->getUserMountCache(),
297
+                $this->getLogger(),
298
+                $this->getUserManager()
299
+            );
300
+            $connector = new HookConnector($root, $view);
301
+            $connector->viewToNode();
302
+
303
+            $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
304
+            $previewConnector->connectWatcher();
305
+
306
+            return $root;
307
+        });
308
+        $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
309
+
310
+        $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) {
311
+            return new LazyRoot(function () use ($c) {
312
+                return $c->query('RootFolder');
313
+            });
314
+        });
315
+        $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
316
+
317
+        $this->registerService(\OC\User\Manager::class, function (Server $c) {
318
+            return new \OC\User\Manager($c->getConfig(), $c->getEventDispatcher());
319
+        });
320
+        $this->registerAlias('UserManager', \OC\User\Manager::class);
321
+        $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
322
+
323
+        $this->registerService(\OCP\IGroupManager::class, function (Server $c) {
324
+            $groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger());
325
+            $groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
326
+                \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
327
+            });
328
+            $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
329
+                \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
330
+            });
331
+            $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
332
+                \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
333
+            });
334
+            $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
335
+                \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
336
+            });
337
+            $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
338
+                \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
339
+            });
340
+            $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
341
+                \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
342
+                //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
343
+                \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
344
+            });
345
+            return $groupManager;
346
+        });
347
+        $this->registerAlias('GroupManager', \OCP\IGroupManager::class);
348
+
349
+        $this->registerService(Store::class, function (Server $c) {
350
+            $session = $c->getSession();
351
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
352
+                $tokenProvider = $c->query(IProvider::class);
353
+            } else {
354
+                $tokenProvider = null;
355
+            }
356
+            $logger = $c->getLogger();
357
+            return new Store($session, $logger, $tokenProvider);
358
+        });
359
+        $this->registerAlias(IStore::class, Store::class);
360
+        $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
361
+            $dbConnection = $c->getDatabaseConnection();
362
+            return new Authentication\Token\DefaultTokenMapper($dbConnection);
363
+        });
364
+        $this->registerAlias(IProvider::class, Authentication\Token\Manager::class);
365
+
366
+        $this->registerService(\OC\User\Session::class, function (Server $c) {
367
+            $manager = $c->getUserManager();
368
+            $session = new \OC\Session\Memory('');
369
+            $timeFactory = new TimeFactory();
370
+            // Token providers might require a working database. This code
371
+            // might however be called when ownCloud is not yet setup.
372
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
373
+                $defaultTokenProvider = $c->query(IProvider::class);
374
+            } else {
375
+                $defaultTokenProvider = null;
376
+            }
377
+
378
+            $dispatcher = $c->getEventDispatcher();
379
+
380
+            $userSession = new \OC\User\Session(
381
+                $manager,
382
+                $session,
383
+                $timeFactory,
384
+                $defaultTokenProvider,
385
+                $c->getConfig(),
386
+                $c->getSecureRandom(),
387
+                $c->getLockdownManager(),
388
+                $c->getLogger()
389
+            );
390
+            $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
391
+                \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
392
+            });
393
+            $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
394
+                /** @var $user \OC\User\User */
395
+                \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
396
+            });
397
+            $userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) {
398
+                /** @var $user \OC\User\User */
399
+                \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
400
+                $dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
401
+            });
402
+            $userSession->listen('\OC\User', 'postDelete', function ($user) {
403
+                /** @var $user \OC\User\User */
404
+                \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
405
+            });
406
+            $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
407
+                /** @var $user \OC\User\User */
408
+                \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
409
+            });
410
+            $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
411
+                /** @var $user \OC\User\User */
412
+                \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
413
+            });
414
+            $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
415
+                \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
416
+            });
417
+            $userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) {
418
+                /** @var $user \OC\User\User */
419
+                \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin));
420
+            });
421
+            $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
422
+                /** @var $user \OC\User\User */
423
+                \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
424
+            });
425
+            $userSession->listen('\OC\User', 'logout', function () {
426
+                \OC_Hook::emit('OC_User', 'logout', array());
427
+            });
428
+            $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
429
+                /** @var $user \OC\User\User */
430
+                \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
431
+            });
432
+            return $userSession;
433
+        });
434
+        $this->registerAlias(\OCP\IUserSession::class, \OC\User\Session::class);
435
+        $this->registerAlias('UserSession', \OC\User\Session::class);
436
+
437
+        $this->registerAlias(\OCP\Authentication\TwoFactorAuth\IRegistry::class, \OC\Authentication\TwoFactorAuth\Registry::class);
438
+
439
+        $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
440
+        $this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
441
+
442
+        $this->registerService(\OC\AllConfig::class, function (Server $c) {
443
+            return new \OC\AllConfig(
444
+                $c->getSystemConfig()
445
+            );
446
+        });
447
+        $this->registerAlias('AllConfig', \OC\AllConfig::class);
448
+        $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
449
+
450
+        $this->registerService('SystemConfig', function ($c) use ($config) {
451
+            return new \OC\SystemConfig($config);
452
+        });
453
+
454
+        $this->registerService(\OC\AppConfig::class, function (Server $c) {
455
+            return new \OC\AppConfig($c->getDatabaseConnection());
456
+        });
457
+        $this->registerAlias('AppConfig', \OC\AppConfig::class);
458
+        $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
459
+
460
+        $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
461
+            return new \OC\L10N\Factory(
462
+                $c->getConfig(),
463
+                $c->getRequest(),
464
+                $c->getUserSession(),
465
+                \OC::$SERVERROOT
466
+            );
467
+        });
468
+        $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
469
+
470
+        $this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
471
+            $config = $c->getConfig();
472
+            $cacheFactory = $c->getMemCacheFactory();
473
+            $request = $c->getRequest();
474
+            return new \OC\URLGenerator(
475
+                $config,
476
+                $cacheFactory,
477
+                $request
478
+            );
479
+        });
480
+        $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
481
+
482
+        $this->registerAlias('AppFetcher', AppFetcher::class);
483
+        $this->registerAlias('CategoryFetcher', CategoryFetcher::class);
484
+
485
+        $this->registerService(\OCP\ICache::class, function ($c) {
486
+            return new Cache\File();
487
+        });
488
+        $this->registerAlias('UserCache', \OCP\ICache::class);
489
+
490
+        $this->registerService(Factory::class, function (Server $c) {
491
+
492
+            $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
493
+                ArrayCache::class,
494
+                ArrayCache::class,
495
+                ArrayCache::class
496
+            );
497
+            $config = $c->getConfig();
498
+
499
+            if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
500
+                $v = \OC_App::getAppVersions();
501
+                $v['core'] = implode(',', \OC_Util::getVersion());
502
+                $version = implode(',', $v);
503
+                $instanceId = \OC_Util::getInstanceId();
504
+                $path = \OC::$SERVERROOT;
505
+                $prefix = md5($instanceId . '-' . $version . '-' . $path);
506
+                return new \OC\Memcache\Factory($prefix, $c->getLogger(),
507
+                    $config->getSystemValue('memcache.local', null),
508
+                    $config->getSystemValue('memcache.distributed', null),
509
+                    $config->getSystemValue('memcache.locking', null)
510
+                );
511
+            }
512
+            return $arrayCacheFactory;
513
+
514
+        });
515
+        $this->registerAlias('MemCacheFactory', Factory::class);
516
+        $this->registerAlias(ICacheFactory::class, Factory::class);
517
+
518
+        $this->registerService('RedisFactory', function (Server $c) {
519
+            $systemConfig = $c->getSystemConfig();
520
+            return new RedisFactory($systemConfig);
521
+        });
522
+
523
+        $this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
524
+            return new \OC\Activity\Manager(
525
+                $c->getRequest(),
526
+                $c->getUserSession(),
527
+                $c->getConfig(),
528
+                $c->query(IValidator::class)
529
+            );
530
+        });
531
+        $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
532
+
533
+        $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
534
+            return new \OC\Activity\EventMerger(
535
+                $c->getL10N('lib')
536
+            );
537
+        });
538
+        $this->registerAlias(IValidator::class, Validator::class);
539
+
540
+        $this->registerService(AvatarManager::class, function(Server $c) {
541
+            return new AvatarManager(
542
+                $c->query(\OC\User\Manager::class),
543
+                $c->getAppDataDir('avatar'),
544
+                $c->getL10N('lib'),
545
+                $c->getLogger(),
546
+                $c->getConfig()
547
+            );
548
+        });
549
+        $this->registerAlias(\OCP\IAvatarManager::class, AvatarManager::class);
550
+        $this->registerAlias('AvatarManager', AvatarManager::class);
551
+
552
+        $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
553
+        $this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class);
554
+
555
+        $this->registerService(\OC\Log::class, function (Server $c) {
556
+            $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
557
+            $factory = new LogFactory($c, $this->getSystemConfig());
558
+            $logger = $factory->get($logType);
559
+            $registry = $c->query(\OCP\Support\CrashReport\IRegistry::class);
560
+
561
+            return new Log($logger, $this->getSystemConfig(), null, $registry);
562
+        });
563
+        $this->registerAlias(\OCP\ILogger::class, \OC\Log::class);
564
+        $this->registerAlias('Logger', \OC\Log::class);
565
+
566
+        $this->registerService(ILogFactory::class, function (Server $c) {
567
+            return new LogFactory($c, $this->getSystemConfig());
568
+        });
569
+
570
+        $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
571
+            $config = $c->getConfig();
572
+            return new \OC\BackgroundJob\JobList(
573
+                $c->getDatabaseConnection(),
574
+                $config,
575
+                new TimeFactory()
576
+            );
577
+        });
578
+        $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
579
+
580
+        $this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
581
+            $cacheFactory = $c->getMemCacheFactory();
582
+            $logger = $c->getLogger();
583
+            if ($cacheFactory->isLocalCacheAvailable()) {
584
+                $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
585
+            } else {
586
+                $router = new \OC\Route\Router($logger);
587
+            }
588
+            return $router;
589
+        });
590
+        $this->registerAlias('Router', \OCP\Route\IRouter::class);
591
+
592
+        $this->registerService(\OCP\ISearch::class, function ($c) {
593
+            return new Search();
594
+        });
595
+        $this->registerAlias('Search', \OCP\ISearch::class);
596
+
597
+        $this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) {
598
+            return new \OC\Security\RateLimiting\Limiter(
599
+                $this->getUserSession(),
600
+                $this->getRequest(),
601
+                new \OC\AppFramework\Utility\TimeFactory(),
602
+                $c->query(\OC\Security\RateLimiting\Backend\IBackend::class)
603
+            );
604
+        });
605
+        $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
606
+            return new \OC\Security\RateLimiting\Backend\MemoryCache(
607
+                $this->getMemCacheFactory(),
608
+                new \OC\AppFramework\Utility\TimeFactory()
609
+            );
610
+        });
611
+
612
+        $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
613
+            return new SecureRandom();
614
+        });
615
+        $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
616
+
617
+        $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
618
+            return new Crypto($c->getConfig(), $c->getSecureRandom());
619
+        });
620
+        $this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
621
+
622
+        $this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
623
+            return new Hasher($c->getConfig());
624
+        });
625
+        $this->registerAlias('Hasher', \OCP\Security\IHasher::class);
626
+
627
+        $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
628
+            return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
629
+        });
630
+        $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
631
+
632
+        $this->registerService(IDBConnection::class, function (Server $c) {
633
+            $systemConfig = $c->getSystemConfig();
634
+            $factory = new \OC\DB\ConnectionFactory($systemConfig);
635
+            $type = $systemConfig->getValue('dbtype', 'sqlite');
636
+            if (!$factory->isValidType($type)) {
637
+                throw new \OC\DatabaseException('Invalid database type');
638
+            }
639
+            $connectionParams = $factory->createConnectionParams();
640
+            $connection = $factory->getConnection($type, $connectionParams);
641
+            $connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
642
+            return $connection;
643
+        });
644
+        $this->registerAlias('DatabaseConnection', IDBConnection::class);
645
+
646
+
647
+        $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
648
+            $user = \OC_User::getUser();
649
+            $uid = $user ? $user : null;
650
+            return new ClientService(
651
+                $c->getConfig(),
652
+                new \OC\Security\CertificateManager(
653
+                    $uid,
654
+                    new View(),
655
+                    $c->getConfig(),
656
+                    $c->getLogger(),
657
+                    $c->getSecureRandom()
658
+                )
659
+            );
660
+        });
661
+        $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
662
+        $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
663
+            $eventLogger = new EventLogger();
664
+            if ($c->getSystemConfig()->getValue('debug', false)) {
665
+                // In debug mode, module is being activated by default
666
+                $eventLogger->activate();
667
+            }
668
+            return $eventLogger;
669
+        });
670
+        $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
671
+
672
+        $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
673
+            $queryLogger = new QueryLogger();
674
+            if ($c->getSystemConfig()->getValue('debug', false)) {
675
+                // In debug mode, module is being activated by default
676
+                $queryLogger->activate();
677
+            }
678
+            return $queryLogger;
679
+        });
680
+        $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
681
+
682
+        $this->registerService(TempManager::class, function (Server $c) {
683
+            return new TempManager(
684
+                $c->getLogger(),
685
+                $c->getConfig()
686
+            );
687
+        });
688
+        $this->registerAlias('TempManager', TempManager::class);
689
+        $this->registerAlias(ITempManager::class, TempManager::class);
690
+
691
+        $this->registerService(AppManager::class, function (Server $c) {
692
+            return new \OC\App\AppManager(
693
+                $c->getUserSession(),
694
+                $c->query(\OC\AppConfig::class),
695
+                $c->getGroupManager(),
696
+                $c->getMemCacheFactory(),
697
+                $c->getEventDispatcher()
698
+            );
699
+        });
700
+        $this->registerAlias('AppManager', AppManager::class);
701
+        $this->registerAlias(IAppManager::class, AppManager::class);
702
+
703
+        $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
704
+            return new DateTimeZone(
705
+                $c->getConfig(),
706
+                $c->getSession()
707
+            );
708
+        });
709
+        $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
710
+
711
+        $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
712
+            $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
713
+
714
+            return new DateTimeFormatter(
715
+                $c->getDateTimeZone()->getTimeZone(),
716
+                $c->getL10N('lib', $language)
717
+            );
718
+        });
719
+        $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
720
+
721
+        $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
722
+            $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
723
+            $listener = new UserMountCacheListener($mountCache);
724
+            $listener->listen($c->getUserManager());
725
+            return $mountCache;
726
+        });
727
+        $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
728
+
729
+        $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
730
+            $loader = \OC\Files\Filesystem::getLoader();
731
+            $mountCache = $c->query('UserMountCache');
732
+            $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
733
+
734
+            // builtin providers
735
+
736
+            $config = $c->getConfig();
737
+            $manager->registerProvider(new CacheMountProvider($config));
738
+            $manager->registerHomeProvider(new LocalHomeMountProvider());
739
+            $manager->registerHomeProvider(new ObjectHomeMountProvider($config));
740
+
741
+            return $manager;
742
+        });
743
+        $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
744
+
745
+        $this->registerService('IniWrapper', function ($c) {
746
+            return new IniGetWrapper();
747
+        });
748
+        $this->registerService('AsyncCommandBus', function (Server $c) {
749
+            $busClass = $c->getConfig()->getSystemValue('commandbus');
750
+            if ($busClass) {
751
+                list($app, $class) = explode('::', $busClass, 2);
752
+                if ($c->getAppManager()->isInstalled($app)) {
753
+                    \OC_App::loadApp($app);
754
+                    return $c->query($class);
755
+                } else {
756
+                    throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled");
757
+                }
758
+            } else {
759
+                $jobList = $c->getJobList();
760
+                return new CronBus($jobList);
761
+            }
762
+        });
763
+        $this->registerService('TrustedDomainHelper', function ($c) {
764
+            return new TrustedDomainHelper($this->getConfig());
765
+        });
766
+        $this->registerService(Throttler::class, function (Server $c) {
767
+            return new Throttler(
768
+                $c->getDatabaseConnection(),
769
+                new TimeFactory(),
770
+                $c->getLogger(),
771
+                $c->getConfig()
772
+            );
773
+        });
774
+        $this->registerAlias('Throttler', Throttler::class);
775
+        $this->registerService('IntegrityCodeChecker', function (Server $c) {
776
+            // IConfig and IAppManager requires a working database. This code
777
+            // might however be called when ownCloud is not yet setup.
778
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
779
+                $config = $c->getConfig();
780
+                $appManager = $c->getAppManager();
781
+            } else {
782
+                $config = null;
783
+                $appManager = null;
784
+            }
785
+
786
+            return new Checker(
787
+                new EnvironmentHelper(),
788
+                new FileAccessHelper(),
789
+                new AppLocator(),
790
+                $config,
791
+                $c->getMemCacheFactory(),
792
+                $appManager,
793
+                $c->getTempManager(),
794
+                $c->getMimeTypeDetector()
795
+            );
796
+        });
797
+        $this->registerService(\OCP\IRequest::class, function ($c) {
798
+            if (isset($this['urlParams'])) {
799
+                $urlParams = $this['urlParams'];
800
+            } else {
801
+                $urlParams = [];
802
+            }
803
+
804
+            if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
805
+                && in_array('fakeinput', stream_get_wrappers())
806
+            ) {
807
+                $stream = 'fakeinput://data';
808
+            } else {
809
+                $stream = 'php://input';
810
+            }
811
+
812
+            return new Request(
813
+                [
814
+                    'get' => $_GET,
815
+                    'post' => $_POST,
816
+                    'files' => $_FILES,
817
+                    'server' => $_SERVER,
818
+                    'env' => $_ENV,
819
+                    'cookies' => $_COOKIE,
820
+                    'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
821
+                        ? $_SERVER['REQUEST_METHOD']
822
+                        : '',
823
+                    'urlParams' => $urlParams,
824
+                ],
825
+                $this->getSecureRandom(),
826
+                $this->getConfig(),
827
+                $this->getCsrfTokenManager(),
828
+                $stream
829
+            );
830
+        });
831
+        $this->registerAlias('Request', \OCP\IRequest::class);
832
+
833
+        $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
834
+            return new Mailer(
835
+                $c->getConfig(),
836
+                $c->getLogger(),
837
+                $c->query(Defaults::class),
838
+                $c->getURLGenerator(),
839
+                $c->getL10N('lib')
840
+            );
841
+        });
842
+        $this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
843
+
844
+        $this->registerService('LDAPProvider', function (Server $c) {
845
+            $config = $c->getConfig();
846
+            $factoryClass = $config->getSystemValue('ldapProviderFactory', null);
847
+            if (is_null($factoryClass)) {
848
+                throw new \Exception('ldapProviderFactory not set');
849
+            }
850
+            /** @var \OCP\LDAP\ILDAPProviderFactory $factory */
851
+            $factory = new $factoryClass($this);
852
+            return $factory->getLDAPProvider();
853
+        });
854
+        $this->registerService(ILockingProvider::class, function (Server $c) {
855
+            $ini = $c->getIniWrapper();
856
+            $config = $c->getConfig();
857
+            $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
858
+            if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
859
+                /** @var \OC\Memcache\Factory $memcacheFactory */
860
+                $memcacheFactory = $c->getMemCacheFactory();
861
+                $memcache = $memcacheFactory->createLocking('lock');
862
+                if (!($memcache instanceof \OC\Memcache\NullCache)) {
863
+                    return new MemcacheLockingProvider($memcache, $ttl);
864
+                }
865
+                return new DBLockingProvider(
866
+                    $c->getDatabaseConnection(),
867
+                    $c->getLogger(),
868
+                    new TimeFactory(),
869
+                    $ttl,
870
+                    !\OC::$CLI
871
+                );
872
+            }
873
+            return new NoopLockingProvider();
874
+        });
875
+        $this->registerAlias('LockingProvider', ILockingProvider::class);
876
+
877
+        $this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
878
+            return new \OC\Files\Mount\Manager();
879
+        });
880
+        $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
881
+
882
+        $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
883
+            return new \OC\Files\Type\Detection(
884
+                $c->getURLGenerator(),
885
+                \OC::$configDir,
886
+                \OC::$SERVERROOT . '/resources/config/'
887
+            );
888
+        });
889
+        $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
890
+
891
+        $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
892
+            return new \OC\Files\Type\Loader(
893
+                $c->getDatabaseConnection()
894
+            );
895
+        });
896
+        $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
897
+        $this->registerService(BundleFetcher::class, function () {
898
+            return new BundleFetcher($this->getL10N('lib'));
899
+        });
900
+        $this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
901
+            return new Manager(
902
+                $c->query(IValidator::class)
903
+            );
904
+        });
905
+        $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
906
+
907
+        $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
908
+            $manager = new \OC\CapabilitiesManager($c->getLogger());
909
+            $manager->registerCapability(function () use ($c) {
910
+                return new \OC\OCS\CoreCapabilities($c->getConfig());
911
+            });
912
+            $manager->registerCapability(function () use ($c) {
913
+                return $c->query(\OC\Security\Bruteforce\Capabilities::class);
914
+            });
915
+            return $manager;
916
+        });
917
+        $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
918
+
919
+        $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
920
+            $config = $c->getConfig();
921
+            $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
922
+            /** @var \OCP\Comments\ICommentsManagerFactory $factory */
923
+            $factory = new $factoryClass($this);
924
+            $manager = $factory->getManager();
925
+
926
+            $manager->registerDisplayNameResolver('user', function($id) use ($c) {
927
+                $manager = $c->getUserManager();
928
+                $user = $manager->get($id);
929
+                if(is_null($user)) {
930
+                    $l = $c->getL10N('core');
931
+                    $displayName = $l->t('Unknown user');
932
+                } else {
933
+                    $displayName = $user->getDisplayName();
934
+                }
935
+                return $displayName;
936
+            });
937
+
938
+            return $manager;
939
+        });
940
+        $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
941
+
942
+        $this->registerService('ThemingDefaults', function (Server $c) {
943
+            /*
944 944
 			 * Dark magic for autoloader.
945 945
 			 * If we do a class_exists it will try to load the class which will
946 946
 			 * make composer cache the result. Resulting in errors when enabling
947 947
 			 * the theming app.
948 948
 			 */
949
-			$prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
950
-			if (isset($prefixes['OCA\\Theming\\'])) {
951
-				$classExists = true;
952
-			} else {
953
-				$classExists = false;
954
-			}
955
-
956
-			if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
957
-				return new ThemingDefaults(
958
-					$c->getConfig(),
959
-					$c->getL10N('theming'),
960
-					$c->getURLGenerator(),
961
-					$c->getMemCacheFactory(),
962
-					new Util($c->getConfig(), $this->getAppManager(), $c->getAppDataDir('theming')),
963
-					new ImageManager($c->getConfig(), $c->getAppDataDir('theming'), $c->getURLGenerator(), $this->getMemCacheFactory(), $this->getLogger()),
964
-					$c->getAppManager(),
965
-					$c->getNavigationManager()
966
-				);
967
-			}
968
-			return new \OC_Defaults();
969
-		});
970
-		$this->registerService(SCSSCacher::class, function (Server $c) {
971
-			return new SCSSCacher(
972
-				$c->getLogger(),
973
-				$c->query(\OC\Files\AppData\Factory::class),
974
-				$c->getURLGenerator(),
975
-				$c->getConfig(),
976
-				$c->getThemingDefaults(),
977
-				\OC::$SERVERROOT,
978
-				$this->getMemCacheFactory(),
979
-				$c->query(IconsCacher::class),
980
-				new TimeFactory()
981
-			);
982
-		});
983
-		$this->registerService(JSCombiner::class, function (Server $c) {
984
-			return new JSCombiner(
985
-				$c->getAppDataDir('js'),
986
-				$c->getURLGenerator(),
987
-				$this->getMemCacheFactory(),
988
-				$c->getSystemConfig(),
989
-				$c->getLogger()
990
-			);
991
-		});
992
-		$this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class);
993
-		$this->registerAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class);
994
-		$this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class);
995
-
996
-		$this->registerService('CryptoWrapper', function (Server $c) {
997
-			// FIXME: Instantiiated here due to cyclic dependency
998
-			$request = new Request(
999
-				[
1000
-					'get' => $_GET,
1001
-					'post' => $_POST,
1002
-					'files' => $_FILES,
1003
-					'server' => $_SERVER,
1004
-					'env' => $_ENV,
1005
-					'cookies' => $_COOKIE,
1006
-					'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
1007
-						? $_SERVER['REQUEST_METHOD']
1008
-						: null,
1009
-				],
1010
-				$c->getSecureRandom(),
1011
-				$c->getConfig()
1012
-			);
1013
-
1014
-			return new CryptoWrapper(
1015
-				$c->getConfig(),
1016
-				$c->getCrypto(),
1017
-				$c->getSecureRandom(),
1018
-				$request
1019
-			);
1020
-		});
1021
-		$this->registerService(CsrfTokenManager::class, function (Server $c) {
1022
-			$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
1023
-
1024
-			return new CsrfTokenManager(
1025
-				$tokenGenerator,
1026
-				$c->query(SessionStorage::class)
1027
-			);
1028
-		});
1029
-		$this->registerAlias('CsrfTokenManager', CsrfTokenManager::class);
1030
-		$this->registerService(SessionStorage::class, function (Server $c) {
1031
-			return new SessionStorage($c->getSession());
1032
-		});
1033
-		$this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, \OC\Security\CSP\ContentSecurityPolicyManager::class);
1034
-		$this->registerAlias('ContentSecurityPolicyManager', \OC\Security\CSP\ContentSecurityPolicyManager::class);
1035
-
1036
-		$this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) {
1037
-			return new ContentSecurityPolicyNonceManager(
1038
-				$c->getCsrfTokenManager(),
1039
-				$c->getRequest()
1040
-			);
1041
-		});
1042
-
1043
-		$this->registerService(\OCP\Share\IManager::class, function (Server $c) {
1044
-			$config = $c->getConfig();
1045
-			$factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
1046
-			/** @var \OCP\Share\IProviderFactory $factory */
1047
-			$factory = new $factoryClass($this);
1048
-
1049
-			$manager = new \OC\Share20\Manager(
1050
-				$c->getLogger(),
1051
-				$c->getConfig(),
1052
-				$c->getSecureRandom(),
1053
-				$c->getHasher(),
1054
-				$c->getMountManager(),
1055
-				$c->getGroupManager(),
1056
-				$c->getL10N('lib'),
1057
-				$c->getL10NFactory(),
1058
-				$factory,
1059
-				$c->getUserManager(),
1060
-				$c->getLazyRootFolder(),
1061
-				$c->getEventDispatcher(),
1062
-				$c->getMailer(),
1063
-				$c->getURLGenerator(),
1064
-				$c->getThemingDefaults()
1065
-			);
1066
-
1067
-			return $manager;
1068
-		});
1069
-		$this->registerAlias('ShareManager', \OCP\Share\IManager::class);
1070
-
1071
-		$this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) {
1072
-			$instance = new Collaboration\Collaborators\Search($c);
1073
-
1074
-			// register default plugins
1075
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
1076
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]);
1077
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]);
1078
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]);
1079
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE_GROUP', 'class' => RemoteGroupPlugin::class]);
1080
-
1081
-			return $instance;
1082
-		});
1083
-		$this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class);
1084
-		$this->registerAlias(\OCP\Collaboration\Collaborators\ISearchResult::class, \OC\Collaboration\Collaborators\SearchResult::class);
1085
-
1086
-		$this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class);
1087
-
1088
-		$this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class);
1089
-
1090
-		$this->registerService('SettingsManager', function (Server $c) {
1091
-			$manager = new \OC\Settings\Manager(
1092
-				$c->getLogger(),
1093
-				$c->getL10NFactory(),
1094
-				$c->getURLGenerator(),
1095
-				$c
1096
-			);
1097
-			return $manager;
1098
-		});
1099
-		$this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
1100
-			return new \OC\Files\AppData\Factory(
1101
-				$c->getRootFolder(),
1102
-				$c->getSystemConfig()
1103
-			);
1104
-		});
1105
-
1106
-		$this->registerService('LockdownManager', function (Server $c) {
1107
-			return new LockdownManager(function () use ($c) {
1108
-				return $c->getSession();
1109
-			});
1110
-		});
1111
-
1112
-		$this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
1113
-			return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
1114
-		});
1115
-
1116
-		$this->registerService(ICloudIdManager::class, function (Server $c) {
1117
-			return new CloudIdManager();
1118
-		});
1119
-
1120
-		$this->registerService(IConfig::class, function (Server $c) {
1121
-			return new GlobalScale\Config($c->getConfig());
1122
-		});
1123
-
1124
-		$this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
1125
-			return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger());
1126
-		});
1127
-
1128
-		$this->registerService(ICloudFederationFactory::class, function (Server $c) {
1129
-			return new CloudFederationFactory();
1130
-		});
1131
-
1132
-		$this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
1133
-		$this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
1134
-
1135
-		$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
1136
-		$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
1137
-
1138
-		$this->registerService(Defaults::class, function (Server $c) {
1139
-			return new Defaults(
1140
-				$c->getThemingDefaults()
1141
-			);
1142
-		});
1143
-		$this->registerAlias('Defaults', \OCP\Defaults::class);
1144
-
1145
-		$this->registerService(\OCP\ISession::class, function (SimpleContainer $c) {
1146
-			return $c->query(\OCP\IUserSession::class)->getSession();
1147
-		});
1148
-
1149
-		$this->registerService(IShareHelper::class, function (Server $c) {
1150
-			return new ShareHelper(
1151
-				$c->query(\OCP\Share\IManager::class)
1152
-			);
1153
-		});
1154
-
1155
-		$this->registerService(Installer::class, function(Server $c) {
1156
-			return new Installer(
1157
-				$c->getAppFetcher(),
1158
-				$c->getHTTPClientService(),
1159
-				$c->getTempManager(),
1160
-				$c->getLogger(),
1161
-				$c->getConfig()
1162
-			);
1163
-		});
1164
-
1165
-		$this->registerService(IApiFactory::class, function(Server $c) {
1166
-			return new ApiFactory($c->getHTTPClientService());
1167
-		});
1168
-
1169
-		$this->registerService(IInstanceFactory::class, function(Server $c) {
1170
-			$memcacheFactory = $c->getMemCacheFactory();
1171
-			return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
1172
-		});
1173
-
1174
-		$this->registerService(IContactsStore::class, function(Server $c) {
1175
-			return new ContactsStore(
1176
-				$c->getContactsManager(),
1177
-				$c->getConfig(),
1178
-				$c->getUserManager(),
1179
-				$c->getGroupManager()
1180
-			);
1181
-		});
1182
-		$this->registerAlias(IContactsStore::class, ContactsStore::class);
1183
-		$this->registerAlias(IAccountManager::class, AccountManager::class);
1184
-
1185
-		$this->registerService(IStorageFactory::class, function() {
1186
-			return new StorageFactory();
1187
-		});
1188
-
1189
-		$this->registerAlias(IDashboardManager::class, DashboardManager::class);
1190
-		$this->registerAlias(IFullTextSearchManager::class, FullTextSearchManager::class);
1191
-
1192
-		$this->registerService(\OC\Security\IdentityProof\Manager::class, function (Server $c) {
1193
-			return new \OC\Security\IdentityProof\Manager(
1194
-				$c->query(\OC\Files\AppData\Factory::class),
1195
-				$c->getCrypto(),
1196
-				$c->getConfig()
1197
-			);
1198
-		});
1199
-
1200
-		$this->registerAlias(ISubAdmin::class, SubAdmin::class);
1201
-
1202
-		$this->registerAlias(IInitialStateService::class, InitialStateService::class);
1203
-
1204
-		$this->connectDispatcher();
1205
-	}
1206
-
1207
-	/**
1208
-	 * @return \OCP\Calendar\IManager
1209
-	 */
1210
-	public function getCalendarManager() {
1211
-		return $this->query('CalendarManager');
1212
-	}
1213
-
1214
-	/**
1215
-	 * @return \OCP\Calendar\Resource\IManager
1216
-	 */
1217
-	public function getCalendarResourceBackendManager() {
1218
-		return $this->query('CalendarResourceBackendManager');
1219
-	}
1220
-
1221
-	/**
1222
-	 * @return \OCP\Calendar\Room\IManager
1223
-	 */
1224
-	public function getCalendarRoomBackendManager() {
1225
-		return $this->query('CalendarRoomBackendManager');
1226
-	}
1227
-
1228
-	private function connectDispatcher() {
1229
-		$dispatcher = $this->getEventDispatcher();
1230
-
1231
-		// Delete avatar on user deletion
1232
-		$dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) {
1233
-			$logger = $this->getLogger();
1234
-			$manager = $this->getAvatarManager();
1235
-			/** @var IUser $user */
1236
-			$user = $e->getSubject();
1237
-
1238
-			try {
1239
-				$avatar = $manager->getAvatar($user->getUID());
1240
-				$avatar->remove();
1241
-			} catch (NotFoundException $e) {
1242
-				// no avatar to remove
1243
-			} catch (\Exception $e) {
1244
-				// Ignore exceptions
1245
-				$logger->info('Could not cleanup avatar of ' . $user->getUID());
1246
-			}
1247
-		});
1248
-
1249
-		$dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) {
1250
-			$manager = $this->getAvatarManager();
1251
-			/** @var IUser $user */
1252
-			$user = $e->getSubject();
1253
-			$feature = $e->getArgument('feature');
1254
-			$oldValue = $e->getArgument('oldValue');
1255
-			$value = $e->getArgument('value');
1256
-
1257
-			// We only change the avatar on display name changes
1258
-			if ($feature !== 'displayName') {
1259
-				return;
1260
-			}
1261
-
1262
-			try {
1263
-				$avatar = $manager->getAvatar($user->getUID());
1264
-				$avatar->userChanged($feature, $oldValue, $value);
1265
-			} catch (NotFoundException $e) {
1266
-				// no avatar to remove
1267
-			}
1268
-		});
1269
-	}
1270
-
1271
-	/**
1272
-	 * @return \OCP\Contacts\IManager
1273
-	 */
1274
-	public function getContactsManager() {
1275
-		return $this->query('ContactsManager');
1276
-	}
1277
-
1278
-	/**
1279
-	 * @return \OC\Encryption\Manager
1280
-	 */
1281
-	public function getEncryptionManager() {
1282
-		return $this->query('EncryptionManager');
1283
-	}
1284
-
1285
-	/**
1286
-	 * @return \OC\Encryption\File
1287
-	 */
1288
-	public function getEncryptionFilesHelper() {
1289
-		return $this->query('EncryptionFileHelper');
1290
-	}
1291
-
1292
-	/**
1293
-	 * @return \OCP\Encryption\Keys\IStorage
1294
-	 */
1295
-	public function getEncryptionKeyStorage() {
1296
-		return $this->query('EncryptionKeyStorage');
1297
-	}
1298
-
1299
-	/**
1300
-	 * The current request object holding all information about the request
1301
-	 * currently being processed is returned from this method.
1302
-	 * In case the current execution was not initiated by a web request null is returned
1303
-	 *
1304
-	 * @return \OCP\IRequest
1305
-	 */
1306
-	public function getRequest() {
1307
-		return $this->query('Request');
1308
-	}
1309
-
1310
-	/**
1311
-	 * Returns the preview manager which can create preview images for a given file
1312
-	 *
1313
-	 * @return \OCP\IPreview
1314
-	 */
1315
-	public function getPreviewManager() {
1316
-		return $this->query('PreviewManager');
1317
-	}
1318
-
1319
-	/**
1320
-	 * Returns the tag manager which can get and set tags for different object types
1321
-	 *
1322
-	 * @see \OCP\ITagManager::load()
1323
-	 * @return \OCP\ITagManager
1324
-	 */
1325
-	public function getTagManager() {
1326
-		return $this->query('TagManager');
1327
-	}
1328
-
1329
-	/**
1330
-	 * Returns the system-tag manager
1331
-	 *
1332
-	 * @return \OCP\SystemTag\ISystemTagManager
1333
-	 *
1334
-	 * @since 9.0.0
1335
-	 */
1336
-	public function getSystemTagManager() {
1337
-		return $this->query('SystemTagManager');
1338
-	}
1339
-
1340
-	/**
1341
-	 * Returns the system-tag object mapper
1342
-	 *
1343
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
1344
-	 *
1345
-	 * @since 9.0.0
1346
-	 */
1347
-	public function getSystemTagObjectMapper() {
1348
-		return $this->query('SystemTagObjectMapper');
1349
-	}
1350
-
1351
-	/**
1352
-	 * Returns the avatar manager, used for avatar functionality
1353
-	 *
1354
-	 * @return \OCP\IAvatarManager
1355
-	 */
1356
-	public function getAvatarManager() {
1357
-		return $this->query('AvatarManager');
1358
-	}
1359
-
1360
-	/**
1361
-	 * Returns the root folder of ownCloud's data directory
1362
-	 *
1363
-	 * @return \OCP\Files\IRootFolder
1364
-	 */
1365
-	public function getRootFolder() {
1366
-		return $this->query('LazyRootFolder');
1367
-	}
1368
-
1369
-	/**
1370
-	 * Returns the root folder of ownCloud's data directory
1371
-	 * This is the lazy variant so this gets only initialized once it
1372
-	 * is actually used.
1373
-	 *
1374
-	 * @return \OCP\Files\IRootFolder
1375
-	 */
1376
-	public function getLazyRootFolder() {
1377
-		return $this->query('LazyRootFolder');
1378
-	}
1379
-
1380
-	/**
1381
-	 * Returns a view to ownCloud's files folder
1382
-	 *
1383
-	 * @param string $userId user ID
1384
-	 * @return \OCP\Files\Folder|null
1385
-	 */
1386
-	public function getUserFolder($userId = null) {
1387
-		if ($userId === null) {
1388
-			$user = $this->getUserSession()->getUser();
1389
-			if (!$user) {
1390
-				return null;
1391
-			}
1392
-			$userId = $user->getUID();
1393
-		}
1394
-		$root = $this->getRootFolder();
1395
-		return $root->getUserFolder($userId);
1396
-	}
1397
-
1398
-	/**
1399
-	 * Returns an app-specific view in ownClouds data directory
1400
-	 *
1401
-	 * @return \OCP\Files\Folder
1402
-	 * @deprecated since 9.2.0 use IAppData
1403
-	 */
1404
-	public function getAppFolder() {
1405
-		$dir = '/' . \OC_App::getCurrentApp();
1406
-		$root = $this->getRootFolder();
1407
-		if (!$root->nodeExists($dir)) {
1408
-			$folder = $root->newFolder($dir);
1409
-		} else {
1410
-			$folder = $root->get($dir);
1411
-		}
1412
-		return $folder;
1413
-	}
1414
-
1415
-	/**
1416
-	 * @return \OC\User\Manager
1417
-	 */
1418
-	public function getUserManager() {
1419
-		return $this->query('UserManager');
1420
-	}
1421
-
1422
-	/**
1423
-	 * @return \OC\Group\Manager
1424
-	 */
1425
-	public function getGroupManager() {
1426
-		return $this->query('GroupManager');
1427
-	}
1428
-
1429
-	/**
1430
-	 * @return \OC\User\Session
1431
-	 */
1432
-	public function getUserSession() {
1433
-		return $this->query('UserSession');
1434
-	}
1435
-
1436
-	/**
1437
-	 * @return \OCP\ISession
1438
-	 */
1439
-	public function getSession() {
1440
-		return $this->query('UserSession')->getSession();
1441
-	}
1442
-
1443
-	/**
1444
-	 * @param \OCP\ISession $session
1445
-	 */
1446
-	public function setSession(\OCP\ISession $session) {
1447
-		$this->query(SessionStorage::class)->setSession($session);
1448
-		$this->query('UserSession')->setSession($session);
1449
-		$this->query(Store::class)->setSession($session);
1450
-	}
1451
-
1452
-	/**
1453
-	 * @return \OC\Authentication\TwoFactorAuth\Manager
1454
-	 */
1455
-	public function getTwoFactorAuthManager() {
1456
-		return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
1457
-	}
1458
-
1459
-	/**
1460
-	 * @return \OC\NavigationManager
1461
-	 */
1462
-	public function getNavigationManager() {
1463
-		return $this->query('NavigationManager');
1464
-	}
1465
-
1466
-	/**
1467
-	 * @return \OCP\IConfig
1468
-	 */
1469
-	public function getConfig() {
1470
-		return $this->query('AllConfig');
1471
-	}
1472
-
1473
-	/**
1474
-	 * @return \OC\SystemConfig
1475
-	 */
1476
-	public function getSystemConfig() {
1477
-		return $this->query('SystemConfig');
1478
-	}
1479
-
1480
-	/**
1481
-	 * Returns the app config manager
1482
-	 *
1483
-	 * @return \OCP\IAppConfig
1484
-	 */
1485
-	public function getAppConfig() {
1486
-		return $this->query('AppConfig');
1487
-	}
1488
-
1489
-	/**
1490
-	 * @return \OCP\L10N\IFactory
1491
-	 */
1492
-	public function getL10NFactory() {
1493
-		return $this->query('L10NFactory');
1494
-	}
1495
-
1496
-	/**
1497
-	 * get an L10N instance
1498
-	 *
1499
-	 * @param string $app appid
1500
-	 * @param string $lang
1501
-	 * @return IL10N
1502
-	 */
1503
-	public function getL10N($app, $lang = null) {
1504
-		return $this->getL10NFactory()->get($app, $lang);
1505
-	}
1506
-
1507
-	/**
1508
-	 * @return \OCP\IURLGenerator
1509
-	 */
1510
-	public function getURLGenerator() {
1511
-		return $this->query('URLGenerator');
1512
-	}
1513
-
1514
-	/**
1515
-	 * @return AppFetcher
1516
-	 */
1517
-	public function getAppFetcher() {
1518
-		return $this->query(AppFetcher::class);
1519
-	}
1520
-
1521
-	/**
1522
-	 * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
1523
-	 * getMemCacheFactory() instead.
1524
-	 *
1525
-	 * @return \OCP\ICache
1526
-	 * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
1527
-	 */
1528
-	public function getCache() {
1529
-		return $this->query('UserCache');
1530
-	}
1531
-
1532
-	/**
1533
-	 * Returns an \OCP\CacheFactory instance
1534
-	 *
1535
-	 * @return \OCP\ICacheFactory
1536
-	 */
1537
-	public function getMemCacheFactory() {
1538
-		return $this->query('MemCacheFactory');
1539
-	}
1540
-
1541
-	/**
1542
-	 * Returns an \OC\RedisFactory instance
1543
-	 *
1544
-	 * @return \OC\RedisFactory
1545
-	 */
1546
-	public function getGetRedisFactory() {
1547
-		return $this->query('RedisFactory');
1548
-	}
1549
-
1550
-
1551
-	/**
1552
-	 * Returns the current session
1553
-	 *
1554
-	 * @return \OCP\IDBConnection
1555
-	 */
1556
-	public function getDatabaseConnection() {
1557
-		return $this->query('DatabaseConnection');
1558
-	}
1559
-
1560
-	/**
1561
-	 * Returns the activity manager
1562
-	 *
1563
-	 * @return \OCP\Activity\IManager
1564
-	 */
1565
-	public function getActivityManager() {
1566
-		return $this->query('ActivityManager');
1567
-	}
1568
-
1569
-	/**
1570
-	 * Returns an job list for controlling background jobs
1571
-	 *
1572
-	 * @return \OCP\BackgroundJob\IJobList
1573
-	 */
1574
-	public function getJobList() {
1575
-		return $this->query('JobList');
1576
-	}
1577
-
1578
-	/**
1579
-	 * Returns a logger instance
1580
-	 *
1581
-	 * @return \OCP\ILogger
1582
-	 */
1583
-	public function getLogger() {
1584
-		return $this->query('Logger');
1585
-	}
1586
-
1587
-	/**
1588
-	 * @return ILogFactory
1589
-	 * @throws \OCP\AppFramework\QueryException
1590
-	 */
1591
-	public function getLogFactory() {
1592
-		return $this->query(ILogFactory::class);
1593
-	}
1594
-
1595
-	/**
1596
-	 * Returns a router for generating and matching urls
1597
-	 *
1598
-	 * @return \OCP\Route\IRouter
1599
-	 */
1600
-	public function getRouter() {
1601
-		return $this->query('Router');
1602
-	}
1603
-
1604
-	/**
1605
-	 * Returns a search instance
1606
-	 *
1607
-	 * @return \OCP\ISearch
1608
-	 */
1609
-	public function getSearch() {
1610
-		return $this->query('Search');
1611
-	}
1612
-
1613
-	/**
1614
-	 * Returns a SecureRandom instance
1615
-	 *
1616
-	 * @return \OCP\Security\ISecureRandom
1617
-	 */
1618
-	public function getSecureRandom() {
1619
-		return $this->query('SecureRandom');
1620
-	}
1621
-
1622
-	/**
1623
-	 * Returns a Crypto instance
1624
-	 *
1625
-	 * @return \OCP\Security\ICrypto
1626
-	 */
1627
-	public function getCrypto() {
1628
-		return $this->query('Crypto');
1629
-	}
1630
-
1631
-	/**
1632
-	 * Returns a Hasher instance
1633
-	 *
1634
-	 * @return \OCP\Security\IHasher
1635
-	 */
1636
-	public function getHasher() {
1637
-		return $this->query('Hasher');
1638
-	}
1639
-
1640
-	/**
1641
-	 * Returns a CredentialsManager instance
1642
-	 *
1643
-	 * @return \OCP\Security\ICredentialsManager
1644
-	 */
1645
-	public function getCredentialsManager() {
1646
-		return $this->query('CredentialsManager');
1647
-	}
1648
-
1649
-	/**
1650
-	 * Get the certificate manager for the user
1651
-	 *
1652
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
1653
-	 * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
1654
-	 */
1655
-	public function getCertificateManager($userId = '') {
1656
-		if ($userId === '') {
1657
-			$userSession = $this->getUserSession();
1658
-			$user = $userSession->getUser();
1659
-			if (is_null($user)) {
1660
-				return null;
1661
-			}
1662
-			$userId = $user->getUID();
1663
-		}
1664
-		return new CertificateManager(
1665
-			$userId,
1666
-			new View(),
1667
-			$this->getConfig(),
1668
-			$this->getLogger(),
1669
-			$this->getSecureRandom()
1670
-		);
1671
-	}
1672
-
1673
-	/**
1674
-	 * Returns an instance of the HTTP client service
1675
-	 *
1676
-	 * @return \OCP\Http\Client\IClientService
1677
-	 */
1678
-	public function getHTTPClientService() {
1679
-		return $this->query('HttpClientService');
1680
-	}
1681
-
1682
-	/**
1683
-	 * Create a new event source
1684
-	 *
1685
-	 * @return \OCP\IEventSource
1686
-	 */
1687
-	public function createEventSource() {
1688
-		return new \OC_EventSource();
1689
-	}
1690
-
1691
-	/**
1692
-	 * Get the active event logger
1693
-	 *
1694
-	 * The returned logger only logs data when debug mode is enabled
1695
-	 *
1696
-	 * @return \OCP\Diagnostics\IEventLogger
1697
-	 */
1698
-	public function getEventLogger() {
1699
-		return $this->query('EventLogger');
1700
-	}
1701
-
1702
-	/**
1703
-	 * Get the active query logger
1704
-	 *
1705
-	 * The returned logger only logs data when debug mode is enabled
1706
-	 *
1707
-	 * @return \OCP\Diagnostics\IQueryLogger
1708
-	 */
1709
-	public function getQueryLogger() {
1710
-		return $this->query('QueryLogger');
1711
-	}
1712
-
1713
-	/**
1714
-	 * Get the manager for temporary files and folders
1715
-	 *
1716
-	 * @return \OCP\ITempManager
1717
-	 */
1718
-	public function getTempManager() {
1719
-		return $this->query('TempManager');
1720
-	}
1721
-
1722
-	/**
1723
-	 * Get the app manager
1724
-	 *
1725
-	 * @return \OCP\App\IAppManager
1726
-	 */
1727
-	public function getAppManager() {
1728
-		return $this->query('AppManager');
1729
-	}
1730
-
1731
-	/**
1732
-	 * Creates a new mailer
1733
-	 *
1734
-	 * @return \OCP\Mail\IMailer
1735
-	 */
1736
-	public function getMailer() {
1737
-		return $this->query('Mailer');
1738
-	}
1739
-
1740
-	/**
1741
-	 * Get the webroot
1742
-	 *
1743
-	 * @return string
1744
-	 */
1745
-	public function getWebRoot() {
1746
-		return $this->webRoot;
1747
-	}
1748
-
1749
-	/**
1750
-	 * @return \OC\OCSClient
1751
-	 */
1752
-	public function getOcsClient() {
1753
-		return $this->query('OcsClient');
1754
-	}
1755
-
1756
-	/**
1757
-	 * @return \OCP\IDateTimeZone
1758
-	 */
1759
-	public function getDateTimeZone() {
1760
-		return $this->query('DateTimeZone');
1761
-	}
1762
-
1763
-	/**
1764
-	 * @return \OCP\IDateTimeFormatter
1765
-	 */
1766
-	public function getDateTimeFormatter() {
1767
-		return $this->query('DateTimeFormatter');
1768
-	}
1769
-
1770
-	/**
1771
-	 * @return \OCP\Files\Config\IMountProviderCollection
1772
-	 */
1773
-	public function getMountProviderCollection() {
1774
-		return $this->query('MountConfigManager');
1775
-	}
1776
-
1777
-	/**
1778
-	 * Get the IniWrapper
1779
-	 *
1780
-	 * @return IniGetWrapper
1781
-	 */
1782
-	public function getIniWrapper() {
1783
-		return $this->query('IniWrapper');
1784
-	}
1785
-
1786
-	/**
1787
-	 * @return \OCP\Command\IBus
1788
-	 */
1789
-	public function getCommandBus() {
1790
-		return $this->query('AsyncCommandBus');
1791
-	}
1792
-
1793
-	/**
1794
-	 * Get the trusted domain helper
1795
-	 *
1796
-	 * @return TrustedDomainHelper
1797
-	 */
1798
-	public function getTrustedDomainHelper() {
1799
-		return $this->query('TrustedDomainHelper');
1800
-	}
1801
-
1802
-	/**
1803
-	 * Get the locking provider
1804
-	 *
1805
-	 * @return \OCP\Lock\ILockingProvider
1806
-	 * @since 8.1.0
1807
-	 */
1808
-	public function getLockingProvider() {
1809
-		return $this->query('LockingProvider');
1810
-	}
1811
-
1812
-	/**
1813
-	 * @return \OCP\Files\Mount\IMountManager
1814
-	 **/
1815
-	function getMountManager() {
1816
-		return $this->query('MountManager');
1817
-	}
1818
-
1819
-	/** @return \OCP\Files\Config\IUserMountCache */
1820
-	function getUserMountCache() {
1821
-		return $this->query('UserMountCache');
1822
-	}
1823
-
1824
-	/**
1825
-	 * Get the MimeTypeDetector
1826
-	 *
1827
-	 * @return \OCP\Files\IMimeTypeDetector
1828
-	 */
1829
-	public function getMimeTypeDetector() {
1830
-		return $this->query('MimeTypeDetector');
1831
-	}
1832
-
1833
-	/**
1834
-	 * Get the MimeTypeLoader
1835
-	 *
1836
-	 * @return \OCP\Files\IMimeTypeLoader
1837
-	 */
1838
-	public function getMimeTypeLoader() {
1839
-		return $this->query('MimeTypeLoader');
1840
-	}
1841
-
1842
-	/**
1843
-	 * Get the manager of all the capabilities
1844
-	 *
1845
-	 * @return \OC\CapabilitiesManager
1846
-	 */
1847
-	public function getCapabilitiesManager() {
1848
-		return $this->query('CapabilitiesManager');
1849
-	}
1850
-
1851
-	/**
1852
-	 * Get the EventDispatcher
1853
-	 *
1854
-	 * @return EventDispatcherInterface
1855
-	 * @since 8.2.0
1856
-	 */
1857
-	public function getEventDispatcher() {
1858
-		return $this->query(\OC\EventDispatcher\SymfonyAdapter::class);
1859
-	}
1860
-
1861
-	/**
1862
-	 * Get the Notification Manager
1863
-	 *
1864
-	 * @return \OCP\Notification\IManager
1865
-	 * @since 8.2.0
1866
-	 */
1867
-	public function getNotificationManager() {
1868
-		return $this->query('NotificationManager');
1869
-	}
1870
-
1871
-	/**
1872
-	 * @return \OCP\Comments\ICommentsManager
1873
-	 */
1874
-	public function getCommentsManager() {
1875
-		return $this->query('CommentsManager');
1876
-	}
1877
-
1878
-	/**
1879
-	 * @return \OCA\Theming\ThemingDefaults
1880
-	 */
1881
-	public function getThemingDefaults() {
1882
-		return $this->query('ThemingDefaults');
1883
-	}
1884
-
1885
-	/**
1886
-	 * @return \OC\IntegrityCheck\Checker
1887
-	 */
1888
-	public function getIntegrityCodeChecker() {
1889
-		return $this->query('IntegrityCodeChecker');
1890
-	}
1891
-
1892
-	/**
1893
-	 * @return \OC\Session\CryptoWrapper
1894
-	 */
1895
-	public function getSessionCryptoWrapper() {
1896
-		return $this->query('CryptoWrapper');
1897
-	}
1898
-
1899
-	/**
1900
-	 * @return CsrfTokenManager
1901
-	 */
1902
-	public function getCsrfTokenManager() {
1903
-		return $this->query(CsrfTokenManager::class);
1904
-	}
1905
-
1906
-	/**
1907
-	 * @return Throttler
1908
-	 */
1909
-	public function getBruteForceThrottler() {
1910
-		return $this->query('Throttler');
1911
-	}
1912
-
1913
-	/**
1914
-	 * @return IContentSecurityPolicyManager
1915
-	 */
1916
-	public function getContentSecurityPolicyManager() {
1917
-		return $this->query('ContentSecurityPolicyManager');
1918
-	}
1919
-
1920
-	/**
1921
-	 * @return ContentSecurityPolicyNonceManager
1922
-	 */
1923
-	public function getContentSecurityPolicyNonceManager() {
1924
-		return $this->query('ContentSecurityPolicyNonceManager');
1925
-	}
1926
-
1927
-	/**
1928
-	 * Not a public API as of 8.2, wait for 9.0
1929
-	 *
1930
-	 * @return \OCA\Files_External\Service\BackendService
1931
-	 */
1932
-	public function getStoragesBackendService() {
1933
-		return $this->query('OCA\\Files_External\\Service\\BackendService');
1934
-	}
1935
-
1936
-	/**
1937
-	 * Not a public API as of 8.2, wait for 9.0
1938
-	 *
1939
-	 * @return \OCA\Files_External\Service\GlobalStoragesService
1940
-	 */
1941
-	public function getGlobalStoragesService() {
1942
-		return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
1943
-	}
1944
-
1945
-	/**
1946
-	 * Not a public API as of 8.2, wait for 9.0
1947
-	 *
1948
-	 * @return \OCA\Files_External\Service\UserGlobalStoragesService
1949
-	 */
1950
-	public function getUserGlobalStoragesService() {
1951
-		return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
1952
-	}
1953
-
1954
-	/**
1955
-	 * Not a public API as of 8.2, wait for 9.0
1956
-	 *
1957
-	 * @return \OCA\Files_External\Service\UserStoragesService
1958
-	 */
1959
-	public function getUserStoragesService() {
1960
-		return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
1961
-	}
1962
-
1963
-	/**
1964
-	 * @return \OCP\Share\IManager
1965
-	 */
1966
-	public function getShareManager() {
1967
-		return $this->query('ShareManager');
1968
-	}
1969
-
1970
-	/**
1971
-	 * @return \OCP\Collaboration\Collaborators\ISearch
1972
-	 */
1973
-	public function getCollaboratorSearch() {
1974
-		return $this->query('CollaboratorSearch');
1975
-	}
1976
-
1977
-	/**
1978
-	 * @return \OCP\Collaboration\AutoComplete\IManager
1979
-	 */
1980
-	public function getAutoCompleteManager(){
1981
-		return $this->query(IManager::class);
1982
-	}
1983
-
1984
-	/**
1985
-	 * Returns the LDAP Provider
1986
-	 *
1987
-	 * @return \OCP\LDAP\ILDAPProvider
1988
-	 */
1989
-	public function getLDAPProvider() {
1990
-		return $this->query('LDAPProvider');
1991
-	}
1992
-
1993
-	/**
1994
-	 * @return \OCP\Settings\IManager
1995
-	 */
1996
-	public function getSettingsManager() {
1997
-		return $this->query('SettingsManager');
1998
-	}
1999
-
2000
-	/**
2001
-	 * @return \OCP\Files\IAppData
2002
-	 */
2003
-	public function getAppDataDir($app) {
2004
-		/** @var \OC\Files\AppData\Factory $factory */
2005
-		$factory = $this->query(\OC\Files\AppData\Factory::class);
2006
-		return $factory->get($app);
2007
-	}
2008
-
2009
-	/**
2010
-	 * @return \OCP\Lockdown\ILockdownManager
2011
-	 */
2012
-	public function getLockdownManager() {
2013
-		return $this->query('LockdownManager');
2014
-	}
2015
-
2016
-	/**
2017
-	 * @return \OCP\Federation\ICloudIdManager
2018
-	 */
2019
-	public function getCloudIdManager() {
2020
-		return $this->query(ICloudIdManager::class);
2021
-	}
2022
-
2023
-	/**
2024
-	 * @return \OCP\GlobalScale\IConfig
2025
-	 */
2026
-	public function getGlobalScaleConfig() {
2027
-		return $this->query(IConfig::class);
2028
-	}
2029
-
2030
-	/**
2031
-	 * @return \OCP\Federation\ICloudFederationProviderManager
2032
-	 */
2033
-	public function getCloudFederationProviderManager() {
2034
-		return $this->query(ICloudFederationProviderManager::class);
2035
-	}
2036
-
2037
-	/**
2038
-	 * @return \OCP\Remote\Api\IApiFactory
2039
-	 */
2040
-	public function getRemoteApiFactory() {
2041
-		return $this->query(IApiFactory::class);
2042
-	}
2043
-
2044
-	/**
2045
-	 * @return \OCP\Federation\ICloudFederationFactory
2046
-	 */
2047
-	public function getCloudFederationFactory() {
2048
-		return $this->query(ICloudFederationFactory::class);
2049
-	}
2050
-
2051
-	/**
2052
-	 * @return \OCP\Remote\IInstanceFactory
2053
-	 */
2054
-	public function getRemoteInstanceFactory() {
2055
-		return $this->query(IInstanceFactory::class);
2056
-	}
2057
-
2058
-	/**
2059
-	 * @return IStorageFactory
2060
-	 */
2061
-	public function getStorageFactory() {
2062
-		return $this->query(IStorageFactory::class);
2063
-	}
2064
-
2065
-	/**
2066
-	 * Get the Preview GeneratorHelper
2067
-	 *
2068
-	 * @return GeneratorHelper
2069
-	 * @since 17.0.0
2070
-	 */
2071
-	public function getGeneratorHelper() {
2072
-		return $this->query(\OC\Preview\GeneratorHelper::class);
2073
-	}
949
+            $prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
950
+            if (isset($prefixes['OCA\\Theming\\'])) {
951
+                $classExists = true;
952
+            } else {
953
+                $classExists = false;
954
+            }
955
+
956
+            if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
957
+                return new ThemingDefaults(
958
+                    $c->getConfig(),
959
+                    $c->getL10N('theming'),
960
+                    $c->getURLGenerator(),
961
+                    $c->getMemCacheFactory(),
962
+                    new Util($c->getConfig(), $this->getAppManager(), $c->getAppDataDir('theming')),
963
+                    new ImageManager($c->getConfig(), $c->getAppDataDir('theming'), $c->getURLGenerator(), $this->getMemCacheFactory(), $this->getLogger()),
964
+                    $c->getAppManager(),
965
+                    $c->getNavigationManager()
966
+                );
967
+            }
968
+            return new \OC_Defaults();
969
+        });
970
+        $this->registerService(SCSSCacher::class, function (Server $c) {
971
+            return new SCSSCacher(
972
+                $c->getLogger(),
973
+                $c->query(\OC\Files\AppData\Factory::class),
974
+                $c->getURLGenerator(),
975
+                $c->getConfig(),
976
+                $c->getThemingDefaults(),
977
+                \OC::$SERVERROOT,
978
+                $this->getMemCacheFactory(),
979
+                $c->query(IconsCacher::class),
980
+                new TimeFactory()
981
+            );
982
+        });
983
+        $this->registerService(JSCombiner::class, function (Server $c) {
984
+            return new JSCombiner(
985
+                $c->getAppDataDir('js'),
986
+                $c->getURLGenerator(),
987
+                $this->getMemCacheFactory(),
988
+                $c->getSystemConfig(),
989
+                $c->getLogger()
990
+            );
991
+        });
992
+        $this->registerAlias(\OCP\EventDispatcher\IEventDispatcher::class, \OC\EventDispatcher\EventDispatcher::class);
993
+        $this->registerAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class);
994
+        $this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class);
995
+
996
+        $this->registerService('CryptoWrapper', function (Server $c) {
997
+            // FIXME: Instantiiated here due to cyclic dependency
998
+            $request = new Request(
999
+                [
1000
+                    'get' => $_GET,
1001
+                    'post' => $_POST,
1002
+                    'files' => $_FILES,
1003
+                    'server' => $_SERVER,
1004
+                    'env' => $_ENV,
1005
+                    'cookies' => $_COOKIE,
1006
+                    'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
1007
+                        ? $_SERVER['REQUEST_METHOD']
1008
+                        : null,
1009
+                ],
1010
+                $c->getSecureRandom(),
1011
+                $c->getConfig()
1012
+            );
1013
+
1014
+            return new CryptoWrapper(
1015
+                $c->getConfig(),
1016
+                $c->getCrypto(),
1017
+                $c->getSecureRandom(),
1018
+                $request
1019
+            );
1020
+        });
1021
+        $this->registerService(CsrfTokenManager::class, function (Server $c) {
1022
+            $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
1023
+
1024
+            return new CsrfTokenManager(
1025
+                $tokenGenerator,
1026
+                $c->query(SessionStorage::class)
1027
+            );
1028
+        });
1029
+        $this->registerAlias('CsrfTokenManager', CsrfTokenManager::class);
1030
+        $this->registerService(SessionStorage::class, function (Server $c) {
1031
+            return new SessionStorage($c->getSession());
1032
+        });
1033
+        $this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, \OC\Security\CSP\ContentSecurityPolicyManager::class);
1034
+        $this->registerAlias('ContentSecurityPolicyManager', \OC\Security\CSP\ContentSecurityPolicyManager::class);
1035
+
1036
+        $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) {
1037
+            return new ContentSecurityPolicyNonceManager(
1038
+                $c->getCsrfTokenManager(),
1039
+                $c->getRequest()
1040
+            );
1041
+        });
1042
+
1043
+        $this->registerService(\OCP\Share\IManager::class, function (Server $c) {
1044
+            $config = $c->getConfig();
1045
+            $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
1046
+            /** @var \OCP\Share\IProviderFactory $factory */
1047
+            $factory = new $factoryClass($this);
1048
+
1049
+            $manager = new \OC\Share20\Manager(
1050
+                $c->getLogger(),
1051
+                $c->getConfig(),
1052
+                $c->getSecureRandom(),
1053
+                $c->getHasher(),
1054
+                $c->getMountManager(),
1055
+                $c->getGroupManager(),
1056
+                $c->getL10N('lib'),
1057
+                $c->getL10NFactory(),
1058
+                $factory,
1059
+                $c->getUserManager(),
1060
+                $c->getLazyRootFolder(),
1061
+                $c->getEventDispatcher(),
1062
+                $c->getMailer(),
1063
+                $c->getURLGenerator(),
1064
+                $c->getThemingDefaults()
1065
+            );
1066
+
1067
+            return $manager;
1068
+        });
1069
+        $this->registerAlias('ShareManager', \OCP\Share\IManager::class);
1070
+
1071
+        $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) {
1072
+            $instance = new Collaboration\Collaborators\Search($c);
1073
+
1074
+            // register default plugins
1075
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
1076
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]);
1077
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]);
1078
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]);
1079
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE_GROUP', 'class' => RemoteGroupPlugin::class]);
1080
+
1081
+            return $instance;
1082
+        });
1083
+        $this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class);
1084
+        $this->registerAlias(\OCP\Collaboration\Collaborators\ISearchResult::class, \OC\Collaboration\Collaborators\SearchResult::class);
1085
+
1086
+        $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class);
1087
+
1088
+        $this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class);
1089
+
1090
+        $this->registerService('SettingsManager', function (Server $c) {
1091
+            $manager = new \OC\Settings\Manager(
1092
+                $c->getLogger(),
1093
+                $c->getL10NFactory(),
1094
+                $c->getURLGenerator(),
1095
+                $c
1096
+            );
1097
+            return $manager;
1098
+        });
1099
+        $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
1100
+            return new \OC\Files\AppData\Factory(
1101
+                $c->getRootFolder(),
1102
+                $c->getSystemConfig()
1103
+            );
1104
+        });
1105
+
1106
+        $this->registerService('LockdownManager', function (Server $c) {
1107
+            return new LockdownManager(function () use ($c) {
1108
+                return $c->getSession();
1109
+            });
1110
+        });
1111
+
1112
+        $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
1113
+            return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
1114
+        });
1115
+
1116
+        $this->registerService(ICloudIdManager::class, function (Server $c) {
1117
+            return new CloudIdManager();
1118
+        });
1119
+
1120
+        $this->registerService(IConfig::class, function (Server $c) {
1121
+            return new GlobalScale\Config($c->getConfig());
1122
+        });
1123
+
1124
+        $this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
1125
+            return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger());
1126
+        });
1127
+
1128
+        $this->registerService(ICloudFederationFactory::class, function (Server $c) {
1129
+            return new CloudFederationFactory();
1130
+        });
1131
+
1132
+        $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
1133
+        $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
1134
+
1135
+        $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
1136
+        $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
1137
+
1138
+        $this->registerService(Defaults::class, function (Server $c) {
1139
+            return new Defaults(
1140
+                $c->getThemingDefaults()
1141
+            );
1142
+        });
1143
+        $this->registerAlias('Defaults', \OCP\Defaults::class);
1144
+
1145
+        $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) {
1146
+            return $c->query(\OCP\IUserSession::class)->getSession();
1147
+        });
1148
+
1149
+        $this->registerService(IShareHelper::class, function (Server $c) {
1150
+            return new ShareHelper(
1151
+                $c->query(\OCP\Share\IManager::class)
1152
+            );
1153
+        });
1154
+
1155
+        $this->registerService(Installer::class, function(Server $c) {
1156
+            return new Installer(
1157
+                $c->getAppFetcher(),
1158
+                $c->getHTTPClientService(),
1159
+                $c->getTempManager(),
1160
+                $c->getLogger(),
1161
+                $c->getConfig()
1162
+            );
1163
+        });
1164
+
1165
+        $this->registerService(IApiFactory::class, function(Server $c) {
1166
+            return new ApiFactory($c->getHTTPClientService());
1167
+        });
1168
+
1169
+        $this->registerService(IInstanceFactory::class, function(Server $c) {
1170
+            $memcacheFactory = $c->getMemCacheFactory();
1171
+            return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
1172
+        });
1173
+
1174
+        $this->registerService(IContactsStore::class, function(Server $c) {
1175
+            return new ContactsStore(
1176
+                $c->getContactsManager(),
1177
+                $c->getConfig(),
1178
+                $c->getUserManager(),
1179
+                $c->getGroupManager()
1180
+            );
1181
+        });
1182
+        $this->registerAlias(IContactsStore::class, ContactsStore::class);
1183
+        $this->registerAlias(IAccountManager::class, AccountManager::class);
1184
+
1185
+        $this->registerService(IStorageFactory::class, function() {
1186
+            return new StorageFactory();
1187
+        });
1188
+
1189
+        $this->registerAlias(IDashboardManager::class, DashboardManager::class);
1190
+        $this->registerAlias(IFullTextSearchManager::class, FullTextSearchManager::class);
1191
+
1192
+        $this->registerService(\OC\Security\IdentityProof\Manager::class, function (Server $c) {
1193
+            return new \OC\Security\IdentityProof\Manager(
1194
+                $c->query(\OC\Files\AppData\Factory::class),
1195
+                $c->getCrypto(),
1196
+                $c->getConfig()
1197
+            );
1198
+        });
1199
+
1200
+        $this->registerAlias(ISubAdmin::class, SubAdmin::class);
1201
+
1202
+        $this->registerAlias(IInitialStateService::class, InitialStateService::class);
1203
+
1204
+        $this->connectDispatcher();
1205
+    }
1206
+
1207
+    /**
1208
+     * @return \OCP\Calendar\IManager
1209
+     */
1210
+    public function getCalendarManager() {
1211
+        return $this->query('CalendarManager');
1212
+    }
1213
+
1214
+    /**
1215
+     * @return \OCP\Calendar\Resource\IManager
1216
+     */
1217
+    public function getCalendarResourceBackendManager() {
1218
+        return $this->query('CalendarResourceBackendManager');
1219
+    }
1220
+
1221
+    /**
1222
+     * @return \OCP\Calendar\Room\IManager
1223
+     */
1224
+    public function getCalendarRoomBackendManager() {
1225
+        return $this->query('CalendarRoomBackendManager');
1226
+    }
1227
+
1228
+    private function connectDispatcher() {
1229
+        $dispatcher = $this->getEventDispatcher();
1230
+
1231
+        // Delete avatar on user deletion
1232
+        $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) {
1233
+            $logger = $this->getLogger();
1234
+            $manager = $this->getAvatarManager();
1235
+            /** @var IUser $user */
1236
+            $user = $e->getSubject();
1237
+
1238
+            try {
1239
+                $avatar = $manager->getAvatar($user->getUID());
1240
+                $avatar->remove();
1241
+            } catch (NotFoundException $e) {
1242
+                // no avatar to remove
1243
+            } catch (\Exception $e) {
1244
+                // Ignore exceptions
1245
+                $logger->info('Could not cleanup avatar of ' . $user->getUID());
1246
+            }
1247
+        });
1248
+
1249
+        $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) {
1250
+            $manager = $this->getAvatarManager();
1251
+            /** @var IUser $user */
1252
+            $user = $e->getSubject();
1253
+            $feature = $e->getArgument('feature');
1254
+            $oldValue = $e->getArgument('oldValue');
1255
+            $value = $e->getArgument('value');
1256
+
1257
+            // We only change the avatar on display name changes
1258
+            if ($feature !== 'displayName') {
1259
+                return;
1260
+            }
1261
+
1262
+            try {
1263
+                $avatar = $manager->getAvatar($user->getUID());
1264
+                $avatar->userChanged($feature, $oldValue, $value);
1265
+            } catch (NotFoundException $e) {
1266
+                // no avatar to remove
1267
+            }
1268
+        });
1269
+    }
1270
+
1271
+    /**
1272
+     * @return \OCP\Contacts\IManager
1273
+     */
1274
+    public function getContactsManager() {
1275
+        return $this->query('ContactsManager');
1276
+    }
1277
+
1278
+    /**
1279
+     * @return \OC\Encryption\Manager
1280
+     */
1281
+    public function getEncryptionManager() {
1282
+        return $this->query('EncryptionManager');
1283
+    }
1284
+
1285
+    /**
1286
+     * @return \OC\Encryption\File
1287
+     */
1288
+    public function getEncryptionFilesHelper() {
1289
+        return $this->query('EncryptionFileHelper');
1290
+    }
1291
+
1292
+    /**
1293
+     * @return \OCP\Encryption\Keys\IStorage
1294
+     */
1295
+    public function getEncryptionKeyStorage() {
1296
+        return $this->query('EncryptionKeyStorage');
1297
+    }
1298
+
1299
+    /**
1300
+     * The current request object holding all information about the request
1301
+     * currently being processed is returned from this method.
1302
+     * In case the current execution was not initiated by a web request null is returned
1303
+     *
1304
+     * @return \OCP\IRequest
1305
+     */
1306
+    public function getRequest() {
1307
+        return $this->query('Request');
1308
+    }
1309
+
1310
+    /**
1311
+     * Returns the preview manager which can create preview images for a given file
1312
+     *
1313
+     * @return \OCP\IPreview
1314
+     */
1315
+    public function getPreviewManager() {
1316
+        return $this->query('PreviewManager');
1317
+    }
1318
+
1319
+    /**
1320
+     * Returns the tag manager which can get and set tags for different object types
1321
+     *
1322
+     * @see \OCP\ITagManager::load()
1323
+     * @return \OCP\ITagManager
1324
+     */
1325
+    public function getTagManager() {
1326
+        return $this->query('TagManager');
1327
+    }
1328
+
1329
+    /**
1330
+     * Returns the system-tag manager
1331
+     *
1332
+     * @return \OCP\SystemTag\ISystemTagManager
1333
+     *
1334
+     * @since 9.0.0
1335
+     */
1336
+    public function getSystemTagManager() {
1337
+        return $this->query('SystemTagManager');
1338
+    }
1339
+
1340
+    /**
1341
+     * Returns the system-tag object mapper
1342
+     *
1343
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
1344
+     *
1345
+     * @since 9.0.0
1346
+     */
1347
+    public function getSystemTagObjectMapper() {
1348
+        return $this->query('SystemTagObjectMapper');
1349
+    }
1350
+
1351
+    /**
1352
+     * Returns the avatar manager, used for avatar functionality
1353
+     *
1354
+     * @return \OCP\IAvatarManager
1355
+     */
1356
+    public function getAvatarManager() {
1357
+        return $this->query('AvatarManager');
1358
+    }
1359
+
1360
+    /**
1361
+     * Returns the root folder of ownCloud's data directory
1362
+     *
1363
+     * @return \OCP\Files\IRootFolder
1364
+     */
1365
+    public function getRootFolder() {
1366
+        return $this->query('LazyRootFolder');
1367
+    }
1368
+
1369
+    /**
1370
+     * Returns the root folder of ownCloud's data directory
1371
+     * This is the lazy variant so this gets only initialized once it
1372
+     * is actually used.
1373
+     *
1374
+     * @return \OCP\Files\IRootFolder
1375
+     */
1376
+    public function getLazyRootFolder() {
1377
+        return $this->query('LazyRootFolder');
1378
+    }
1379
+
1380
+    /**
1381
+     * Returns a view to ownCloud's files folder
1382
+     *
1383
+     * @param string $userId user ID
1384
+     * @return \OCP\Files\Folder|null
1385
+     */
1386
+    public function getUserFolder($userId = null) {
1387
+        if ($userId === null) {
1388
+            $user = $this->getUserSession()->getUser();
1389
+            if (!$user) {
1390
+                return null;
1391
+            }
1392
+            $userId = $user->getUID();
1393
+        }
1394
+        $root = $this->getRootFolder();
1395
+        return $root->getUserFolder($userId);
1396
+    }
1397
+
1398
+    /**
1399
+     * Returns an app-specific view in ownClouds data directory
1400
+     *
1401
+     * @return \OCP\Files\Folder
1402
+     * @deprecated since 9.2.0 use IAppData
1403
+     */
1404
+    public function getAppFolder() {
1405
+        $dir = '/' . \OC_App::getCurrentApp();
1406
+        $root = $this->getRootFolder();
1407
+        if (!$root->nodeExists($dir)) {
1408
+            $folder = $root->newFolder($dir);
1409
+        } else {
1410
+            $folder = $root->get($dir);
1411
+        }
1412
+        return $folder;
1413
+    }
1414
+
1415
+    /**
1416
+     * @return \OC\User\Manager
1417
+     */
1418
+    public function getUserManager() {
1419
+        return $this->query('UserManager');
1420
+    }
1421
+
1422
+    /**
1423
+     * @return \OC\Group\Manager
1424
+     */
1425
+    public function getGroupManager() {
1426
+        return $this->query('GroupManager');
1427
+    }
1428
+
1429
+    /**
1430
+     * @return \OC\User\Session
1431
+     */
1432
+    public function getUserSession() {
1433
+        return $this->query('UserSession');
1434
+    }
1435
+
1436
+    /**
1437
+     * @return \OCP\ISession
1438
+     */
1439
+    public function getSession() {
1440
+        return $this->query('UserSession')->getSession();
1441
+    }
1442
+
1443
+    /**
1444
+     * @param \OCP\ISession $session
1445
+     */
1446
+    public function setSession(\OCP\ISession $session) {
1447
+        $this->query(SessionStorage::class)->setSession($session);
1448
+        $this->query('UserSession')->setSession($session);
1449
+        $this->query(Store::class)->setSession($session);
1450
+    }
1451
+
1452
+    /**
1453
+     * @return \OC\Authentication\TwoFactorAuth\Manager
1454
+     */
1455
+    public function getTwoFactorAuthManager() {
1456
+        return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
1457
+    }
1458
+
1459
+    /**
1460
+     * @return \OC\NavigationManager
1461
+     */
1462
+    public function getNavigationManager() {
1463
+        return $this->query('NavigationManager');
1464
+    }
1465
+
1466
+    /**
1467
+     * @return \OCP\IConfig
1468
+     */
1469
+    public function getConfig() {
1470
+        return $this->query('AllConfig');
1471
+    }
1472
+
1473
+    /**
1474
+     * @return \OC\SystemConfig
1475
+     */
1476
+    public function getSystemConfig() {
1477
+        return $this->query('SystemConfig');
1478
+    }
1479
+
1480
+    /**
1481
+     * Returns the app config manager
1482
+     *
1483
+     * @return \OCP\IAppConfig
1484
+     */
1485
+    public function getAppConfig() {
1486
+        return $this->query('AppConfig');
1487
+    }
1488
+
1489
+    /**
1490
+     * @return \OCP\L10N\IFactory
1491
+     */
1492
+    public function getL10NFactory() {
1493
+        return $this->query('L10NFactory');
1494
+    }
1495
+
1496
+    /**
1497
+     * get an L10N instance
1498
+     *
1499
+     * @param string $app appid
1500
+     * @param string $lang
1501
+     * @return IL10N
1502
+     */
1503
+    public function getL10N($app, $lang = null) {
1504
+        return $this->getL10NFactory()->get($app, $lang);
1505
+    }
1506
+
1507
+    /**
1508
+     * @return \OCP\IURLGenerator
1509
+     */
1510
+    public function getURLGenerator() {
1511
+        return $this->query('URLGenerator');
1512
+    }
1513
+
1514
+    /**
1515
+     * @return AppFetcher
1516
+     */
1517
+    public function getAppFetcher() {
1518
+        return $this->query(AppFetcher::class);
1519
+    }
1520
+
1521
+    /**
1522
+     * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
1523
+     * getMemCacheFactory() instead.
1524
+     *
1525
+     * @return \OCP\ICache
1526
+     * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
1527
+     */
1528
+    public function getCache() {
1529
+        return $this->query('UserCache');
1530
+    }
1531
+
1532
+    /**
1533
+     * Returns an \OCP\CacheFactory instance
1534
+     *
1535
+     * @return \OCP\ICacheFactory
1536
+     */
1537
+    public function getMemCacheFactory() {
1538
+        return $this->query('MemCacheFactory');
1539
+    }
1540
+
1541
+    /**
1542
+     * Returns an \OC\RedisFactory instance
1543
+     *
1544
+     * @return \OC\RedisFactory
1545
+     */
1546
+    public function getGetRedisFactory() {
1547
+        return $this->query('RedisFactory');
1548
+    }
1549
+
1550
+
1551
+    /**
1552
+     * Returns the current session
1553
+     *
1554
+     * @return \OCP\IDBConnection
1555
+     */
1556
+    public function getDatabaseConnection() {
1557
+        return $this->query('DatabaseConnection');
1558
+    }
1559
+
1560
+    /**
1561
+     * Returns the activity manager
1562
+     *
1563
+     * @return \OCP\Activity\IManager
1564
+     */
1565
+    public function getActivityManager() {
1566
+        return $this->query('ActivityManager');
1567
+    }
1568
+
1569
+    /**
1570
+     * Returns an job list for controlling background jobs
1571
+     *
1572
+     * @return \OCP\BackgroundJob\IJobList
1573
+     */
1574
+    public function getJobList() {
1575
+        return $this->query('JobList');
1576
+    }
1577
+
1578
+    /**
1579
+     * Returns a logger instance
1580
+     *
1581
+     * @return \OCP\ILogger
1582
+     */
1583
+    public function getLogger() {
1584
+        return $this->query('Logger');
1585
+    }
1586
+
1587
+    /**
1588
+     * @return ILogFactory
1589
+     * @throws \OCP\AppFramework\QueryException
1590
+     */
1591
+    public function getLogFactory() {
1592
+        return $this->query(ILogFactory::class);
1593
+    }
1594
+
1595
+    /**
1596
+     * Returns a router for generating and matching urls
1597
+     *
1598
+     * @return \OCP\Route\IRouter
1599
+     */
1600
+    public function getRouter() {
1601
+        return $this->query('Router');
1602
+    }
1603
+
1604
+    /**
1605
+     * Returns a search instance
1606
+     *
1607
+     * @return \OCP\ISearch
1608
+     */
1609
+    public function getSearch() {
1610
+        return $this->query('Search');
1611
+    }
1612
+
1613
+    /**
1614
+     * Returns a SecureRandom instance
1615
+     *
1616
+     * @return \OCP\Security\ISecureRandom
1617
+     */
1618
+    public function getSecureRandom() {
1619
+        return $this->query('SecureRandom');
1620
+    }
1621
+
1622
+    /**
1623
+     * Returns a Crypto instance
1624
+     *
1625
+     * @return \OCP\Security\ICrypto
1626
+     */
1627
+    public function getCrypto() {
1628
+        return $this->query('Crypto');
1629
+    }
1630
+
1631
+    /**
1632
+     * Returns a Hasher instance
1633
+     *
1634
+     * @return \OCP\Security\IHasher
1635
+     */
1636
+    public function getHasher() {
1637
+        return $this->query('Hasher');
1638
+    }
1639
+
1640
+    /**
1641
+     * Returns a CredentialsManager instance
1642
+     *
1643
+     * @return \OCP\Security\ICredentialsManager
1644
+     */
1645
+    public function getCredentialsManager() {
1646
+        return $this->query('CredentialsManager');
1647
+    }
1648
+
1649
+    /**
1650
+     * Get the certificate manager for the user
1651
+     *
1652
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
1653
+     * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
1654
+     */
1655
+    public function getCertificateManager($userId = '') {
1656
+        if ($userId === '') {
1657
+            $userSession = $this->getUserSession();
1658
+            $user = $userSession->getUser();
1659
+            if (is_null($user)) {
1660
+                return null;
1661
+            }
1662
+            $userId = $user->getUID();
1663
+        }
1664
+        return new CertificateManager(
1665
+            $userId,
1666
+            new View(),
1667
+            $this->getConfig(),
1668
+            $this->getLogger(),
1669
+            $this->getSecureRandom()
1670
+        );
1671
+    }
1672
+
1673
+    /**
1674
+     * Returns an instance of the HTTP client service
1675
+     *
1676
+     * @return \OCP\Http\Client\IClientService
1677
+     */
1678
+    public function getHTTPClientService() {
1679
+        return $this->query('HttpClientService');
1680
+    }
1681
+
1682
+    /**
1683
+     * Create a new event source
1684
+     *
1685
+     * @return \OCP\IEventSource
1686
+     */
1687
+    public function createEventSource() {
1688
+        return new \OC_EventSource();
1689
+    }
1690
+
1691
+    /**
1692
+     * Get the active event logger
1693
+     *
1694
+     * The returned logger only logs data when debug mode is enabled
1695
+     *
1696
+     * @return \OCP\Diagnostics\IEventLogger
1697
+     */
1698
+    public function getEventLogger() {
1699
+        return $this->query('EventLogger');
1700
+    }
1701
+
1702
+    /**
1703
+     * Get the active query logger
1704
+     *
1705
+     * The returned logger only logs data when debug mode is enabled
1706
+     *
1707
+     * @return \OCP\Diagnostics\IQueryLogger
1708
+     */
1709
+    public function getQueryLogger() {
1710
+        return $this->query('QueryLogger');
1711
+    }
1712
+
1713
+    /**
1714
+     * Get the manager for temporary files and folders
1715
+     *
1716
+     * @return \OCP\ITempManager
1717
+     */
1718
+    public function getTempManager() {
1719
+        return $this->query('TempManager');
1720
+    }
1721
+
1722
+    /**
1723
+     * Get the app manager
1724
+     *
1725
+     * @return \OCP\App\IAppManager
1726
+     */
1727
+    public function getAppManager() {
1728
+        return $this->query('AppManager');
1729
+    }
1730
+
1731
+    /**
1732
+     * Creates a new mailer
1733
+     *
1734
+     * @return \OCP\Mail\IMailer
1735
+     */
1736
+    public function getMailer() {
1737
+        return $this->query('Mailer');
1738
+    }
1739
+
1740
+    /**
1741
+     * Get the webroot
1742
+     *
1743
+     * @return string
1744
+     */
1745
+    public function getWebRoot() {
1746
+        return $this->webRoot;
1747
+    }
1748
+
1749
+    /**
1750
+     * @return \OC\OCSClient
1751
+     */
1752
+    public function getOcsClient() {
1753
+        return $this->query('OcsClient');
1754
+    }
1755
+
1756
+    /**
1757
+     * @return \OCP\IDateTimeZone
1758
+     */
1759
+    public function getDateTimeZone() {
1760
+        return $this->query('DateTimeZone');
1761
+    }
1762
+
1763
+    /**
1764
+     * @return \OCP\IDateTimeFormatter
1765
+     */
1766
+    public function getDateTimeFormatter() {
1767
+        return $this->query('DateTimeFormatter');
1768
+    }
1769
+
1770
+    /**
1771
+     * @return \OCP\Files\Config\IMountProviderCollection
1772
+     */
1773
+    public function getMountProviderCollection() {
1774
+        return $this->query('MountConfigManager');
1775
+    }
1776
+
1777
+    /**
1778
+     * Get the IniWrapper
1779
+     *
1780
+     * @return IniGetWrapper
1781
+     */
1782
+    public function getIniWrapper() {
1783
+        return $this->query('IniWrapper');
1784
+    }
1785
+
1786
+    /**
1787
+     * @return \OCP\Command\IBus
1788
+     */
1789
+    public function getCommandBus() {
1790
+        return $this->query('AsyncCommandBus');
1791
+    }
1792
+
1793
+    /**
1794
+     * Get the trusted domain helper
1795
+     *
1796
+     * @return TrustedDomainHelper
1797
+     */
1798
+    public function getTrustedDomainHelper() {
1799
+        return $this->query('TrustedDomainHelper');
1800
+    }
1801
+
1802
+    /**
1803
+     * Get the locking provider
1804
+     *
1805
+     * @return \OCP\Lock\ILockingProvider
1806
+     * @since 8.1.0
1807
+     */
1808
+    public function getLockingProvider() {
1809
+        return $this->query('LockingProvider');
1810
+    }
1811
+
1812
+    /**
1813
+     * @return \OCP\Files\Mount\IMountManager
1814
+     **/
1815
+    function getMountManager() {
1816
+        return $this->query('MountManager');
1817
+    }
1818
+
1819
+    /** @return \OCP\Files\Config\IUserMountCache */
1820
+    function getUserMountCache() {
1821
+        return $this->query('UserMountCache');
1822
+    }
1823
+
1824
+    /**
1825
+     * Get the MimeTypeDetector
1826
+     *
1827
+     * @return \OCP\Files\IMimeTypeDetector
1828
+     */
1829
+    public function getMimeTypeDetector() {
1830
+        return $this->query('MimeTypeDetector');
1831
+    }
1832
+
1833
+    /**
1834
+     * Get the MimeTypeLoader
1835
+     *
1836
+     * @return \OCP\Files\IMimeTypeLoader
1837
+     */
1838
+    public function getMimeTypeLoader() {
1839
+        return $this->query('MimeTypeLoader');
1840
+    }
1841
+
1842
+    /**
1843
+     * Get the manager of all the capabilities
1844
+     *
1845
+     * @return \OC\CapabilitiesManager
1846
+     */
1847
+    public function getCapabilitiesManager() {
1848
+        return $this->query('CapabilitiesManager');
1849
+    }
1850
+
1851
+    /**
1852
+     * Get the EventDispatcher
1853
+     *
1854
+     * @return EventDispatcherInterface
1855
+     * @since 8.2.0
1856
+     */
1857
+    public function getEventDispatcher() {
1858
+        return $this->query(\OC\EventDispatcher\SymfonyAdapter::class);
1859
+    }
1860
+
1861
+    /**
1862
+     * Get the Notification Manager
1863
+     *
1864
+     * @return \OCP\Notification\IManager
1865
+     * @since 8.2.0
1866
+     */
1867
+    public function getNotificationManager() {
1868
+        return $this->query('NotificationManager');
1869
+    }
1870
+
1871
+    /**
1872
+     * @return \OCP\Comments\ICommentsManager
1873
+     */
1874
+    public function getCommentsManager() {
1875
+        return $this->query('CommentsManager');
1876
+    }
1877
+
1878
+    /**
1879
+     * @return \OCA\Theming\ThemingDefaults
1880
+     */
1881
+    public function getThemingDefaults() {
1882
+        return $this->query('ThemingDefaults');
1883
+    }
1884
+
1885
+    /**
1886
+     * @return \OC\IntegrityCheck\Checker
1887
+     */
1888
+    public function getIntegrityCodeChecker() {
1889
+        return $this->query('IntegrityCodeChecker');
1890
+    }
1891
+
1892
+    /**
1893
+     * @return \OC\Session\CryptoWrapper
1894
+     */
1895
+    public function getSessionCryptoWrapper() {
1896
+        return $this->query('CryptoWrapper');
1897
+    }
1898
+
1899
+    /**
1900
+     * @return CsrfTokenManager
1901
+     */
1902
+    public function getCsrfTokenManager() {
1903
+        return $this->query(CsrfTokenManager::class);
1904
+    }
1905
+
1906
+    /**
1907
+     * @return Throttler
1908
+     */
1909
+    public function getBruteForceThrottler() {
1910
+        return $this->query('Throttler');
1911
+    }
1912
+
1913
+    /**
1914
+     * @return IContentSecurityPolicyManager
1915
+     */
1916
+    public function getContentSecurityPolicyManager() {
1917
+        return $this->query('ContentSecurityPolicyManager');
1918
+    }
1919
+
1920
+    /**
1921
+     * @return ContentSecurityPolicyNonceManager
1922
+     */
1923
+    public function getContentSecurityPolicyNonceManager() {
1924
+        return $this->query('ContentSecurityPolicyNonceManager');
1925
+    }
1926
+
1927
+    /**
1928
+     * Not a public API as of 8.2, wait for 9.0
1929
+     *
1930
+     * @return \OCA\Files_External\Service\BackendService
1931
+     */
1932
+    public function getStoragesBackendService() {
1933
+        return $this->query('OCA\\Files_External\\Service\\BackendService');
1934
+    }
1935
+
1936
+    /**
1937
+     * Not a public API as of 8.2, wait for 9.0
1938
+     *
1939
+     * @return \OCA\Files_External\Service\GlobalStoragesService
1940
+     */
1941
+    public function getGlobalStoragesService() {
1942
+        return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
1943
+    }
1944
+
1945
+    /**
1946
+     * Not a public API as of 8.2, wait for 9.0
1947
+     *
1948
+     * @return \OCA\Files_External\Service\UserGlobalStoragesService
1949
+     */
1950
+    public function getUserGlobalStoragesService() {
1951
+        return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
1952
+    }
1953
+
1954
+    /**
1955
+     * Not a public API as of 8.2, wait for 9.0
1956
+     *
1957
+     * @return \OCA\Files_External\Service\UserStoragesService
1958
+     */
1959
+    public function getUserStoragesService() {
1960
+        return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
1961
+    }
1962
+
1963
+    /**
1964
+     * @return \OCP\Share\IManager
1965
+     */
1966
+    public function getShareManager() {
1967
+        return $this->query('ShareManager');
1968
+    }
1969
+
1970
+    /**
1971
+     * @return \OCP\Collaboration\Collaborators\ISearch
1972
+     */
1973
+    public function getCollaboratorSearch() {
1974
+        return $this->query('CollaboratorSearch');
1975
+    }
1976
+
1977
+    /**
1978
+     * @return \OCP\Collaboration\AutoComplete\IManager
1979
+     */
1980
+    public function getAutoCompleteManager(){
1981
+        return $this->query(IManager::class);
1982
+    }
1983
+
1984
+    /**
1985
+     * Returns the LDAP Provider
1986
+     *
1987
+     * @return \OCP\LDAP\ILDAPProvider
1988
+     */
1989
+    public function getLDAPProvider() {
1990
+        return $this->query('LDAPProvider');
1991
+    }
1992
+
1993
+    /**
1994
+     * @return \OCP\Settings\IManager
1995
+     */
1996
+    public function getSettingsManager() {
1997
+        return $this->query('SettingsManager');
1998
+    }
1999
+
2000
+    /**
2001
+     * @return \OCP\Files\IAppData
2002
+     */
2003
+    public function getAppDataDir($app) {
2004
+        /** @var \OC\Files\AppData\Factory $factory */
2005
+        $factory = $this->query(\OC\Files\AppData\Factory::class);
2006
+        return $factory->get($app);
2007
+    }
2008
+
2009
+    /**
2010
+     * @return \OCP\Lockdown\ILockdownManager
2011
+     */
2012
+    public function getLockdownManager() {
2013
+        return $this->query('LockdownManager');
2014
+    }
2015
+
2016
+    /**
2017
+     * @return \OCP\Federation\ICloudIdManager
2018
+     */
2019
+    public function getCloudIdManager() {
2020
+        return $this->query(ICloudIdManager::class);
2021
+    }
2022
+
2023
+    /**
2024
+     * @return \OCP\GlobalScale\IConfig
2025
+     */
2026
+    public function getGlobalScaleConfig() {
2027
+        return $this->query(IConfig::class);
2028
+    }
2029
+
2030
+    /**
2031
+     * @return \OCP\Federation\ICloudFederationProviderManager
2032
+     */
2033
+    public function getCloudFederationProviderManager() {
2034
+        return $this->query(ICloudFederationProviderManager::class);
2035
+    }
2036
+
2037
+    /**
2038
+     * @return \OCP\Remote\Api\IApiFactory
2039
+     */
2040
+    public function getRemoteApiFactory() {
2041
+        return $this->query(IApiFactory::class);
2042
+    }
2043
+
2044
+    /**
2045
+     * @return \OCP\Federation\ICloudFederationFactory
2046
+     */
2047
+    public function getCloudFederationFactory() {
2048
+        return $this->query(ICloudFederationFactory::class);
2049
+    }
2050
+
2051
+    /**
2052
+     * @return \OCP\Remote\IInstanceFactory
2053
+     */
2054
+    public function getRemoteInstanceFactory() {
2055
+        return $this->query(IInstanceFactory::class);
2056
+    }
2057
+
2058
+    /**
2059
+     * @return IStorageFactory
2060
+     */
2061
+    public function getStorageFactory() {
2062
+        return $this->query(IStorageFactory::class);
2063
+    }
2064
+
2065
+    /**
2066
+     * Get the Preview GeneratorHelper
2067
+     *
2068
+     * @return GeneratorHelper
2069
+     * @since 17.0.0
2070
+     */
2071
+    public function getGeneratorHelper() {
2072
+        return $this->query(\OC\Preview\GeneratorHelper::class);
2073
+    }
2074 2074
 }
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 		// To find out if we are running from CLI or not
183 183
 		$this->registerParameter('isCLI', \OC::$CLI);
184 184
 
185
-		$this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) {
185
+		$this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) {
186 186
 			return $c;
187 187
 		});
188 188
 
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 		$this->registerAlias(IActionFactory::class, ActionFactory::class);
202 202
 
203 203
 
204
-		$this->registerService(\OCP\IPreview::class, function (Server $c) {
204
+		$this->registerService(\OCP\IPreview::class, function(Server $c) {
205 205
 			return new PreviewManager(
206 206
 				$c->getConfig(),
207 207
 				$c->getRootFolder(),
@@ -213,13 +213,13 @@  discard block
 block discarded – undo
213 213
 		});
214 214
 		$this->registerAlias('PreviewManager', \OCP\IPreview::class);
215 215
 
216
-		$this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
216
+		$this->registerService(\OC\Preview\Watcher::class, function(Server $c) {
217 217
 			return new \OC\Preview\Watcher(
218 218
 				$c->getAppDataDir('preview')
219 219
 			);
220 220
 		});
221 221
 
222
-		$this->registerService(\OCP\Encryption\IManager::class, function (Server $c) {
222
+		$this->registerService(\OCP\Encryption\IManager::class, function(Server $c) {
223 223
 			$view = new View();
224 224
 			$util = new Encryption\Util(
225 225
 				$view,
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		});
239 239
 		$this->registerAlias('EncryptionManager', \OCP\Encryption\IManager::class);
240 240
 
241
-		$this->registerService('EncryptionFileHelper', function (Server $c) {
241
+		$this->registerService('EncryptionFileHelper', function(Server $c) {
242 242
 			$util = new Encryption\Util(
243 243
 				new View(),
244 244
 				$c->getUserManager(),
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 			);
253 253
 		});
254 254
 
255
-		$this->registerService('EncryptionKeyStorage', function (Server $c) {
255
+		$this->registerService('EncryptionKeyStorage', function(Server $c) {
256 256
 			$view = new View();
257 257
 			$util = new Encryption\Util(
258 258
 				$view,
@@ -263,30 +263,30 @@  discard block
 block discarded – undo
263 263
 
264 264
 			return new Encryption\Keys\Storage($view, $util);
265 265
 		});
266
-		$this->registerService('TagMapper', function (Server $c) {
266
+		$this->registerService('TagMapper', function(Server $c) {
267 267
 			return new TagMapper($c->getDatabaseConnection());
268 268
 		});
269 269
 
270
-		$this->registerService(\OCP\ITagManager::class, function (Server $c) {
270
+		$this->registerService(\OCP\ITagManager::class, function(Server $c) {
271 271
 			$tagMapper = $c->query('TagMapper');
272 272
 			return new TagManager($tagMapper, $c->getUserSession());
273 273
 		});
274 274
 		$this->registerAlias('TagManager', \OCP\ITagManager::class);
275 275
 
276
-		$this->registerService('SystemTagManagerFactory', function (Server $c) {
276
+		$this->registerService('SystemTagManagerFactory', function(Server $c) {
277 277
 			$config = $c->getConfig();
278 278
 			$factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
279 279
 			return new $factoryClass($this);
280 280
 		});
281
-		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
281
+		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) {
282 282
 			return $c->query('SystemTagManagerFactory')->getManager();
283 283
 		});
284 284
 		$this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
285 285
 
286
-		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
286
+		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) {
287 287
 			return $c->query('SystemTagManagerFactory')->getObjectMapper();
288 288
 		});
289
-		$this->registerService('RootFolder', function (Server $c) {
289
+		$this->registerService('RootFolder', function(Server $c) {
290 290
 			$manager = \OC\Files\Filesystem::getMountManager(null);
291 291
 			$view = new View();
292 292
 			$root = new Root(
@@ -307,37 +307,37 @@  discard block
 block discarded – undo
307 307
 		});
308 308
 		$this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
309 309
 
310
-		$this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) {
311
-			return new LazyRoot(function () use ($c) {
310
+		$this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) {
311
+			return new LazyRoot(function() use ($c) {
312 312
 				return $c->query('RootFolder');
313 313
 			});
314 314
 		});
315 315
 		$this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
316 316
 
317
-		$this->registerService(\OC\User\Manager::class, function (Server $c) {
317
+		$this->registerService(\OC\User\Manager::class, function(Server $c) {
318 318
 			return new \OC\User\Manager($c->getConfig(), $c->getEventDispatcher());
319 319
 		});
320 320
 		$this->registerAlias('UserManager', \OC\User\Manager::class);
321 321
 		$this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
322 322
 
323
-		$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
323
+		$this->registerService(\OCP\IGroupManager::class, function(Server $c) {
324 324
 			$groupManager = new \OC\Group\Manager($this->getUserManager(), $c->getEventDispatcher(), $this->getLogger());
325
-			$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
325
+			$groupManager->listen('\OC\Group', 'preCreate', function($gid) {
326 326
 				\OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
327 327
 			});
328
-			$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
328
+			$groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) {
329 329
 				\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
330 330
 			});
331
-			$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
331
+			$groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) {
332 332
 				\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
333 333
 			});
334
-			$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
334
+			$groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) {
335 335
 				\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
336 336
 			});
337
-			$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
337
+			$groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) {
338 338
 				\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
339 339
 			});
340
-			$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
340
+			$groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) {
341 341
 				\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
342 342
 				//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
343 343
 				\OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 		});
347 347
 		$this->registerAlias('GroupManager', \OCP\IGroupManager::class);
348 348
 
349
-		$this->registerService(Store::class, function (Server $c) {
349
+		$this->registerService(Store::class, function(Server $c) {
350 350
 			$session = $c->getSession();
351 351
 			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
352 352
 				$tokenProvider = $c->query(IProvider::class);
@@ -357,13 +357,13 @@  discard block
 block discarded – undo
357 357
 			return new Store($session, $logger, $tokenProvider);
358 358
 		});
359 359
 		$this->registerAlias(IStore::class, Store::class);
360
-		$this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
360
+		$this->registerService(Authentication\Token\DefaultTokenMapper::class, function(Server $c) {
361 361
 			$dbConnection = $c->getDatabaseConnection();
362 362
 			return new Authentication\Token\DefaultTokenMapper($dbConnection);
363 363
 		});
364 364
 		$this->registerAlias(IProvider::class, Authentication\Token\Manager::class);
365 365
 
366
-		$this->registerService(\OC\User\Session::class, function (Server $c) {
366
+		$this->registerService(\OC\User\Session::class, function(Server $c) {
367 367
 			$manager = $c->getUserManager();
368 368
 			$session = new \OC\Session\Memory('');
369 369
 			$timeFactory = new TimeFactory();
@@ -387,45 +387,45 @@  discard block
 block discarded – undo
387 387
 				$c->getLockdownManager(),
388 388
 				$c->getLogger()
389 389
 			);
390
-			$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
390
+			$userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) {
391 391
 				\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
392 392
 			});
393
-			$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
393
+			$userSession->listen('\OC\User', 'postCreateUser', function($user, $password) {
394 394
 				/** @var $user \OC\User\User */
395 395
 				\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
396 396
 			});
397
-			$userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) {
397
+			$userSession->listen('\OC\User', 'preDelete', function($user) use ($dispatcher) {
398 398
 				/** @var $user \OC\User\User */
399 399
 				\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
400 400
 				$dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
401 401
 			});
402
-			$userSession->listen('\OC\User', 'postDelete', function ($user) {
402
+			$userSession->listen('\OC\User', 'postDelete', function($user) {
403 403
 				/** @var $user \OC\User\User */
404 404
 				\OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
405 405
 			});
406
-			$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
406
+			$userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) {
407 407
 				/** @var $user \OC\User\User */
408 408
 				\OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
409 409
 			});
410
-			$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
410
+			$userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) {
411 411
 				/** @var $user \OC\User\User */
412 412
 				\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
413 413
 			});
414
-			$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
414
+			$userSession->listen('\OC\User', 'preLogin', function($uid, $password) {
415 415
 				\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
416 416
 			});
417
-			$userSession->listen('\OC\User', 'postLogin', function ($user, $password, $isTokenLogin) {
417
+			$userSession->listen('\OC\User', 'postLogin', function($user, $password, $isTokenLogin) {
418 418
 				/** @var $user \OC\User\User */
419 419
 				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'isTokenLogin' => $isTokenLogin));
420 420
 			});
421
-			$userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
421
+			$userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) {
422 422
 				/** @var $user \OC\User\User */
423 423
 				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
424 424
 			});
425
-			$userSession->listen('\OC\User', 'logout', function () {
425
+			$userSession->listen('\OC\User', 'logout', function() {
426 426
 				\OC_Hook::emit('OC_User', 'logout', array());
427 427
 			});
428
-			$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) {
428
+			$userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) {
429 429
 				/** @var $user \OC\User\User */
430 430
 				\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
431 431
 			});
@@ -439,7 +439,7 @@  discard block
 block discarded – undo
439 439
 		$this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
440 440
 		$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
441 441
 
442
-		$this->registerService(\OC\AllConfig::class, function (Server $c) {
442
+		$this->registerService(\OC\AllConfig::class, function(Server $c) {
443 443
 			return new \OC\AllConfig(
444 444
 				$c->getSystemConfig()
445 445
 			);
@@ -447,17 +447,17 @@  discard block
 block discarded – undo
447 447
 		$this->registerAlias('AllConfig', \OC\AllConfig::class);
448 448
 		$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
449 449
 
450
-		$this->registerService('SystemConfig', function ($c) use ($config) {
450
+		$this->registerService('SystemConfig', function($c) use ($config) {
451 451
 			return new \OC\SystemConfig($config);
452 452
 		});
453 453
 
454
-		$this->registerService(\OC\AppConfig::class, function (Server $c) {
454
+		$this->registerService(\OC\AppConfig::class, function(Server $c) {
455 455
 			return new \OC\AppConfig($c->getDatabaseConnection());
456 456
 		});
457 457
 		$this->registerAlias('AppConfig', \OC\AppConfig::class);
458 458
 		$this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
459 459
 
460
-		$this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
460
+		$this->registerService(\OCP\L10N\IFactory::class, function(Server $c) {
461 461
 			return new \OC\L10N\Factory(
462 462
 				$c->getConfig(),
463 463
 				$c->getRequest(),
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		});
468 468
 		$this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
469 469
 
470
-		$this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
470
+		$this->registerService(\OCP\IURLGenerator::class, function(Server $c) {
471 471
 			$config = $c->getConfig();
472 472
 			$cacheFactory = $c->getMemCacheFactory();
473 473
 			$request = $c->getRequest();
@@ -482,12 +482,12 @@  discard block
 block discarded – undo
482 482
 		$this->registerAlias('AppFetcher', AppFetcher::class);
483 483
 		$this->registerAlias('CategoryFetcher', CategoryFetcher::class);
484 484
 
485
-		$this->registerService(\OCP\ICache::class, function ($c) {
485
+		$this->registerService(\OCP\ICache::class, function($c) {
486 486
 			return new Cache\File();
487 487
 		});
488 488
 		$this->registerAlias('UserCache', \OCP\ICache::class);
489 489
 
490
-		$this->registerService(Factory::class, function (Server $c) {
490
+		$this->registerService(Factory::class, function(Server $c) {
491 491
 
492 492
 			$arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
493 493
 				ArrayCache::class,
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 				$version = implode(',', $v);
503 503
 				$instanceId = \OC_Util::getInstanceId();
504 504
 				$path = \OC::$SERVERROOT;
505
-				$prefix = md5($instanceId . '-' . $version . '-' . $path);
505
+				$prefix = md5($instanceId.'-'.$version.'-'.$path);
506 506
 				return new \OC\Memcache\Factory($prefix, $c->getLogger(),
507 507
 					$config->getSystemValue('memcache.local', null),
508 508
 					$config->getSystemValue('memcache.distributed', null),
@@ -515,12 +515,12 @@  discard block
 block discarded – undo
515 515
 		$this->registerAlias('MemCacheFactory', Factory::class);
516 516
 		$this->registerAlias(ICacheFactory::class, Factory::class);
517 517
 
518
-		$this->registerService('RedisFactory', function (Server $c) {
518
+		$this->registerService('RedisFactory', function(Server $c) {
519 519
 			$systemConfig = $c->getSystemConfig();
520 520
 			return new RedisFactory($systemConfig);
521 521
 		});
522 522
 
523
-		$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
523
+		$this->registerService(\OCP\Activity\IManager::class, function(Server $c) {
524 524
 			return new \OC\Activity\Manager(
525 525
 				$c->getRequest(),
526 526
 				$c->getUserSession(),
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 		});
531 531
 		$this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
532 532
 
533
-		$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
533
+		$this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) {
534 534
 			return new \OC\Activity\EventMerger(
535 535
 				$c->getL10N('lib')
536 536
 			);
@@ -552,7 +552,7 @@  discard block
 block discarded – undo
552 552
 		$this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
553 553
 		$this->registerAlias(\OCP\Support\Subscription\IRegistry::class, \OC\Support\Subscription\Registry::class);
554 554
 
555
-		$this->registerService(\OC\Log::class, function (Server $c) {
555
+		$this->registerService(\OC\Log::class, function(Server $c) {
556 556
 			$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
557 557
 			$factory = new LogFactory($c, $this->getSystemConfig());
558 558
 			$logger = $factory->get($logType);
@@ -563,11 +563,11 @@  discard block
 block discarded – undo
563 563
 		$this->registerAlias(\OCP\ILogger::class, \OC\Log::class);
564 564
 		$this->registerAlias('Logger', \OC\Log::class);
565 565
 
566
-		$this->registerService(ILogFactory::class, function (Server $c) {
566
+		$this->registerService(ILogFactory::class, function(Server $c) {
567 567
 			return new LogFactory($c, $this->getSystemConfig());
568 568
 		});
569 569
 
570
-		$this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
570
+		$this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) {
571 571
 			$config = $c->getConfig();
572 572
 			return new \OC\BackgroundJob\JobList(
573 573
 				$c->getDatabaseConnection(),
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		});
578 578
 		$this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
579 579
 
580
-		$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
580
+		$this->registerService(\OCP\Route\IRouter::class, function(Server $c) {
581 581
 			$cacheFactory = $c->getMemCacheFactory();
582 582
 			$logger = $c->getLogger();
583 583
 			if ($cacheFactory->isLocalCacheAvailable()) {
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
 		});
590 590
 		$this->registerAlias('Router', \OCP\Route\IRouter::class);
591 591
 
592
-		$this->registerService(\OCP\ISearch::class, function ($c) {
592
+		$this->registerService(\OCP\ISearch::class, function($c) {
593 593
 			return new Search();
594 594
 		});
595 595
 		$this->registerAlias('Search', \OCP\ISearch::class);
596 596
 
597
-		$this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) {
597
+		$this->registerService(\OC\Security\RateLimiting\Limiter::class, function(Server $c) {
598 598
 			return new \OC\Security\RateLimiting\Limiter(
599 599
 				$this->getUserSession(),
600 600
 				$this->getRequest(),
@@ -602,34 +602,34 @@  discard block
 block discarded – undo
602 602
 				$c->query(\OC\Security\RateLimiting\Backend\IBackend::class)
603 603
 			);
604 604
 		});
605
-		$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
605
+		$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) {
606 606
 			return new \OC\Security\RateLimiting\Backend\MemoryCache(
607 607
 				$this->getMemCacheFactory(),
608 608
 				new \OC\AppFramework\Utility\TimeFactory()
609 609
 			);
610 610
 		});
611 611
 
612
-		$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
612
+		$this->registerService(\OCP\Security\ISecureRandom::class, function($c) {
613 613
 			return new SecureRandom();
614 614
 		});
615 615
 		$this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
616 616
 
617
-		$this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
617
+		$this->registerService(\OCP\Security\ICrypto::class, function(Server $c) {
618 618
 			return new Crypto($c->getConfig(), $c->getSecureRandom());
619 619
 		});
620 620
 		$this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
621 621
 
622
-		$this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
622
+		$this->registerService(\OCP\Security\IHasher::class, function(Server $c) {
623 623
 			return new Hasher($c->getConfig());
624 624
 		});
625 625
 		$this->registerAlias('Hasher', \OCP\Security\IHasher::class);
626 626
 
627
-		$this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
627
+		$this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) {
628 628
 			return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
629 629
 		});
630 630
 		$this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
631 631
 
632
-		$this->registerService(IDBConnection::class, function (Server $c) {
632
+		$this->registerService(IDBConnection::class, function(Server $c) {
633 633
 			$systemConfig = $c->getSystemConfig();
634 634
 			$factory = new \OC\DB\ConnectionFactory($systemConfig);
635 635
 			$type = $systemConfig->getValue('dbtype', 'sqlite');
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 		$this->registerAlias('DatabaseConnection', IDBConnection::class);
645 645
 
646 646
 
647
-		$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
647
+		$this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) {
648 648
 			$user = \OC_User::getUser();
649 649
 			$uid = $user ? $user : null;
650 650
 			return new ClientService(
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 			);
660 660
 		});
661 661
 		$this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
662
-		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
662
+		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) {
663 663
 			$eventLogger = new EventLogger();
664 664
 			if ($c->getSystemConfig()->getValue('debug', false)) {
665 665
 				// In debug mode, module is being activated by default
@@ -669,7 +669,7 @@  discard block
 block discarded – undo
669 669
 		});
670 670
 		$this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
671 671
 
672
-		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
672
+		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) {
673 673
 			$queryLogger = new QueryLogger();
674 674
 			if ($c->getSystemConfig()->getValue('debug', false)) {
675 675
 				// In debug mode, module is being activated by default
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 		});
680 680
 		$this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
681 681
 
682
-		$this->registerService(TempManager::class, function (Server $c) {
682
+		$this->registerService(TempManager::class, function(Server $c) {
683 683
 			return new TempManager(
684 684
 				$c->getLogger(),
685 685
 				$c->getConfig()
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 		$this->registerAlias('TempManager', TempManager::class);
689 689
 		$this->registerAlias(ITempManager::class, TempManager::class);
690 690
 
691
-		$this->registerService(AppManager::class, function (Server $c) {
691
+		$this->registerService(AppManager::class, function(Server $c) {
692 692
 			return new \OC\App\AppManager(
693 693
 				$c->getUserSession(),
694 694
 				$c->query(\OC\AppConfig::class),
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 		$this->registerAlias('AppManager', AppManager::class);
701 701
 		$this->registerAlias(IAppManager::class, AppManager::class);
702 702
 
703
-		$this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
703
+		$this->registerService(\OCP\IDateTimeZone::class, function(Server $c) {
704 704
 			return new DateTimeZone(
705 705
 				$c->getConfig(),
706 706
 				$c->getSession()
@@ -708,7 +708,7 @@  discard block
 block discarded – undo
708 708
 		});
709 709
 		$this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
710 710
 
711
-		$this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
711
+		$this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) {
712 712
 			$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
713 713
 
714 714
 			return new DateTimeFormatter(
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
 		});
719 719
 		$this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
720 720
 
721
-		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
721
+		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) {
722 722
 			$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
723 723
 			$listener = new UserMountCacheListener($mountCache);
724 724
 			$listener->listen($c->getUserManager());
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
 		});
727 727
 		$this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
728 728
 
729
-		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
729
+		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) {
730 730
 			$loader = \OC\Files\Filesystem::getLoader();
731 731
 			$mountCache = $c->query('UserMountCache');
732 732
 			$manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
@@ -742,10 +742,10 @@  discard block
 block discarded – undo
742 742
 		});
743 743
 		$this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
744 744
 
745
-		$this->registerService('IniWrapper', function ($c) {
745
+		$this->registerService('IniWrapper', function($c) {
746 746
 			return new IniGetWrapper();
747 747
 		});
748
-		$this->registerService('AsyncCommandBus', function (Server $c) {
748
+		$this->registerService('AsyncCommandBus', function(Server $c) {
749 749
 			$busClass = $c->getConfig()->getSystemValue('commandbus');
750 750
 			if ($busClass) {
751 751
 				list($app, $class) = explode('::', $busClass, 2);
@@ -760,10 +760,10 @@  discard block
 block discarded – undo
760 760
 				return new CronBus($jobList);
761 761
 			}
762 762
 		});
763
-		$this->registerService('TrustedDomainHelper', function ($c) {
763
+		$this->registerService('TrustedDomainHelper', function($c) {
764 764
 			return new TrustedDomainHelper($this->getConfig());
765 765
 		});
766
-		$this->registerService(Throttler::class, function (Server $c) {
766
+		$this->registerService(Throttler::class, function(Server $c) {
767 767
 			return new Throttler(
768 768
 				$c->getDatabaseConnection(),
769 769
 				new TimeFactory(),
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
 			);
773 773
 		});
774 774
 		$this->registerAlias('Throttler', Throttler::class);
775
-		$this->registerService('IntegrityCodeChecker', function (Server $c) {
775
+		$this->registerService('IntegrityCodeChecker', function(Server $c) {
776 776
 			// IConfig and IAppManager requires a working database. This code
777 777
 			// might however be called when ownCloud is not yet setup.
778 778
 			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
@@ -794,7 +794,7 @@  discard block
 block discarded – undo
794 794
 				$c->getMimeTypeDetector()
795 795
 			);
796 796
 		});
797
-		$this->registerService(\OCP\IRequest::class, function ($c) {
797
+		$this->registerService(\OCP\IRequest::class, function($c) {
798 798
 			if (isset($this['urlParams'])) {
799 799
 				$urlParams = $this['urlParams'];
800 800
 			} else {
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 		});
831 831
 		$this->registerAlias('Request', \OCP\IRequest::class);
832 832
 
833
-		$this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
833
+		$this->registerService(\OCP\Mail\IMailer::class, function(Server $c) {
834 834
 			return new Mailer(
835 835
 				$c->getConfig(),
836 836
 				$c->getLogger(),
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 		});
842 842
 		$this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
843 843
 
844
-		$this->registerService('LDAPProvider', function (Server $c) {
844
+		$this->registerService('LDAPProvider', function(Server $c) {
845 845
 			$config = $c->getConfig();
846 846
 			$factoryClass = $config->getSystemValue('ldapProviderFactory', null);
847 847
 			if (is_null($factoryClass)) {
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 			$factory = new $factoryClass($this);
852 852
 			return $factory->getLDAPProvider();
853 853
 		});
854
-		$this->registerService(ILockingProvider::class, function (Server $c) {
854
+		$this->registerService(ILockingProvider::class, function(Server $c) {
855 855
 			$ini = $c->getIniWrapper();
856 856
 			$config = $c->getConfig();
857 857
 			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
@@ -874,49 +874,49 @@  discard block
 block discarded – undo
874 874
 		});
875 875
 		$this->registerAlias('LockingProvider', ILockingProvider::class);
876 876
 
877
-		$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
877
+		$this->registerService(\OCP\Files\Mount\IMountManager::class, function() {
878 878
 			return new \OC\Files\Mount\Manager();
879 879
 		});
880 880
 		$this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
881 881
 
882
-		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
882
+		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) {
883 883
 			return new \OC\Files\Type\Detection(
884 884
 				$c->getURLGenerator(),
885 885
 				\OC::$configDir,
886
-				\OC::$SERVERROOT . '/resources/config/'
886
+				\OC::$SERVERROOT.'/resources/config/'
887 887
 			);
888 888
 		});
889 889
 		$this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
890 890
 
891
-		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
891
+		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) {
892 892
 			return new \OC\Files\Type\Loader(
893 893
 				$c->getDatabaseConnection()
894 894
 			);
895 895
 		});
896 896
 		$this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
897
-		$this->registerService(BundleFetcher::class, function () {
897
+		$this->registerService(BundleFetcher::class, function() {
898 898
 			return new BundleFetcher($this->getL10N('lib'));
899 899
 		});
900
-		$this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
900
+		$this->registerService(\OCP\Notification\IManager::class, function(Server $c) {
901 901
 			return new Manager(
902 902
 				$c->query(IValidator::class)
903 903
 			);
904 904
 		});
905 905
 		$this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
906 906
 
907
-		$this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
907
+		$this->registerService(\OC\CapabilitiesManager::class, function(Server $c) {
908 908
 			$manager = new \OC\CapabilitiesManager($c->getLogger());
909
-			$manager->registerCapability(function () use ($c) {
909
+			$manager->registerCapability(function() use ($c) {
910 910
 				return new \OC\OCS\CoreCapabilities($c->getConfig());
911 911
 			});
912
-			$manager->registerCapability(function () use ($c) {
912
+			$manager->registerCapability(function() use ($c) {
913 913
 				return $c->query(\OC\Security\Bruteforce\Capabilities::class);
914 914
 			});
915 915
 			return $manager;
916 916
 		});
917 917
 		$this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
918 918
 
919
-		$this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
919
+		$this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) {
920 920
 			$config = $c->getConfig();
921 921
 			$factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
922 922
 			/** @var \OCP\Comments\ICommentsManagerFactory $factory */
@@ -926,7 +926,7 @@  discard block
 block discarded – undo
926 926
 			$manager->registerDisplayNameResolver('user', function($id) use ($c) {
927 927
 				$manager = $c->getUserManager();
928 928
 				$user = $manager->get($id);
929
-				if(is_null($user)) {
929
+				if (is_null($user)) {
930 930
 					$l = $c->getL10N('core');
931 931
 					$displayName = $l->t('Unknown user');
932 932
 				} else {
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 		});
940 940
 		$this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
941 941
 
942
-		$this->registerService('ThemingDefaults', function (Server $c) {
942
+		$this->registerService('ThemingDefaults', function(Server $c) {
943 943
 			/*
944 944
 			 * Dark magic for autoloader.
945 945
 			 * If we do a class_exists it will try to load the class which will
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 			}
968 968
 			return new \OC_Defaults();
969 969
 		});
970
-		$this->registerService(SCSSCacher::class, function (Server $c) {
970
+		$this->registerService(SCSSCacher::class, function(Server $c) {
971 971
 			return new SCSSCacher(
972 972
 				$c->getLogger(),
973 973
 				$c->query(\OC\Files\AppData\Factory::class),
@@ -980,7 +980,7 @@  discard block
 block discarded – undo
980 980
 				new TimeFactory()
981 981
 			);
982 982
 		});
983
-		$this->registerService(JSCombiner::class, function (Server $c) {
983
+		$this->registerService(JSCombiner::class, function(Server $c) {
984 984
 			return new JSCombiner(
985 985
 				$c->getAppDataDir('js'),
986 986
 				$c->getURLGenerator(),
@@ -993,7 +993,7 @@  discard block
 block discarded – undo
993 993
 		$this->registerAlias('EventDispatcher', \OC\EventDispatcher\SymfonyAdapter::class);
994 994
 		$this->registerAlias(EventDispatcherInterface::class, \OC\EventDispatcher\SymfonyAdapter::class);
995 995
 
996
-		$this->registerService('CryptoWrapper', function (Server $c) {
996
+		$this->registerService('CryptoWrapper', function(Server $c) {
997 997
 			// FIXME: Instantiiated here due to cyclic dependency
998 998
 			$request = new Request(
999 999
 				[
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 				$request
1019 1019
 			);
1020 1020
 		});
1021
-		$this->registerService(CsrfTokenManager::class, function (Server $c) {
1021
+		$this->registerService(CsrfTokenManager::class, function(Server $c) {
1022 1022
 			$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
1023 1023
 
1024 1024
 			return new CsrfTokenManager(
@@ -1027,20 +1027,20 @@  discard block
 block discarded – undo
1027 1027
 			);
1028 1028
 		});
1029 1029
 		$this->registerAlias('CsrfTokenManager', CsrfTokenManager::class);
1030
-		$this->registerService(SessionStorage::class, function (Server $c) {
1030
+		$this->registerService(SessionStorage::class, function(Server $c) {
1031 1031
 			return new SessionStorage($c->getSession());
1032 1032
 		});
1033 1033
 		$this->registerAlias(\OCP\Security\IContentSecurityPolicyManager::class, \OC\Security\CSP\ContentSecurityPolicyManager::class);
1034 1034
 		$this->registerAlias('ContentSecurityPolicyManager', \OC\Security\CSP\ContentSecurityPolicyManager::class);
1035 1035
 
1036
-		$this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) {
1036
+		$this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) {
1037 1037
 			return new ContentSecurityPolicyNonceManager(
1038 1038
 				$c->getCsrfTokenManager(),
1039 1039
 				$c->getRequest()
1040 1040
 			);
1041 1041
 		});
1042 1042
 
1043
-		$this->registerService(\OCP\Share\IManager::class, function (Server $c) {
1043
+		$this->registerService(\OCP\Share\IManager::class, function(Server $c) {
1044 1044
 			$config = $c->getConfig();
1045 1045
 			$factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
1046 1046
 			/** @var \OCP\Share\IProviderFactory $factory */
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 
1088 1088
 		$this->registerAlias(\OCP\Collaboration\Resources\IManager::class, \OC\Collaboration\Resources\Manager::class);
1089 1089
 
1090
-		$this->registerService('SettingsManager', function (Server $c) {
1090
+		$this->registerService('SettingsManager', function(Server $c) {
1091 1091
 			$manager = new \OC\Settings\Manager(
1092 1092
 				$c->getLogger(),
1093 1093
 				$c->getL10NFactory(),
@@ -1096,36 +1096,36 @@  discard block
 block discarded – undo
1096 1096
 			);
1097 1097
 			return $manager;
1098 1098
 		});
1099
-		$this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
1099
+		$this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) {
1100 1100
 			return new \OC\Files\AppData\Factory(
1101 1101
 				$c->getRootFolder(),
1102 1102
 				$c->getSystemConfig()
1103 1103
 			);
1104 1104
 		});
1105 1105
 
1106
-		$this->registerService('LockdownManager', function (Server $c) {
1107
-			return new LockdownManager(function () use ($c) {
1106
+		$this->registerService('LockdownManager', function(Server $c) {
1107
+			return new LockdownManager(function() use ($c) {
1108 1108
 				return $c->getSession();
1109 1109
 			});
1110 1110
 		});
1111 1111
 
1112
-		$this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
1112
+		$this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) {
1113 1113
 			return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
1114 1114
 		});
1115 1115
 
1116
-		$this->registerService(ICloudIdManager::class, function (Server $c) {
1116
+		$this->registerService(ICloudIdManager::class, function(Server $c) {
1117 1117
 			return new CloudIdManager();
1118 1118
 		});
1119 1119
 
1120
-		$this->registerService(IConfig::class, function (Server $c) {
1120
+		$this->registerService(IConfig::class, function(Server $c) {
1121 1121
 			return new GlobalScale\Config($c->getConfig());
1122 1122
 		});
1123 1123
 
1124
-		$this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
1124
+		$this->registerService(ICloudFederationProviderManager::class, function(Server $c) {
1125 1125
 			return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger());
1126 1126
 		});
1127 1127
 
1128
-		$this->registerService(ICloudFederationFactory::class, function (Server $c) {
1128
+		$this->registerService(ICloudFederationFactory::class, function(Server $c) {
1129 1129
 			return new CloudFederationFactory();
1130 1130
 		});
1131 1131
 
@@ -1135,18 +1135,18 @@  discard block
 block discarded – undo
1135 1135
 		$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
1136 1136
 		$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
1137 1137
 
1138
-		$this->registerService(Defaults::class, function (Server $c) {
1138
+		$this->registerService(Defaults::class, function(Server $c) {
1139 1139
 			return new Defaults(
1140 1140
 				$c->getThemingDefaults()
1141 1141
 			);
1142 1142
 		});
1143 1143
 		$this->registerAlias('Defaults', \OCP\Defaults::class);
1144 1144
 
1145
-		$this->registerService(\OCP\ISession::class, function (SimpleContainer $c) {
1145
+		$this->registerService(\OCP\ISession::class, function(SimpleContainer $c) {
1146 1146
 			return $c->query(\OCP\IUserSession::class)->getSession();
1147 1147
 		});
1148 1148
 
1149
-		$this->registerService(IShareHelper::class, function (Server $c) {
1149
+		$this->registerService(IShareHelper::class, function(Server $c) {
1150 1150
 			return new ShareHelper(
1151 1151
 				$c->query(\OCP\Share\IManager::class)
1152 1152
 			);
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
 		$this->registerAlias(IDashboardManager::class, DashboardManager::class);
1190 1190
 		$this->registerAlias(IFullTextSearchManager::class, FullTextSearchManager::class);
1191 1191
 
1192
-		$this->registerService(\OC\Security\IdentityProof\Manager::class, function (Server $c) {
1192
+		$this->registerService(\OC\Security\IdentityProof\Manager::class, function(Server $c) {
1193 1193
 			return new \OC\Security\IdentityProof\Manager(
1194 1194
 				$c->query(\OC\Files\AppData\Factory::class),
1195 1195
 				$c->getCrypto(),
@@ -1242,11 +1242,11 @@  discard block
 block discarded – undo
1242 1242
 				// no avatar to remove
1243 1243
 			} catch (\Exception $e) {
1244 1244
 				// Ignore exceptions
1245
-				$logger->info('Could not cleanup avatar of ' . $user->getUID());
1245
+				$logger->info('Could not cleanup avatar of '.$user->getUID());
1246 1246
 			}
1247 1247
 		});
1248 1248
 
1249
-		$dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) {
1249
+		$dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) {
1250 1250
 			$manager = $this->getAvatarManager();
1251 1251
 			/** @var IUser $user */
1252 1252
 			$user = $e->getSubject();
@@ -1402,7 +1402,7 @@  discard block
 block discarded – undo
1402 1402
 	 * @deprecated since 9.2.0 use IAppData
1403 1403
 	 */
1404 1404
 	public function getAppFolder() {
1405
-		$dir = '/' . \OC_App::getCurrentApp();
1405
+		$dir = '/'.\OC_App::getCurrentApp();
1406 1406
 		$root = $this->getRootFolder();
1407 1407
 		if (!$root->nodeExists($dir)) {
1408 1408
 			$folder = $root->newFolder($dir);
@@ -1977,7 +1977,7 @@  discard block
 block discarded – undo
1977 1977
 	/**
1978 1978
 	 * @return \OCP\Collaboration\AutoComplete\IManager
1979 1979
 	 */
1980
-	public function getAutoCompleteManager(){
1980
+	public function getAutoCompleteManager() {
1981 1981
 		return $this->query(IManager::class);
1982 1982
 	}
1983 1983
 
Please login to merge, or discard this patch.
lib/private/Security/CSP/ContentSecurityPolicyManager.php 2 patches
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -30,58 +30,58 @@
 block discarded – undo
30 30
 use OCP\Security\IContentSecurityPolicyManager;
31 31
 
32 32
 class ContentSecurityPolicyManager implements IContentSecurityPolicyManager {
33
-	/** @var ContentSecurityPolicy[] */
34
-	private $policies = [];
33
+    /** @var ContentSecurityPolicy[] */
34
+    private $policies = [];
35 35
 
36
-	/** @var IEventDispatcher */
37
-	private $dispatcher;
36
+    /** @var IEventDispatcher */
37
+    private $dispatcher;
38 38
 
39
-	public function __construct(IEventDispatcher $dispatcher) {
40
-		$this->dispatcher = $dispatcher;
41
-	}
39
+    public function __construct(IEventDispatcher $dispatcher) {
40
+        $this->dispatcher = $dispatcher;
41
+    }
42 42
 
43
-	/** {@inheritdoc} */
44
-	public function addDefaultPolicy(EmptyContentSecurityPolicy $policy) {
45
-		$this->policies[] = $policy;
46
-	}
43
+    /** {@inheritdoc} */
44
+    public function addDefaultPolicy(EmptyContentSecurityPolicy $policy) {
45
+        $this->policies[] = $policy;
46
+    }
47 47
 
48
-	/**
49
-	 * Get the configured default policy. This is not in the public namespace
50
-	 * as it is only supposed to be used by core itself.
51
-	 *
52
-	 * @return ContentSecurityPolicy
53
-	 */
54
-	public function getDefaultPolicy(): ContentSecurityPolicy {
55
-		$event = new AddContentSecurityPolicyEvent($this);
56
-		$this->dispatcher->dispatch(AddContentSecurityPolicyEvent::class, $event);
48
+    /**
49
+     * Get the configured default policy. This is not in the public namespace
50
+     * as it is only supposed to be used by core itself.
51
+     *
52
+     * @return ContentSecurityPolicy
53
+     */
54
+    public function getDefaultPolicy(): ContentSecurityPolicy {
55
+        $event = new AddContentSecurityPolicyEvent($this);
56
+        $this->dispatcher->dispatch(AddContentSecurityPolicyEvent::class, $event);
57 57
 
58
-		$defaultPolicy = new \OC\Security\CSP\ContentSecurityPolicy();
59
-		foreach($this->policies as $policy) {
60
-			$defaultPolicy = $this->mergePolicies($defaultPolicy, $policy);
61
-		}
62
-		return $defaultPolicy;
63
-	}
58
+        $defaultPolicy = new \OC\Security\CSP\ContentSecurityPolicy();
59
+        foreach($this->policies as $policy) {
60
+            $defaultPolicy = $this->mergePolicies($defaultPolicy, $policy);
61
+        }
62
+        return $defaultPolicy;
63
+    }
64 64
 
65
-	/**
66
-	 * Merges the first given policy with the second one
67
-	 *
68
-	 * @param ContentSecurityPolicy $defaultPolicy
69
-	 * @param EmptyContentSecurityPolicy $originalPolicy
70
-	 * @return ContentSecurityPolicy
71
-	 */
72
-	public function mergePolicies(ContentSecurityPolicy $defaultPolicy,
73
-								  EmptyContentSecurityPolicy $originalPolicy): ContentSecurityPolicy {
74
-		foreach((object)(array)$originalPolicy as $name => $value) {
75
-			$setter = 'set'.ucfirst($name);
76
-			if(\is_array($value)) {
77
-				$getter = 'get'.ucfirst($name);
78
-				$currentValues = \is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : [];
79
-				$defaultPolicy->$setter(array_values(array_unique(array_merge($currentValues, $value))));
80
-			} elseif (\is_bool($value)) {
81
-				$defaultPolicy->$setter($value);
82
-			}
83
-		}
65
+    /**
66
+     * Merges the first given policy with the second one
67
+     *
68
+     * @param ContentSecurityPolicy $defaultPolicy
69
+     * @param EmptyContentSecurityPolicy $originalPolicy
70
+     * @return ContentSecurityPolicy
71
+     */
72
+    public function mergePolicies(ContentSecurityPolicy $defaultPolicy,
73
+                                    EmptyContentSecurityPolicy $originalPolicy): ContentSecurityPolicy {
74
+        foreach((object)(array)$originalPolicy as $name => $value) {
75
+            $setter = 'set'.ucfirst($name);
76
+            if(\is_array($value)) {
77
+                $getter = 'get'.ucfirst($name);
78
+                $currentValues = \is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : [];
79
+                $defaultPolicy->$setter(array_values(array_unique(array_merge($currentValues, $value))));
80
+            } elseif (\is_bool($value)) {
81
+                $defaultPolicy->$setter($value);
82
+            }
83
+        }
84 84
 
85
-		return $defaultPolicy;
86
-	}
85
+        return $defaultPolicy;
86
+    }
87 87
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 		$this->dispatcher->dispatch(AddContentSecurityPolicyEvent::class, $event);
57 57
 
58 58
 		$defaultPolicy = new \OC\Security\CSP\ContentSecurityPolicy();
59
-		foreach($this->policies as $policy) {
59
+		foreach ($this->policies as $policy) {
60 60
 			$defaultPolicy = $this->mergePolicies($defaultPolicy, $policy);
61 61
 		}
62 62
 		return $defaultPolicy;
@@ -71,9 +71,9 @@  discard block
 block discarded – undo
71 71
 	 */
72 72
 	public function mergePolicies(ContentSecurityPolicy $defaultPolicy,
73 73
 								  EmptyContentSecurityPolicy $originalPolicy): ContentSecurityPolicy {
74
-		foreach((object)(array)$originalPolicy as $name => $value) {
74
+		foreach ((object) (array) $originalPolicy as $name => $value) {
75 75
 			$setter = 'set'.ucfirst($name);
76
-			if(\is_array($value)) {
76
+			if (\is_array($value)) {
77 77
 				$getter = 'get'.ucfirst($name);
78 78
 				$currentValues = \is_array($defaultPolicy->$getter()) ? $defaultPolicy->$getter() : [];
79 79
 				$defaultPolicy->$setter(array_values(array_unique(array_merge($currentValues, $value))));
Please login to merge, or discard this patch.