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