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