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