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