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