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