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