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