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