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