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