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