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