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