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