Completed
Pull Request — master (#9345)
by Björn
22:56
created
lib/public/Federation/Exceptions/ProviderDoesNotExistsException.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -25,16 +25,16 @@
 block discarded – undo
25 25
 
26 26
 class ProviderDoesNotExistsException extends HintException {
27 27
 
28
-	/**
29
-	 * ProviderDoesNotExistsException constructor.
30
-	 *
31
-	 * @param string $providerId cloud federation provider ID
32
-	 */
33
-	public function __construct($providerId) {
34
-		$l = \OC::$server->getL10N('federation');
35
-		$message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
36
-		$hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
37
-		parent::__construct($message, $hint);
38
-	}
28
+    /**
29
+     * ProviderDoesNotExistsException constructor.
30
+     *
31
+     * @param string $providerId cloud federation provider ID
32
+     */
33
+    public function __construct($providerId) {
34
+        $l = \OC::$server->getL10N('federation');
35
+        $message = 'Cloud Federation Provider with ID: "' . $providerId . '" does not exist.';
36
+        $hint = $l->t('Cloud Federation Provider with ID: "%s" does not exist.', [$providerId]);
37
+        parent::__construct($message, $hint);
38
+    }
39 39
 
40 40
 }
Please login to merge, or discard this patch.
lib/public/Federation/Exceptions/ProviderAlreadyExistsException.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -25,17 +25,17 @@
 block discarded – undo
25 25
 
26 26
 class ProviderAlreadyExistsException extends HintException {
27 27
 
28
-	/**
29
-	 * ProviderAlreadyExistsException constructor.
30
-	 *
31
-	 * @param string $newProviderId cloud federation provider ID of the new provider
32
-	 * @param string $existingProviderName name of cloud federation provider which already use the same ID
33
-	 */
34
-	public function __construct($newProviderId, $existingProviderName) {
35
-		$l = \OC::$server->getL10N('federation');
36
-		$message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
37
-		$hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
38
-		parent::__construct($message, $hint);
39
-	}
28
+    /**
29
+     * ProviderAlreadyExistsException constructor.
30
+     *
31
+     * @param string $newProviderId cloud federation provider ID of the new provider
32
+     * @param string $existingProviderName name of cloud federation provider which already use the same ID
33
+     */
34
+    public function __construct($newProviderId, $existingProviderName) {
35
+        $l = \OC::$server->getL10N('federation');
36
+        $message = 'Id "' . $newProviderId . '" already used by cloud federation provider "' . $existingProviderName . '"';
37
+        $hint = $l->t('Id "%s" already used by cloud federation provider "%s"', [$newProviderId, $existingProviderName]);
38
+        parent::__construct($message, $hint);
39
+    }
40 40
 
41 41
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationProviderManager.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -32,66 +32,66 @@
 block discarded – undo
32 32
  */
33 33
 interface ICloudFederationProviderManager {
34 34
 
35
-	/**
36
-	 * Registers an callback function which must return an cloud federation provider
37
-	 *
38
-	 * @param string $shareType which share type does the provider handles
39
-	 * @param string $displayName user facing name of the federated share provider
40
-	 * @param callable $callback
41
-	 * @throws Exceptions\ProviderAlreadyExistsException
42
-	 *
43
-	 * @since 14.0.0
44
-	 */
45
-	public function addCloudFederationProvider($shareType, $displayName, callable $callback);
35
+    /**
36
+     * Registers an callback function which must return an cloud federation provider
37
+     *
38
+     * @param string $shareType which share type does the provider handles
39
+     * @param string $displayName user facing name of the federated share provider
40
+     * @param callable $callback
41
+     * @throws Exceptions\ProviderAlreadyExistsException
42
+     *
43
+     * @since 14.0.0
44
+     */
45
+    public function addCloudFederationProvider($shareType, $displayName, callable $callback);
46 46
 
47
-	/**
48
-	 * remove cloud federation provider
49
-	 *
50
-	 * @param string $shareType
51
-	 *
52
-	 * @since 14.0.0
53
-	 */
54
-	public function removeCloudFederationProvider($shareType);
47
+    /**
48
+     * remove cloud federation provider
49
+     *
50
+     * @param string $shareType
51
+     *
52
+     * @since 14.0.0
53
+     */
54
+    public function removeCloudFederationProvider($shareType);
55 55
 
56
-	/**
57
-	 * get a list of all cloudFederationProviders
58
-	 *
59
-	 * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
60
-	 *
61
-	 * @since 14.0.0
62
-	 */
63
-	public function getAllCloudFederationProviders();
56
+    /**
57
+     * get a list of all cloudFederationProviders
58
+     *
59
+     * @return array [id => ['id' => $id, 'displayName' => $displayName, 'callback' => callback]]
60
+     *
61
+     * @since 14.0.0
62
+     */
63
+    public function getAllCloudFederationProviders();
64 64
 
65
-	/**
66
-	 * get a specific cloud federation provider
67
-	 *
68
-	 * @param string $shareType
69
-	 * @return ICloudFederationProvider
70
-	 * @throws Exceptions\ProviderDoesNotExistsException;
71
-	 *
72
-	 * @since 14.0.0
73
-	 */
74
-	public function getCloudFederationProvider($shareType);
65
+    /**
66
+     * get a specific cloud federation provider
67
+     *
68
+     * @param string $shareType
69
+     * @return ICloudFederationProvider
70
+     * @throws Exceptions\ProviderDoesNotExistsException;
71
+     *
72
+     * @since 14.0.0
73
+     */
74
+    public function getCloudFederationProvider($shareType);
75 75
 
76
-	/**
77
-	 * send federated share
78
-	 *
79
-	 * @param ICloudFederationShare $share
80
-	 * @return mixed
81
-	 *
82
-	 * @since 14.0.0
83
-	 */
84
-	public function sendShare(ICloudFederationShare $share);
76
+    /**
77
+     * send federated share
78
+     *
79
+     * @param ICloudFederationShare $share
80
+     * @return mixed
81
+     *
82
+     * @since 14.0.0
83
+     */
84
+    public function sendShare(ICloudFederationShare $share);
85 85
 
86
-	/**
87
-	 * send notification about existing share
88
-	 *
89
-	 * @param ICloudFederationNotification $notification
90
-	 * @return mixed
91
-	 *
92
-	 * @since 14.0.0
93
-	 */
94
-	public function sendNotification(ICloudFederationNotification $notification);
86
+    /**
87
+     * send notification about existing share
88
+     *
89
+     * @param ICloudFederationNotification $notification
90
+     * @return mixed
91
+     *
92
+     * @since 14.0.0
93
+     */
94
+    public function sendNotification(ICloudFederationNotification $notification);
95 95
 
96 96
 
97 97
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationNotification.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -23,22 +23,22 @@
 block discarded – undo
23 23
 
24 24
 interface ICloudFederationNotification {
25 25
 
26
-	/**
27
-	 * add a message to the notification
28
-	 *
29
-	 * @param string $identifier
30
-	 * @param string $message
31
-	 *
32
-	 * @since 14.0.0
33
-	 */
34
-	public function setMessage($identifier, $message);
26
+    /**
27
+     * add a message to the notification
28
+     *
29
+     * @param string $identifier
30
+     * @param string $message
31
+     *
32
+     * @since 14.0.0
33
+     */
34
+    public function setMessage($identifier, $message);
35 35
 
36
-	/**
37
-	 * get JSON encoded Message, ready to send out
38
-	 *
39
-	 * @return string
40
-	 *
41
-	 * @since 14.0.0
42
-	 */
43
-	public function getMessage();
36
+    /**
37
+     * get JSON encoded Message, ready to send out
38
+     *
39
+     * @return string
40
+     *
41
+     * @since 14.0.0
42
+     */
43
+    public function getMessage();
44 44
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationFactory.php 1 patch
Indentation   +28 added lines, -28 removed lines patch added patch discarded remove patch
@@ -23,33 +23,33 @@
 block discarded – undo
23 23
 
24 24
 interface ICloudFederationFactory {
25 25
 
26
-	/**
27
-	 * get a CloudFederationShare Object to prepare a share you want to send
28
-	 *
29
-	 * @param string $shareWith
30
-	 * @param string $name resource name (e.g. document.odt)
31
-	 * @param string $description share description (optional)
32
-	 * @param string $providerId resource UID on the provider side
33
-	 * @param string $owner provider specific UID of the user who owns the resource
34
-	 * @param string $ownerDisplayName display name of the user who shared the item
35
-	 * @param string $sharedBy provider specific UID of the user who shared the resource
36
-	 * @param $sharedByDisplayName display name of the user who shared the resource
37
-	 * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
38
-	 * @param string $shareType ('group' or 'user' share)
39
-	 * @param $resourceType ('file', 'calendar',...)
40
-	 * @return ICloudFederationShare
41
-	 *
42
-	 * @since 14.0.0
43
-	 */
44
-	public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
26
+    /**
27
+     * get a CloudFederationShare Object to prepare a share you want to send
28
+     *
29
+     * @param string $shareWith
30
+     * @param string $name resource name (e.g. document.odt)
31
+     * @param string $description share description (optional)
32
+     * @param string $providerId resource UID on the provider side
33
+     * @param string $owner provider specific UID of the user who owns the resource
34
+     * @param string $ownerDisplayName display name of the user who shared the item
35
+     * @param string $sharedBy provider specific UID of the user who shared the resource
36
+     * @param $sharedByDisplayName display name of the user who shared the resource
37
+     * @param array $protocol (e,.g. ['name' => 'webdav', 'options' => ['username' => 'john', 'permissions' => 31]])
38
+     * @param string $shareType ('group' or 'user' share)
39
+     * @param $resourceType ('file', 'calendar',...)
40
+     * @return ICloudFederationShare
41
+     *
42
+     * @since 14.0.0
43
+     */
44
+    public function getCloudFederationShare($shareWith, $name, $description, $providerId, $owner, $ownerDisplayName, $sharedBy, $sharedByDisplayName, $protocol, $shareType, $resourceType);
45 45
 
46
-	/**
47
-	 * get a Cloud FederationNotification object to prepare a notification you
48
-	 * want to send
49
-	 *
50
-	 * @return ICloudFederationNotification
51
-	 *
52
-	 * @since 14.0.0
53
-	 */
54
-	public function getCloudFederationNotification();
46
+    /**
47
+     * get a Cloud FederationNotification object to prepare a notification you
48
+     * want to send
49
+     *
50
+     * @return ICloudFederationNotification
51
+     *
52
+     * @since 14.0.0
53
+     */
54
+    public function getCloudFederationNotification();
55 55
 }
Please login to merge, or discard this patch.
lib/public/Federation/ICloudFederationShare.php 1 patch
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -23,211 +23,211 @@
 block discarded – undo
23 23
 
24 24
 interface ICloudFederationShare {
25 25
 
26
-	/**
27
-	 * set uid of the recipient
28
-	 *
29
-	 * @param string $user
30
-	 *
31
-	 * @since 14.0.0
32
-	 */
33
-	public function setShareWith($user);
34
-
35
-	/**
36
-	 * set resource name (e.g. file, calendar, contact,...)
37
-	 *
38
-	 * @param string $name
39
-	 *
40
-	 * @since 14.0.0
41
-	 */
42
-	public function setResourceName($name);
43
-
44
-	/**
45
-	 * set resource type (e.g. file, calendar, contact,...)
46
-	 *
47
-	 * @param string $resourceType
48
-	 *
49
-	 * @since 14.0.0
50
-	 */
51
-	public function setResourceType($resourceType);
52
-
53
-	/**
54
-	 * set resource description (optional)
55
-	 *
56
-	 * @param string $description
57
-	 *
58
-	 * @since 14.0.0
59
-	 */
60
-	public function setDescription($description);
61
-
62
-	/**
63
-	 * set provider ID (e.g. file ID)
64
-	 *
65
-	 * @param string $providerId
66
-	 *
67
-	 * @since 14.0.0
68
-	 */
69
-	public function setProviderId($providerId);
70
-
71
-	/**
72
-	 * set owner UID
73
-	 *
74
-	 * @param string $owner
75
-	 *
76
-	 * @since 14.0.0
77
-	 */
78
-	public function setOwner($owner);
79
-
80
-	/**
81
-	 * set owner display name
82
-	 *
83
-	 * @param string $ownerDisplayName
84
-	 *
85
-	 * @since 14.0.0
86
-	 */
87
-	public function setOwnerDisplayName($ownerDisplayName);
88
-
89
-	/**
90
-	 * set UID of the user who sends the share
91
-	 *
92
-	 * @param string $sharedBy
93
-	 *
94
-	 * @since 14.0.0
95
-	 */
96
-	public function setSharedBy($sharedBy);
97
-
98
-	/**
99
-	 * set display name of the user who sends the share
100
-	 *
101
-	 * @param $sharedByDisplayName
102
-	 *
103
-	 * @since 14.0.0
104
-	 */
105
-	public function setSharedByDisplayName($sharedByDisplayName);
106
-
107
-	/**
108
-	 * set protocol specification
109
-	 *
110
-	 * @param array $protocol
111
-	 *
112
-	 * @since 14.0.0
113
-	 */
114
-	public function setProtocol(array $protocol);
115
-
116
-	/**
117
-	 * share type (group or user)
118
-	 *
119
-	 * @param string $shareType
120
-	 *
121
-	 * @since 14.0.0
122
-	 */
123
-	public function setShareType($shareType);
124
-
125
-	/**
126
-	 * get JSON encoded share, ready to send out
127
-	 *
128
-	 * @return string
129
-	 *
130
-	 * @since 14.0.0
131
-	 */
132
-	public function getShare();
133
-
134
-	/**
135
-	 * get uid of the recipient
136
-	 *
137
-	 * @return string
138
-	 *
139
-	 * @since 14.0.0
140
-	 */
141
-	public function getShareWith();
142
-
143
-	/**
144
-	 * get resource name (e.g. file, calendar, contact,...)
145
-	 *
146
-	 * @return string
147
-	 *
148
-	 * @since 14.0.0
149
-	 */
150
-	public function getResourceName();
151
-
152
-	/**
153
-	 * get resource type (e.g. file, calendar, contact,...)
154
-	 *
155
-	 * @return string
156
-	 *
157
-	 * @since 14.0.0
158
-	 */
159
-	public function getResourceType();
160
-
161
-	/**
162
-	 * get resource description (optional)
163
-	 *
164
-	 * @return string
165
-	 *
166
-	 * @since 14.0.0
167
-	 */
168
-	public function getDescription();
169
-
170
-	/**
171
-	 * get provider ID (e.g. file ID)
172
-	 *
173
-	 * @return string
174
-	 *
175
-	 * @since 14.0.0
176
-	 */
177
-	public function getProviderId();
178
-
179
-	/**
180
-	 * get owner UID
181
-	 *
182
-	 * @return string
183
-	 *
184
-	 * @since 14.0.0
185
-	 */
186
-	public function getOwner();
187
-
188
-	/**
189
-	 * get owner display name
190
-	 *
191
-	 * @return string
192
-	 *
193
-	 * @since 14.0.0
194
-	 */
195
-	public function getOwnerDisplayName();
196
-
197
-	/**
198
-	 * get UID of the user who sends the share
199
-	 *
200
-	 * @return string
201
-	 *
202
-	 * @since 14.0.0
203
-	 */
204
-	public function getSharedBy();
205
-
206
-	/**
207
-	 * get display name of the user who sends the share
208
-	 *
209
-	 * @return string
210
-	 *
211
-	 * @since 14.0.0
212
-	 */
213
-	public function getSharedByDisplayName();
214
-
215
-	/**
216
-	 * get share type (group or user)
217
-	 *
218
-	 * @return string
219
-	 *
220
-	 * @since 14.0.0
221
-	 */
222
-	public function getShareType();
223
-
224
-	/**
225
-	 * get protocol specification
226
-	 *
227
-	 * @return array
228
-	 *
229
-	 * @since 14.0.0
230
-	 */
231
-	public function getProtocol();
26
+    /**
27
+     * set uid of the recipient
28
+     *
29
+     * @param string $user
30
+     *
31
+     * @since 14.0.0
32
+     */
33
+    public function setShareWith($user);
34
+
35
+    /**
36
+     * set resource name (e.g. file, calendar, contact,...)
37
+     *
38
+     * @param string $name
39
+     *
40
+     * @since 14.0.0
41
+     */
42
+    public function setResourceName($name);
43
+
44
+    /**
45
+     * set resource type (e.g. file, calendar, contact,...)
46
+     *
47
+     * @param string $resourceType
48
+     *
49
+     * @since 14.0.0
50
+     */
51
+    public function setResourceType($resourceType);
52
+
53
+    /**
54
+     * set resource description (optional)
55
+     *
56
+     * @param string $description
57
+     *
58
+     * @since 14.0.0
59
+     */
60
+    public function setDescription($description);
61
+
62
+    /**
63
+     * set provider ID (e.g. file ID)
64
+     *
65
+     * @param string $providerId
66
+     *
67
+     * @since 14.0.0
68
+     */
69
+    public function setProviderId($providerId);
70
+
71
+    /**
72
+     * set owner UID
73
+     *
74
+     * @param string $owner
75
+     *
76
+     * @since 14.0.0
77
+     */
78
+    public function setOwner($owner);
79
+
80
+    /**
81
+     * set owner display name
82
+     *
83
+     * @param string $ownerDisplayName
84
+     *
85
+     * @since 14.0.0
86
+     */
87
+    public function setOwnerDisplayName($ownerDisplayName);
88
+
89
+    /**
90
+     * set UID of the user who sends the share
91
+     *
92
+     * @param string $sharedBy
93
+     *
94
+     * @since 14.0.0
95
+     */
96
+    public function setSharedBy($sharedBy);
97
+
98
+    /**
99
+     * set display name of the user who sends the share
100
+     *
101
+     * @param $sharedByDisplayName
102
+     *
103
+     * @since 14.0.0
104
+     */
105
+    public function setSharedByDisplayName($sharedByDisplayName);
106
+
107
+    /**
108
+     * set protocol specification
109
+     *
110
+     * @param array $protocol
111
+     *
112
+     * @since 14.0.0
113
+     */
114
+    public function setProtocol(array $protocol);
115
+
116
+    /**
117
+     * share type (group or user)
118
+     *
119
+     * @param string $shareType
120
+     *
121
+     * @since 14.0.0
122
+     */
123
+    public function setShareType($shareType);
124
+
125
+    /**
126
+     * get JSON encoded share, ready to send out
127
+     *
128
+     * @return string
129
+     *
130
+     * @since 14.0.0
131
+     */
132
+    public function getShare();
133
+
134
+    /**
135
+     * get uid of the recipient
136
+     *
137
+     * @return string
138
+     *
139
+     * @since 14.0.0
140
+     */
141
+    public function getShareWith();
142
+
143
+    /**
144
+     * get resource name (e.g. file, calendar, contact,...)
145
+     *
146
+     * @return string
147
+     *
148
+     * @since 14.0.0
149
+     */
150
+    public function getResourceName();
151
+
152
+    /**
153
+     * get resource type (e.g. file, calendar, contact,...)
154
+     *
155
+     * @return string
156
+     *
157
+     * @since 14.0.0
158
+     */
159
+    public function getResourceType();
160
+
161
+    /**
162
+     * get resource description (optional)
163
+     *
164
+     * @return string
165
+     *
166
+     * @since 14.0.0
167
+     */
168
+    public function getDescription();
169
+
170
+    /**
171
+     * get provider ID (e.g. file ID)
172
+     *
173
+     * @return string
174
+     *
175
+     * @since 14.0.0
176
+     */
177
+    public function getProviderId();
178
+
179
+    /**
180
+     * get owner UID
181
+     *
182
+     * @return string
183
+     *
184
+     * @since 14.0.0
185
+     */
186
+    public function getOwner();
187
+
188
+    /**
189
+     * get owner display name
190
+     *
191
+     * @return string
192
+     *
193
+     * @since 14.0.0
194
+     */
195
+    public function getOwnerDisplayName();
196
+
197
+    /**
198
+     * get UID of the user who sends the share
199
+     *
200
+     * @return string
201
+     *
202
+     * @since 14.0.0
203
+     */
204
+    public function getSharedBy();
205
+
206
+    /**
207
+     * get display name of the user who sends the share
208
+     *
209
+     * @return string
210
+     *
211
+     * @since 14.0.0
212
+     */
213
+    public function getSharedByDisplayName();
214
+
215
+    /**
216
+     * get share type (group or user)
217
+     *
218
+     * @return string
219
+     *
220
+     * @since 14.0.0
221
+     */
222
+    public function getShareType();
223
+
224
+    /**
225
+     * get protocol specification
226
+     *
227
+     * @return array
228
+     *
229
+     * @since 14.0.0
230
+     */
231
+    public function getProtocol();
232 232
 
233 233
 }
Please login to merge, or discard this patch.
lib/public/IServerContainer.php 1 patch
Indentation   +497 added lines, -497 removed lines patch added patch discarded remove patch
@@ -59,501 +59,501 @@
 block discarded – undo
59 59
  */
60 60
 interface IServerContainer extends IContainer {
61 61
 
62
-	/**
63
-	 * The calendar manager will act as a broker between consumers for calendar information and
64
-	 * providers which actual deliver the calendar information.
65
-	 *
66
-	 * @return \OCP\Calendar\IManager
67
-	 * @since 13.0.0
68
-	 */
69
-	public function getCalendarManager();
70
-
71
-	/**
72
-	 * The contacts manager will act as a broker between consumers for contacts information and
73
-	 * providers which actual deliver the contact information.
74
-	 *
75
-	 * @return \OCP\Contacts\IManager
76
-	 * @since 6.0.0
77
-	 */
78
-	public function getContactsManager();
79
-
80
-	/**
81
-	 * The current request object holding all information about the request currently being processed
82
-	 * is returned from this method.
83
-	 * In case the current execution was not initiated by a web request null is returned
84
-	 *
85
-	 * @return \OCP\IRequest
86
-	 * @since 6.0.0
87
-	 */
88
-	public function getRequest();
89
-
90
-	/**
91
-	 * Returns the preview manager which can create preview images for a given file
92
-	 *
93
-	 * @return \OCP\IPreview
94
-	 * @since 6.0.0
95
-	 */
96
-	public function getPreviewManager();
97
-
98
-	/**
99
-	 * Returns the tag manager which can get and set tags for different object types
100
-	 *
101
-	 * @see \OCP\ITagManager::load()
102
-	 * @return \OCP\ITagManager
103
-	 * @since 6.0.0
104
-	 */
105
-	public function getTagManager();
106
-
107
-	/**
108
-	 * Returns the root folder of ownCloud's data directory
109
-	 *
110
-	 * @return \OCP\Files\IRootFolder
111
-	 * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
112
-	 */
113
-	public function getRootFolder();
114
-
115
-	/**
116
-	 * Returns a view to ownCloud's files folder
117
-	 *
118
-	 * @param string $userId user ID
119
-	 * @return \OCP\Files\Folder
120
-	 * @since 6.0.0 - parameter $userId was added in 8.0.0
121
-	 * @see getUserFolder in \OCP\Files\IRootFolder
122
-	 */
123
-	public function getUserFolder($userId = null);
124
-
125
-	/**
126
-	 * Returns an app-specific view in ownClouds data directory
127
-	 *
128
-	 * @return \OCP\Files\Folder
129
-	 * @since 6.0.0
130
-	 * @deprecated 9.2.0 use IAppData
131
-	 */
132
-	public function getAppFolder();
133
-
134
-	/**
135
-	 * Returns a user manager
136
-	 *
137
-	 * @return \OCP\IUserManager
138
-	 * @since 8.0.0
139
-	 */
140
-	public function getUserManager();
141
-
142
-	/**
143
-	 * Returns a group manager
144
-	 *
145
-	 * @return \OCP\IGroupManager
146
-	 * @since 8.0.0
147
-	 */
148
-	public function getGroupManager();
149
-
150
-	/**
151
-	 * Returns the user session
152
-	 *
153
-	 * @return \OCP\IUserSession
154
-	 * @since 6.0.0
155
-	 */
156
-	public function getUserSession();
157
-
158
-	/**
159
-	 * Returns the navigation manager
160
-	 *
161
-	 * @return \OCP\INavigationManager
162
-	 * @since 6.0.0
163
-	 */
164
-	public function getNavigationManager();
165
-
166
-	/**
167
-	 * Returns the config manager
168
-	 *
169
-	 * @return \OCP\IConfig
170
-	 * @since 6.0.0
171
-	 */
172
-	public function getConfig();
173
-
174
-	/**
175
-	 * Returns a Crypto instance
176
-	 *
177
-	 * @return \OCP\Security\ICrypto
178
-	 * @since 8.0.0
179
-	 */
180
-	public function getCrypto();
181
-
182
-	/**
183
-	 * Returns a Hasher instance
184
-	 *
185
-	 * @return \OCP\Security\IHasher
186
-	 * @since 8.0.0
187
-	 */
188
-	public function getHasher();
189
-
190
-	/**
191
-	 * Returns a SecureRandom instance
192
-	 *
193
-	 * @return \OCP\Security\ISecureRandom
194
-	 * @since 8.1.0
195
-	 */
196
-	public function getSecureRandom();
197
-
198
-	/**
199
-	 * Returns a CredentialsManager instance
200
-	 *
201
-	 * @return \OCP\Security\ICredentialsManager
202
-	 * @since 9.0.0
203
-	 */
204
-	public function getCredentialsManager();
205
-
206
-	/**
207
-	 * Returns the app config manager
208
-	 *
209
-	 * @return \OCP\IAppConfig
210
-	 * @since 7.0.0
211
-	 */
212
-	public function getAppConfig();
213
-
214
-	/**
215
-	 * @return \OCP\L10N\IFactory
216
-	 * @since 8.2.0
217
-	 */
218
-	public function getL10NFactory();
219
-
220
-	/**
221
-	 * get an L10N instance
222
-	 * @param string $app appid
223
-	 * @param string $lang
224
-	 * @return \OCP\IL10N
225
-	 * @since 6.0.0 - parameter $lang was added in 8.0.0
226
-	 */
227
-	public function getL10N($app, $lang = null);
228
-
229
-	/**
230
-	 * @return \OC\Encryption\Manager
231
-	 * @since 8.1.0
232
-	 */
233
-	public function getEncryptionManager();
234
-
235
-	/**
236
-	 * @return \OC\Encryption\File
237
-	 * @since 8.1.0
238
-	 */
239
-	public function getEncryptionFilesHelper();
240
-
241
-	/**
242
-	 * @return \OCP\Encryption\Keys\IStorage
243
-	 * @since 8.1.0
244
-	 */
245
-	public function getEncryptionKeyStorage();
246
-
247
-	/**
248
-	 * Returns the URL generator
249
-	 *
250
-	 * @return \OCP\IURLGenerator
251
-	 * @since 6.0.0
252
-	 */
253
-	public function getURLGenerator();
254
-
255
-	/**
256
-	 * Returns an ICache instance
257
-	 *
258
-	 * @return \OCP\ICache
259
-	 * @since 6.0.0
260
-	 */
261
-	public function getCache();
262
-
263
-	/**
264
-	 * Returns an \OCP\CacheFactory instance
265
-	 *
266
-	 * @return \OCP\ICacheFactory
267
-	 * @since 7.0.0
268
-	 */
269
-	public function getMemCacheFactory();
270
-
271
-	/**
272
-	 * Returns the current session
273
-	 *
274
-	 * @return \OCP\ISession
275
-	 * @since 6.0.0
276
-	 */
277
-	public function getSession();
278
-
279
-	/**
280
-	 * Returns the activity manager
281
-	 *
282
-	 * @return \OCP\Activity\IManager
283
-	 * @since 6.0.0
284
-	 */
285
-	public function getActivityManager();
286
-
287
-	/**
288
-	 * Returns the current session
289
-	 *
290
-	 * @return \OCP\IDBConnection
291
-	 * @since 6.0.0
292
-	 */
293
-	public function getDatabaseConnection();
294
-
295
-	/**
296
-	 * Returns an avatar manager, used for avatar functionality
297
-	 *
298
-	 * @return \OCP\IAvatarManager
299
-	 * @since 6.0.0
300
-	 */
301
-	public function getAvatarManager();
302
-
303
-	/**
304
-	 * Returns an job list for controlling background jobs
305
-	 *
306
-	 * @return \OCP\BackgroundJob\IJobList
307
-	 * @since 7.0.0
308
-	 */
309
-	public function getJobList();
310
-
311
-	/**
312
-	 * Returns a logger instance
313
-	 *
314
-	 * @return \OCP\ILogger
315
-	 * @since 8.0.0
316
-	 */
317
-	public function getLogger();
318
-
319
-	/**
320
-	 * Returns a router for generating and matching urls
321
-	 *
322
-	 * @return \OCP\Route\IRouter
323
-	 * @since 7.0.0
324
-	 */
325
-	public function getRouter();
326
-
327
-	/**
328
-	 * Returns a search instance
329
-	 *
330
-	 * @return \OCP\ISearch
331
-	 * @since 7.0.0
332
-	 */
333
-	public function getSearch();
334
-
335
-	/**
336
-	 * Get the certificate manager for the user
337
-	 *
338
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
339
-	 * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
340
-	 * @since 8.0.0
341
-	 */
342
-	public function getCertificateManager($userId = null);
343
-
344
-	/**
345
-	 * Create a new event source
346
-	 *
347
-	 * @return \OCP\IEventSource
348
-	 * @since 8.0.0
349
-	 */
350
-	public function createEventSource();
351
-
352
-	/**
353
-	 * Returns an instance of the HTTP client service
354
-	 *
355
-	 * @return \OCP\Http\Client\IClientService
356
-	 * @since 8.1.0
357
-	 */
358
-	public function getHTTPClientService();
359
-
360
-	/**
361
-	 * Get the active event logger
362
-	 *
363
-	 * @return \OCP\Diagnostics\IEventLogger
364
-	 * @since 8.0.0
365
-	 */
366
-	public function getEventLogger();
367
-
368
-	/**
369
-	 * Get the active query logger
370
-	 *
371
-	 * The returned logger only logs data when debug mode is enabled
372
-	 *
373
-	 * @return \OCP\Diagnostics\IQueryLogger
374
-	 * @since 8.0.0
375
-	 */
376
-	public function getQueryLogger();
377
-
378
-	/**
379
-	 * Get the manager for temporary files and folders
380
-	 *
381
-	 * @return \OCP\ITempManager
382
-	 * @since 8.0.0
383
-	 */
384
-	public function getTempManager();
385
-
386
-	/**
387
-	 * Get the app manager
388
-	 *
389
-	 * @return \OCP\App\IAppManager
390
-	 * @since 8.0.0
391
-	 */
392
-	public function getAppManager();
393
-
394
-	/**
395
-	 * Get the webroot
396
-	 *
397
-	 * @return string
398
-	 * @since 8.0.0
399
-	 */
400
-	public function getWebRoot();
401
-
402
-	/**
403
-	 * @return \OCP\Files\Config\IMountProviderCollection
404
-	 * @since 8.0.0
405
-	 */
406
-	public function getMountProviderCollection();
407
-
408
-	/**
409
-	 * Get the IniWrapper
410
-	 *
411
-	 * @return \bantu\IniGetWrapper\IniGetWrapper
412
-	 * @since 8.0.0
413
-	 */
414
-	public function getIniWrapper();
415
-	/**
416
-	 * @return \OCP\Command\IBus
417
-	 * @since 8.1.0
418
-	 */
419
-	public function getCommandBus();
420
-
421
-	/**
422
-	 * Creates a new mailer
423
-	 *
424
-	 * @return \OCP\Mail\IMailer
425
-	 * @since 8.1.0
426
-	 */
427
-	public function getMailer();
428
-
429
-	/**
430
-	 * Get the locking provider
431
-	 *
432
-	 * @return \OCP\Lock\ILockingProvider
433
-	 * @since 8.1.0
434
-	 */
435
-	public function getLockingProvider();
436
-
437
-	/**
438
-	 * @return \OCP\Files\Mount\IMountManager
439
-	 * @since 8.2.0
440
-	 */
441
-	public function getMountManager();
442
-
443
-	/**
444
-	 * Get the MimeTypeDetector
445
-	 *
446
-	 * @return \OCP\Files\IMimeTypeDetector
447
-	 * @since 8.2.0
448
-	 */
449
-	public function getMimeTypeDetector();
450
-
451
-	/**
452
-	 * Get the MimeTypeLoader
453
-	 *
454
-	 * @return \OCP\Files\IMimeTypeLoader
455
-	 * @since 8.2.0
456
-	 */
457
-	public function getMimeTypeLoader();
458
-
459
-	/**
460
-	 * Get the EventDispatcher
461
-	 *
462
-	 * @return EventDispatcherInterface
463
-	 * @since 8.2.0
464
-	 */
465
-	public function getEventDispatcher();
466
-
467
-	/**
468
-	 * Get the Notification Manager
469
-	 *
470
-	 * @return \OCP\Notification\IManager
471
-	 * @since 9.0.0
472
-	 */
473
-	public function getNotificationManager();
474
-
475
-	/**
476
-	 * @return \OCP\Comments\ICommentsManager
477
-	 * @since 9.0.0
478
-	 */
479
-	public function getCommentsManager();
480
-
481
-	/**
482
-	 * Returns the system-tag manager
483
-	 *
484
-	 * @return \OCP\SystemTag\ISystemTagManager
485
-	 *
486
-	 * @since 9.0.0
487
-	 */
488
-	public function getSystemTagManager();
489
-
490
-	/**
491
-	 * Returns the system-tag object mapper
492
-	 *
493
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
494
-	 *
495
-	 * @since 9.0.0
496
-	 */
497
-	public function getSystemTagObjectMapper();
498
-
499
-	/**
500
-	 * Returns the share manager
501
-	 *
502
-	 * @return \OCP\Share\IManager
503
-	 * @since 9.0.0
504
-	 */
505
-	public function getShareManager();
506
-
507
-	/**
508
-	 * @return IContentSecurityPolicyManager
509
-	 * @since 9.0.0
510
-	 */
511
-	public function getContentSecurityPolicyManager();
512
-
513
-	/**
514
-	 * @return \OCP\IDateTimeZone
515
-	 * @since 8.0.0
516
-	 */
517
-	public function getDateTimeZone();
518
-
519
-	/**
520
-	 * @return \OCP\IDateTimeFormatter
521
-	 * @since 8.0.0
522
-	 */
523
-	public function getDateTimeFormatter();
524
-
525
-	/**
526
-	 * @return \OCP\Federation\ICloudIdManager
527
-	 * @since 12.0.0
528
-	 */
529
-	public function getCloudIdManager();
530
-
531
-	/**
532
-	 * @return \OCP\GlobalScale\IConfig
533
-	 */
534
-	public function getGlobalScaleConfig();
535
-
536
-	/**
537
-	 * @return ICloudFederationFactory
538
-	 * @since 14.0.0
539
-	 */
540
-	public function getCloudFederationFactory();
541
-
542
-	/**
543
-	 * @return ICloudFederationProviderManager
544
-	 * @since 14.0.0
545
-	 */
546
-	public function getCloudFederationProviderManager();
547
-
548
-	/**
549
-	 * @return \OCP\Remote\Api\IApiFactory
550
-	 * @since 13.0.0
551
-	 */
552
-	public function getRemoteApiFactory();
553
-
554
-	/**
555
-	 * @return \OCP\Remote\IInstanceFactory
556
-	 * @since 13.0.0
557
-	 */
558
-	public function getRemoteInstanceFactory();
62
+    /**
63
+     * The calendar manager will act as a broker between consumers for calendar information and
64
+     * providers which actual deliver the calendar information.
65
+     *
66
+     * @return \OCP\Calendar\IManager
67
+     * @since 13.0.0
68
+     */
69
+    public function getCalendarManager();
70
+
71
+    /**
72
+     * The contacts manager will act as a broker between consumers for contacts information and
73
+     * providers which actual deliver the contact information.
74
+     *
75
+     * @return \OCP\Contacts\IManager
76
+     * @since 6.0.0
77
+     */
78
+    public function getContactsManager();
79
+
80
+    /**
81
+     * The current request object holding all information about the request currently being processed
82
+     * is returned from this method.
83
+     * In case the current execution was not initiated by a web request null is returned
84
+     *
85
+     * @return \OCP\IRequest
86
+     * @since 6.0.0
87
+     */
88
+    public function getRequest();
89
+
90
+    /**
91
+     * Returns the preview manager which can create preview images for a given file
92
+     *
93
+     * @return \OCP\IPreview
94
+     * @since 6.0.0
95
+     */
96
+    public function getPreviewManager();
97
+
98
+    /**
99
+     * Returns the tag manager which can get and set tags for different object types
100
+     *
101
+     * @see \OCP\ITagManager::load()
102
+     * @return \OCP\ITagManager
103
+     * @since 6.0.0
104
+     */
105
+    public function getTagManager();
106
+
107
+    /**
108
+     * Returns the root folder of ownCloud's data directory
109
+     *
110
+     * @return \OCP\Files\IRootFolder
111
+     * @since 6.0.0 - between 6.0.0 and 8.0.0 this returned \OCP\Files\Folder
112
+     */
113
+    public function getRootFolder();
114
+
115
+    /**
116
+     * Returns a view to ownCloud's files folder
117
+     *
118
+     * @param string $userId user ID
119
+     * @return \OCP\Files\Folder
120
+     * @since 6.0.0 - parameter $userId was added in 8.0.0
121
+     * @see getUserFolder in \OCP\Files\IRootFolder
122
+     */
123
+    public function getUserFolder($userId = null);
124
+
125
+    /**
126
+     * Returns an app-specific view in ownClouds data directory
127
+     *
128
+     * @return \OCP\Files\Folder
129
+     * @since 6.0.0
130
+     * @deprecated 9.2.0 use IAppData
131
+     */
132
+    public function getAppFolder();
133
+
134
+    /**
135
+     * Returns a user manager
136
+     *
137
+     * @return \OCP\IUserManager
138
+     * @since 8.0.0
139
+     */
140
+    public function getUserManager();
141
+
142
+    /**
143
+     * Returns a group manager
144
+     *
145
+     * @return \OCP\IGroupManager
146
+     * @since 8.0.0
147
+     */
148
+    public function getGroupManager();
149
+
150
+    /**
151
+     * Returns the user session
152
+     *
153
+     * @return \OCP\IUserSession
154
+     * @since 6.0.0
155
+     */
156
+    public function getUserSession();
157
+
158
+    /**
159
+     * Returns the navigation manager
160
+     *
161
+     * @return \OCP\INavigationManager
162
+     * @since 6.0.0
163
+     */
164
+    public function getNavigationManager();
165
+
166
+    /**
167
+     * Returns the config manager
168
+     *
169
+     * @return \OCP\IConfig
170
+     * @since 6.0.0
171
+     */
172
+    public function getConfig();
173
+
174
+    /**
175
+     * Returns a Crypto instance
176
+     *
177
+     * @return \OCP\Security\ICrypto
178
+     * @since 8.0.0
179
+     */
180
+    public function getCrypto();
181
+
182
+    /**
183
+     * Returns a Hasher instance
184
+     *
185
+     * @return \OCP\Security\IHasher
186
+     * @since 8.0.0
187
+     */
188
+    public function getHasher();
189
+
190
+    /**
191
+     * Returns a SecureRandom instance
192
+     *
193
+     * @return \OCP\Security\ISecureRandom
194
+     * @since 8.1.0
195
+     */
196
+    public function getSecureRandom();
197
+
198
+    /**
199
+     * Returns a CredentialsManager instance
200
+     *
201
+     * @return \OCP\Security\ICredentialsManager
202
+     * @since 9.0.0
203
+     */
204
+    public function getCredentialsManager();
205
+
206
+    /**
207
+     * Returns the app config manager
208
+     *
209
+     * @return \OCP\IAppConfig
210
+     * @since 7.0.0
211
+     */
212
+    public function getAppConfig();
213
+
214
+    /**
215
+     * @return \OCP\L10N\IFactory
216
+     * @since 8.2.0
217
+     */
218
+    public function getL10NFactory();
219
+
220
+    /**
221
+     * get an L10N instance
222
+     * @param string $app appid
223
+     * @param string $lang
224
+     * @return \OCP\IL10N
225
+     * @since 6.0.0 - parameter $lang was added in 8.0.0
226
+     */
227
+    public function getL10N($app, $lang = null);
228
+
229
+    /**
230
+     * @return \OC\Encryption\Manager
231
+     * @since 8.1.0
232
+     */
233
+    public function getEncryptionManager();
234
+
235
+    /**
236
+     * @return \OC\Encryption\File
237
+     * @since 8.1.0
238
+     */
239
+    public function getEncryptionFilesHelper();
240
+
241
+    /**
242
+     * @return \OCP\Encryption\Keys\IStorage
243
+     * @since 8.1.0
244
+     */
245
+    public function getEncryptionKeyStorage();
246
+
247
+    /**
248
+     * Returns the URL generator
249
+     *
250
+     * @return \OCP\IURLGenerator
251
+     * @since 6.0.0
252
+     */
253
+    public function getURLGenerator();
254
+
255
+    /**
256
+     * Returns an ICache instance
257
+     *
258
+     * @return \OCP\ICache
259
+     * @since 6.0.0
260
+     */
261
+    public function getCache();
262
+
263
+    /**
264
+     * Returns an \OCP\CacheFactory instance
265
+     *
266
+     * @return \OCP\ICacheFactory
267
+     * @since 7.0.0
268
+     */
269
+    public function getMemCacheFactory();
270
+
271
+    /**
272
+     * Returns the current session
273
+     *
274
+     * @return \OCP\ISession
275
+     * @since 6.0.0
276
+     */
277
+    public function getSession();
278
+
279
+    /**
280
+     * Returns the activity manager
281
+     *
282
+     * @return \OCP\Activity\IManager
283
+     * @since 6.0.0
284
+     */
285
+    public function getActivityManager();
286
+
287
+    /**
288
+     * Returns the current session
289
+     *
290
+     * @return \OCP\IDBConnection
291
+     * @since 6.0.0
292
+     */
293
+    public function getDatabaseConnection();
294
+
295
+    /**
296
+     * Returns an avatar manager, used for avatar functionality
297
+     *
298
+     * @return \OCP\IAvatarManager
299
+     * @since 6.0.0
300
+     */
301
+    public function getAvatarManager();
302
+
303
+    /**
304
+     * Returns an job list for controlling background jobs
305
+     *
306
+     * @return \OCP\BackgroundJob\IJobList
307
+     * @since 7.0.0
308
+     */
309
+    public function getJobList();
310
+
311
+    /**
312
+     * Returns a logger instance
313
+     *
314
+     * @return \OCP\ILogger
315
+     * @since 8.0.0
316
+     */
317
+    public function getLogger();
318
+
319
+    /**
320
+     * Returns a router for generating and matching urls
321
+     *
322
+     * @return \OCP\Route\IRouter
323
+     * @since 7.0.0
324
+     */
325
+    public function getRouter();
326
+
327
+    /**
328
+     * Returns a search instance
329
+     *
330
+     * @return \OCP\ISearch
331
+     * @since 7.0.0
332
+     */
333
+    public function getSearch();
334
+
335
+    /**
336
+     * Get the certificate manager for the user
337
+     *
338
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
339
+     * @return \OCP\ICertificateManager | null if $userId is null and no user is logged in
340
+     * @since 8.0.0
341
+     */
342
+    public function getCertificateManager($userId = null);
343
+
344
+    /**
345
+     * Create a new event source
346
+     *
347
+     * @return \OCP\IEventSource
348
+     * @since 8.0.0
349
+     */
350
+    public function createEventSource();
351
+
352
+    /**
353
+     * Returns an instance of the HTTP client service
354
+     *
355
+     * @return \OCP\Http\Client\IClientService
356
+     * @since 8.1.0
357
+     */
358
+    public function getHTTPClientService();
359
+
360
+    /**
361
+     * Get the active event logger
362
+     *
363
+     * @return \OCP\Diagnostics\IEventLogger
364
+     * @since 8.0.0
365
+     */
366
+    public function getEventLogger();
367
+
368
+    /**
369
+     * Get the active query logger
370
+     *
371
+     * The returned logger only logs data when debug mode is enabled
372
+     *
373
+     * @return \OCP\Diagnostics\IQueryLogger
374
+     * @since 8.0.0
375
+     */
376
+    public function getQueryLogger();
377
+
378
+    /**
379
+     * Get the manager for temporary files and folders
380
+     *
381
+     * @return \OCP\ITempManager
382
+     * @since 8.0.0
383
+     */
384
+    public function getTempManager();
385
+
386
+    /**
387
+     * Get the app manager
388
+     *
389
+     * @return \OCP\App\IAppManager
390
+     * @since 8.0.0
391
+     */
392
+    public function getAppManager();
393
+
394
+    /**
395
+     * Get the webroot
396
+     *
397
+     * @return string
398
+     * @since 8.0.0
399
+     */
400
+    public function getWebRoot();
401
+
402
+    /**
403
+     * @return \OCP\Files\Config\IMountProviderCollection
404
+     * @since 8.0.0
405
+     */
406
+    public function getMountProviderCollection();
407
+
408
+    /**
409
+     * Get the IniWrapper
410
+     *
411
+     * @return \bantu\IniGetWrapper\IniGetWrapper
412
+     * @since 8.0.0
413
+     */
414
+    public function getIniWrapper();
415
+    /**
416
+     * @return \OCP\Command\IBus
417
+     * @since 8.1.0
418
+     */
419
+    public function getCommandBus();
420
+
421
+    /**
422
+     * Creates a new mailer
423
+     *
424
+     * @return \OCP\Mail\IMailer
425
+     * @since 8.1.0
426
+     */
427
+    public function getMailer();
428
+
429
+    /**
430
+     * Get the locking provider
431
+     *
432
+     * @return \OCP\Lock\ILockingProvider
433
+     * @since 8.1.0
434
+     */
435
+    public function getLockingProvider();
436
+
437
+    /**
438
+     * @return \OCP\Files\Mount\IMountManager
439
+     * @since 8.2.0
440
+     */
441
+    public function getMountManager();
442
+
443
+    /**
444
+     * Get the MimeTypeDetector
445
+     *
446
+     * @return \OCP\Files\IMimeTypeDetector
447
+     * @since 8.2.0
448
+     */
449
+    public function getMimeTypeDetector();
450
+
451
+    /**
452
+     * Get the MimeTypeLoader
453
+     *
454
+     * @return \OCP\Files\IMimeTypeLoader
455
+     * @since 8.2.0
456
+     */
457
+    public function getMimeTypeLoader();
458
+
459
+    /**
460
+     * Get the EventDispatcher
461
+     *
462
+     * @return EventDispatcherInterface
463
+     * @since 8.2.0
464
+     */
465
+    public function getEventDispatcher();
466
+
467
+    /**
468
+     * Get the Notification Manager
469
+     *
470
+     * @return \OCP\Notification\IManager
471
+     * @since 9.0.0
472
+     */
473
+    public function getNotificationManager();
474
+
475
+    /**
476
+     * @return \OCP\Comments\ICommentsManager
477
+     * @since 9.0.0
478
+     */
479
+    public function getCommentsManager();
480
+
481
+    /**
482
+     * Returns the system-tag manager
483
+     *
484
+     * @return \OCP\SystemTag\ISystemTagManager
485
+     *
486
+     * @since 9.0.0
487
+     */
488
+    public function getSystemTagManager();
489
+
490
+    /**
491
+     * Returns the system-tag object mapper
492
+     *
493
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
494
+     *
495
+     * @since 9.0.0
496
+     */
497
+    public function getSystemTagObjectMapper();
498
+
499
+    /**
500
+     * Returns the share manager
501
+     *
502
+     * @return \OCP\Share\IManager
503
+     * @since 9.0.0
504
+     */
505
+    public function getShareManager();
506
+
507
+    /**
508
+     * @return IContentSecurityPolicyManager
509
+     * @since 9.0.0
510
+     */
511
+    public function getContentSecurityPolicyManager();
512
+
513
+    /**
514
+     * @return \OCP\IDateTimeZone
515
+     * @since 8.0.0
516
+     */
517
+    public function getDateTimeZone();
518
+
519
+    /**
520
+     * @return \OCP\IDateTimeFormatter
521
+     * @since 8.0.0
522
+     */
523
+    public function getDateTimeFormatter();
524
+
525
+    /**
526
+     * @return \OCP\Federation\ICloudIdManager
527
+     * @since 12.0.0
528
+     */
529
+    public function getCloudIdManager();
530
+
531
+    /**
532
+     * @return \OCP\GlobalScale\IConfig
533
+     */
534
+    public function getGlobalScaleConfig();
535
+
536
+    /**
537
+     * @return ICloudFederationFactory
538
+     * @since 14.0.0
539
+     */
540
+    public function getCloudFederationFactory();
541
+
542
+    /**
543
+     * @return ICloudFederationProviderManager
544
+     * @since 14.0.0
545
+     */
546
+    public function getCloudFederationProviderManager();
547
+
548
+    /**
549
+     * @return \OCP\Remote\Api\IApiFactory
550
+     * @since 13.0.0
551
+     */
552
+    public function getRemoteApiFactory();
553
+
554
+    /**
555
+     * @return \OCP\Remote\IInstanceFactory
556
+     * @since 13.0.0
557
+     */
558
+    public function getRemoteInstanceFactory();
559 559
 }
Please login to merge, or discard this patch.
lib/private/Share20/ProviderFactory.php 1 patch
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -48,233 +48,233 @@
 block discarded – undo
48 48
  */
49 49
 class ProviderFactory implements IProviderFactory {
50 50
 
51
-	/** @var IServerContainer */
52
-	private $serverContainer;
53
-	/** @var DefaultShareProvider */
54
-	private $defaultProvider = null;
55
-	/** @var FederatedShareProvider */
56
-	private $federatedProvider = null;
57
-	/** @var  ShareByMailProvider */
58
-	private $shareByMailProvider;
59
-	/** @var  \OCA\Circles\ShareByCircleProvider */
60
-	private $shareByCircleProvider = null;
61
-	/** @var bool */
62
-	private $circlesAreNotAvailable = false;
63
-
64
-	/**
65
-	 * IProviderFactory constructor.
66
-	 *
67
-	 * @param IServerContainer $serverContainer
68
-	 */
69
-	public function __construct(IServerContainer $serverContainer) {
70
-		$this->serverContainer = $serverContainer;
71
-	}
72
-
73
-	/**
74
-	 * Create the default share provider.
75
-	 *
76
-	 * @return DefaultShareProvider
77
-	 */
78
-	protected function defaultShareProvider() {
79
-		if ($this->defaultProvider === null) {
80
-			$this->defaultProvider = new DefaultShareProvider(
81
-				$this->serverContainer->getDatabaseConnection(),
82
-				$this->serverContainer->getUserManager(),
83
-				$this->serverContainer->getGroupManager(),
84
-				$this->serverContainer->getLazyRootFolder()
85
-			);
86
-		}
87
-
88
-		return $this->defaultProvider;
89
-	}
90
-
91
-	/**
92
-	 * Create the federated share provider
93
-	 *
94
-	 * @return FederatedShareProvider
95
-	 */
96
-	protected function federatedShareProvider() {
97
-		if ($this->federatedProvider === null) {
98
-			/*
51
+    /** @var IServerContainer */
52
+    private $serverContainer;
53
+    /** @var DefaultShareProvider */
54
+    private $defaultProvider = null;
55
+    /** @var FederatedShareProvider */
56
+    private $federatedProvider = null;
57
+    /** @var  ShareByMailProvider */
58
+    private $shareByMailProvider;
59
+    /** @var  \OCA\Circles\ShareByCircleProvider */
60
+    private $shareByCircleProvider = null;
61
+    /** @var bool */
62
+    private $circlesAreNotAvailable = false;
63
+
64
+    /**
65
+     * IProviderFactory constructor.
66
+     *
67
+     * @param IServerContainer $serverContainer
68
+     */
69
+    public function __construct(IServerContainer $serverContainer) {
70
+        $this->serverContainer = $serverContainer;
71
+    }
72
+
73
+    /**
74
+     * Create the default share provider.
75
+     *
76
+     * @return DefaultShareProvider
77
+     */
78
+    protected function defaultShareProvider() {
79
+        if ($this->defaultProvider === null) {
80
+            $this->defaultProvider = new DefaultShareProvider(
81
+                $this->serverContainer->getDatabaseConnection(),
82
+                $this->serverContainer->getUserManager(),
83
+                $this->serverContainer->getGroupManager(),
84
+                $this->serverContainer->getLazyRootFolder()
85
+            );
86
+        }
87
+
88
+        return $this->defaultProvider;
89
+    }
90
+
91
+    /**
92
+     * Create the federated share provider
93
+     *
94
+     * @return FederatedShareProvider
95
+     */
96
+    protected function federatedShareProvider() {
97
+        if ($this->federatedProvider === null) {
98
+            /*
99 99
 			 * Check if the app is enabled
100 100
 			 */
101
-			$appManager = $this->serverContainer->getAppManager();
102
-			if (!$appManager->isEnabledForUser('federatedfilesharing')) {
103
-				return null;
104
-			}
101
+            $appManager = $this->serverContainer->getAppManager();
102
+            if (!$appManager->isEnabledForUser('federatedfilesharing')) {
103
+                return null;
104
+            }
105 105
 
106
-			/*
106
+            /*
107 107
 			 * TODO: add factory to federated sharing app
108 108
 			 */
109
-			$l = $this->serverContainer->getL10N('federatedfilessharing');
110
-			$addressHandler = new AddressHandler(
111
-				$this->serverContainer->getURLGenerator(),
112
-				$l,
113
-				$this->serverContainer->getCloudIdManager()
114
-			);
115
-			$notifications = new Notifications(
116
-				$addressHandler,
117
-				$this->serverContainer->getHTTPClientService(),
118
-				$this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
119
-				$this->serverContainer->getJobList()
120
-			);
121
-			$tokenHandler = new TokenHandler(
122
-				$this->serverContainer->getSecureRandom()
123
-			);
124
-
125
-			$this->federatedProvider = new FederatedShareProvider(
126
-				$this->serverContainer->getDatabaseConnection(),
127
-				$addressHandler,
128
-				$notifications,
129
-				$tokenHandler,
130
-				$l,
131
-				$this->serverContainer->getLogger(),
132
-				$this->serverContainer->getLazyRootFolder(),
133
-				$this->serverContainer->getConfig(),
134
-				$this->serverContainer->getUserManager(),
135
-				$this->serverContainer->getCloudIdManager(),
136
-				$this->serverContainer->getGlobalScaleConfig()
137
-			);
138
-		}
139
-
140
-		return $this->federatedProvider;
141
-	}
142
-
143
-	/**
144
-	 * Create the federated share provider
145
-	 *
146
-	 * @return ShareByMailProvider
147
-	 */
148
-	protected function getShareByMailProvider() {
149
-		if ($this->shareByMailProvider === null) {
150
-			/*
109
+            $l = $this->serverContainer->getL10N('federatedfilessharing');
110
+            $addressHandler = new AddressHandler(
111
+                $this->serverContainer->getURLGenerator(),
112
+                $l,
113
+                $this->serverContainer->getCloudIdManager()
114
+            );
115
+            $notifications = new Notifications(
116
+                $addressHandler,
117
+                $this->serverContainer->getHTTPClientService(),
118
+                $this->serverContainer->query(\OCP\OCS\IDiscoveryService::class),
119
+                $this->serverContainer->getJobList()
120
+            );
121
+            $tokenHandler = new TokenHandler(
122
+                $this->serverContainer->getSecureRandom()
123
+            );
124
+
125
+            $this->federatedProvider = new FederatedShareProvider(
126
+                $this->serverContainer->getDatabaseConnection(),
127
+                $addressHandler,
128
+                $notifications,
129
+                $tokenHandler,
130
+                $l,
131
+                $this->serverContainer->getLogger(),
132
+                $this->serverContainer->getLazyRootFolder(),
133
+                $this->serverContainer->getConfig(),
134
+                $this->serverContainer->getUserManager(),
135
+                $this->serverContainer->getCloudIdManager(),
136
+                $this->serverContainer->getGlobalScaleConfig()
137
+            );
138
+        }
139
+
140
+        return $this->federatedProvider;
141
+    }
142
+
143
+    /**
144
+     * Create the federated share provider
145
+     *
146
+     * @return ShareByMailProvider
147
+     */
148
+    protected function getShareByMailProvider() {
149
+        if ($this->shareByMailProvider === null) {
150
+            /*
151 151
 			 * Check if the app is enabled
152 152
 			 */
153
-			$appManager = $this->serverContainer->getAppManager();
154
-			if (!$appManager->isEnabledForUser('sharebymail')) {
155
-				return null;
156
-			}
157
-
158
-			$settingsManager = new SettingsManager($this->serverContainer->getConfig());
159
-
160
-			$this->shareByMailProvider = new ShareByMailProvider(
161
-				$this->serverContainer->getDatabaseConnection(),
162
-				$this->serverContainer->getSecureRandom(),
163
-				$this->serverContainer->getUserManager(),
164
-				$this->serverContainer->getLazyRootFolder(),
165
-				$this->serverContainer->getL10N('sharebymail'),
166
-				$this->serverContainer->getLogger(),
167
-				$this->serverContainer->getMailer(),
168
-				$this->serverContainer->getURLGenerator(),
169
-				$this->serverContainer->getActivityManager(),
170
-				$settingsManager,
171
-				$this->serverContainer->query(Defaults::class),
172
-				$this->serverContainer->getHasher(),
173
-				$this->serverContainer->query(CapabilitiesManager::class)
174
-			);
175
-		}
176
-
177
-		return $this->shareByMailProvider;
178
-	}
179
-
180
-
181
-	/**
182
-	 * Create the circle share provider
183
-	 *
184
-	 * @return FederatedShareProvider
185
-	 *
186
-	 * @suppress PhanUndeclaredClassMethod
187
-	 */
188
-	protected function getShareByCircleProvider() {
189
-
190
-		if ($this->circlesAreNotAvailable) {
191
-			return null;
192
-		}
193
-
194
-		if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
195
-			!class_exists('\OCA\Circles\ShareByCircleProvider')
196
-		) {
197
-			$this->circlesAreNotAvailable = true;
198
-			return null;
199
-		}
200
-
201
-		if ($this->shareByCircleProvider === null) {
202
-
203
-			$this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
204
-				$this->serverContainer->getDatabaseConnection(),
205
-				$this->serverContainer->getSecureRandom(),
206
-				$this->serverContainer->getUserManager(),
207
-				$this->serverContainer->getLazyRootFolder(),
208
-				$this->serverContainer->getL10N('circles'),
209
-				$this->serverContainer->getLogger(),
210
-				$this->serverContainer->getURLGenerator()
211
-			);
212
-		}
213
-
214
-		return $this->shareByCircleProvider;
215
-	}
216
-
217
-
218
-	/**
219
-	 * @inheritdoc
220
-	 */
221
-	public function getProvider($id) {
222
-		$provider = null;
223
-		if ($id === 'ocinternal') {
224
-			$provider = $this->defaultShareProvider();
225
-		} else if ($id === 'ocFederatedSharing') {
226
-			$provider = $this->federatedShareProvider();
227
-		} else if ($id === 'ocMailShare') {
228
-			$provider = $this->getShareByMailProvider();
229
-		} else if ($id === 'ocCircleShare') {
230
-			$provider = $this->getShareByCircleProvider();
231
-		}
232
-
233
-		if ($provider === null) {
234
-			throw new ProviderException('No provider with id .' . $id . ' found.');
235
-		}
236
-
237
-		return $provider;
238
-	}
239
-
240
-	/**
241
-	 * @inheritdoc
242
-	 */
243
-	public function getProviderForType($shareType) {
244
-		$provider = null;
245
-
246
-		if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
247
-			$shareType === \OCP\Share::SHARE_TYPE_GROUP ||
248
-			$shareType === \OCP\Share::SHARE_TYPE_LINK
249
-		) {
250
-			$provider = $this->defaultShareProvider();
251
-		} else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
252
-			$provider = $this->federatedShareProvider();
253
-		} else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
254
-			$provider = $this->getShareByMailProvider();
255
-		} else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
256
-			$provider = $this->getShareByCircleProvider();
257
-		}
258
-
259
-
260
-		if ($provider === null) {
261
-			throw new ProviderException('No share provider for share type ' . $shareType);
262
-		}
263
-
264
-		return $provider;
265
-	}
266
-
267
-	public function getAllProviders() {
268
-		$shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
269
-		$shareByMail = $this->getShareByMailProvider();
270
-		if ($shareByMail !== null) {
271
-			$shares[] = $shareByMail;
272
-		}
273
-		$shareByCircle = $this->getShareByCircleProvider();
274
-		if ($shareByCircle !== null) {
275
-			$shares[] = $shareByCircle;
276
-		}
277
-
278
-		return $shares;
279
-	}
153
+            $appManager = $this->serverContainer->getAppManager();
154
+            if (!$appManager->isEnabledForUser('sharebymail')) {
155
+                return null;
156
+            }
157
+
158
+            $settingsManager = new SettingsManager($this->serverContainer->getConfig());
159
+
160
+            $this->shareByMailProvider = new ShareByMailProvider(
161
+                $this->serverContainer->getDatabaseConnection(),
162
+                $this->serverContainer->getSecureRandom(),
163
+                $this->serverContainer->getUserManager(),
164
+                $this->serverContainer->getLazyRootFolder(),
165
+                $this->serverContainer->getL10N('sharebymail'),
166
+                $this->serverContainer->getLogger(),
167
+                $this->serverContainer->getMailer(),
168
+                $this->serverContainer->getURLGenerator(),
169
+                $this->serverContainer->getActivityManager(),
170
+                $settingsManager,
171
+                $this->serverContainer->query(Defaults::class),
172
+                $this->serverContainer->getHasher(),
173
+                $this->serverContainer->query(CapabilitiesManager::class)
174
+            );
175
+        }
176
+
177
+        return $this->shareByMailProvider;
178
+    }
179
+
180
+
181
+    /**
182
+     * Create the circle share provider
183
+     *
184
+     * @return FederatedShareProvider
185
+     *
186
+     * @suppress PhanUndeclaredClassMethod
187
+     */
188
+    protected function getShareByCircleProvider() {
189
+
190
+        if ($this->circlesAreNotAvailable) {
191
+            return null;
192
+        }
193
+
194
+        if (!$this->serverContainer->getAppManager()->isEnabledForUser('circles') ||
195
+            !class_exists('\OCA\Circles\ShareByCircleProvider')
196
+        ) {
197
+            $this->circlesAreNotAvailable = true;
198
+            return null;
199
+        }
200
+
201
+        if ($this->shareByCircleProvider === null) {
202
+
203
+            $this->shareByCircleProvider = new \OCA\Circles\ShareByCircleProvider(
204
+                $this->serverContainer->getDatabaseConnection(),
205
+                $this->serverContainer->getSecureRandom(),
206
+                $this->serverContainer->getUserManager(),
207
+                $this->serverContainer->getLazyRootFolder(),
208
+                $this->serverContainer->getL10N('circles'),
209
+                $this->serverContainer->getLogger(),
210
+                $this->serverContainer->getURLGenerator()
211
+            );
212
+        }
213
+
214
+        return $this->shareByCircleProvider;
215
+    }
216
+
217
+
218
+    /**
219
+     * @inheritdoc
220
+     */
221
+    public function getProvider($id) {
222
+        $provider = null;
223
+        if ($id === 'ocinternal') {
224
+            $provider = $this->defaultShareProvider();
225
+        } else if ($id === 'ocFederatedSharing') {
226
+            $provider = $this->federatedShareProvider();
227
+        } else if ($id === 'ocMailShare') {
228
+            $provider = $this->getShareByMailProvider();
229
+        } else if ($id === 'ocCircleShare') {
230
+            $provider = $this->getShareByCircleProvider();
231
+        }
232
+
233
+        if ($provider === null) {
234
+            throw new ProviderException('No provider with id .' . $id . ' found.');
235
+        }
236
+
237
+        return $provider;
238
+    }
239
+
240
+    /**
241
+     * @inheritdoc
242
+     */
243
+    public function getProviderForType($shareType) {
244
+        $provider = null;
245
+
246
+        if ($shareType === \OCP\Share::SHARE_TYPE_USER ||
247
+            $shareType === \OCP\Share::SHARE_TYPE_GROUP ||
248
+            $shareType === \OCP\Share::SHARE_TYPE_LINK
249
+        ) {
250
+            $provider = $this->defaultShareProvider();
251
+        } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE) {
252
+            $provider = $this->federatedShareProvider();
253
+        } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) {
254
+            $provider = $this->getShareByMailProvider();
255
+        } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) {
256
+            $provider = $this->getShareByCircleProvider();
257
+        }
258
+
259
+
260
+        if ($provider === null) {
261
+            throw new ProviderException('No share provider for share type ' . $shareType);
262
+        }
263
+
264
+        return $provider;
265
+    }
266
+
267
+    public function getAllProviders() {
268
+        $shares = [$this->defaultShareProvider(), $this->federatedShareProvider()];
269
+        $shareByMail = $this->getShareByMailProvider();
270
+        if ($shareByMail !== null) {
271
+            $shares[] = $shareByMail;
272
+        }
273
+        $shareByCircle = $this->getShareByCircleProvider();
274
+        if ($shareByCircle !== null) {
275
+            $shares[] = $shareByCircle;
276
+        }
277
+
278
+        return $shares;
279
+    }
280 280
 }
Please login to merge, or discard this patch.
lib/private/Server.php 1 patch
Indentation   +1846 added lines, -1846 removed lines patch added patch discarded remove patch
@@ -156,1855 +156,1855 @@
 block discarded – undo
156 156
  * TODO: hookup all manager classes
157 157
  */
158 158
 class Server extends ServerContainer implements IServerContainer {
159
-	/** @var string */
160
-	private $webRoot;
161
-
162
-	/**
163
-	 * @param string $webRoot
164
-	 * @param \OC\Config $config
165
-	 */
166
-	public function __construct($webRoot, \OC\Config $config) {
167
-		parent::__construct();
168
-		$this->webRoot = $webRoot;
169
-
170
-		$this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) {
171
-			return $c;
172
-		});
173
-
174
-		$this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class);
175
-		$this->registerAlias('CalendarManager', \OC\Calendar\Manager::class);
176
-
177
-		$this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
178
-		$this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
179
-
180
-		$this->registerAlias(IActionFactory::class, ActionFactory::class);
181
-
182
-
183
-		$this->registerService(\OCP\IPreview::class, function (Server $c) {
184
-			return new PreviewManager(
185
-				$c->getConfig(),
186
-				$c->getRootFolder(),
187
-				$c->getAppDataDir('preview'),
188
-				$c->getEventDispatcher(),
189
-				$c->getSession()->get('user_id')
190
-			);
191
-		});
192
-		$this->registerAlias('PreviewManager', \OCP\IPreview::class);
193
-
194
-		$this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
195
-			return new \OC\Preview\Watcher(
196
-				$c->getAppDataDir('preview')
197
-			);
198
-		});
199
-
200
-		$this->registerService('EncryptionManager', function (Server $c) {
201
-			$view = new View();
202
-			$util = new Encryption\Util(
203
-				$view,
204
-				$c->getUserManager(),
205
-				$c->getGroupManager(),
206
-				$c->getConfig()
207
-			);
208
-			return new Encryption\Manager(
209
-				$c->getConfig(),
210
-				$c->getLogger(),
211
-				$c->getL10N('core'),
212
-				new View(),
213
-				$util,
214
-				new ArrayCache()
215
-			);
216
-		});
217
-
218
-		$this->registerService('EncryptionFileHelper', function (Server $c) {
219
-			$util = new Encryption\Util(
220
-				new View(),
221
-				$c->getUserManager(),
222
-				$c->getGroupManager(),
223
-				$c->getConfig()
224
-			);
225
-			return new Encryption\File(
226
-				$util,
227
-				$c->getRootFolder(),
228
-				$c->getShareManager()
229
-			);
230
-		});
231
-
232
-		$this->registerService('EncryptionKeyStorage', function (Server $c) {
233
-			$view = new View();
234
-			$util = new Encryption\Util(
235
-				$view,
236
-				$c->getUserManager(),
237
-				$c->getGroupManager(),
238
-				$c->getConfig()
239
-			);
240
-
241
-			return new Encryption\Keys\Storage($view, $util);
242
-		});
243
-		$this->registerService('TagMapper', function (Server $c) {
244
-			return new TagMapper($c->getDatabaseConnection());
245
-		});
246
-
247
-		$this->registerService(\OCP\ITagManager::class, function (Server $c) {
248
-			$tagMapper = $c->query('TagMapper');
249
-			return new TagManager($tagMapper, $c->getUserSession());
250
-		});
251
-		$this->registerAlias('TagManager', \OCP\ITagManager::class);
252
-
253
-		$this->registerService('SystemTagManagerFactory', function (Server $c) {
254
-			$config = $c->getConfig();
255
-			$factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
256
-			return new $factoryClass($this);
257
-		});
258
-		$this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
259
-			return $c->query('SystemTagManagerFactory')->getManager();
260
-		});
261
-		$this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
262
-
263
-		$this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
264
-			return $c->query('SystemTagManagerFactory')->getObjectMapper();
265
-		});
266
-		$this->registerService('RootFolder', function (Server $c) {
267
-			$manager = \OC\Files\Filesystem::getMountManager(null);
268
-			$view = new View();
269
-			$root = new Root(
270
-				$manager,
271
-				$view,
272
-				null,
273
-				$c->getUserMountCache(),
274
-				$this->getLogger(),
275
-				$this->getUserManager()
276
-			);
277
-			$connector = new HookConnector($root, $view);
278
-			$connector->viewToNode();
279
-
280
-			$previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
281
-			$previewConnector->connectWatcher();
282
-
283
-			return $root;
284
-		});
285
-		$this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
286
-
287
-		$this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) {
288
-			return new LazyRoot(function () use ($c) {
289
-				return $c->query('RootFolder');
290
-			});
291
-		});
292
-		$this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
293
-
294
-		$this->registerService(\OC\User\Manager::class, function (Server $c) {
295
-			$config = $c->getConfig();
296
-			return new \OC\User\Manager($config);
297
-		});
298
-		$this->registerAlias('UserManager', \OC\User\Manager::class);
299
-		$this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
300
-
301
-		$this->registerService(\OCP\IGroupManager::class, function (Server $c) {
302
-			$groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger());
303
-			$groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
304
-				\OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
305
-			});
306
-			$groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
307
-				\OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
308
-			});
309
-			$groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
310
-				\OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
311
-			});
312
-			$groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
313
-				\OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
314
-			});
315
-			$groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
316
-				\OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
317
-			});
318
-			$groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
319
-				\OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
320
-				//Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
321
-				\OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
322
-			});
323
-			return $groupManager;
324
-		});
325
-		$this->registerAlias('GroupManager', \OCP\IGroupManager::class);
326
-
327
-		$this->registerService(Store::class, function (Server $c) {
328
-			$session = $c->getSession();
329
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
330
-				$tokenProvider = $c->query(IProvider::class);
331
-			} else {
332
-				$tokenProvider = null;
333
-			}
334
-			$logger = $c->getLogger();
335
-			return new Store($session, $logger, $tokenProvider);
336
-		});
337
-		$this->registerAlias(IStore::class, Store::class);
338
-		$this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
339
-			$dbConnection = $c->getDatabaseConnection();
340
-			return new Authentication\Token\DefaultTokenMapper($dbConnection);
341
-		});
342
-		$this->registerService(Authentication\Token\DefaultTokenProvider::class, function (Server $c) {
343
-			$mapper = $c->query(Authentication\Token\DefaultTokenMapper::class);
344
-			$crypto = $c->getCrypto();
345
-			$config = $c->getConfig();
346
-			$logger = $c->getLogger();
347
-			$timeFactory = new TimeFactory();
348
-			return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory);
349
-		});
350
-		$this->registerAlias(IProvider::class, Authentication\Token\DefaultTokenProvider::class);
351
-
352
-		$this->registerService(\OCP\IUserSession::class, function (Server $c) {
353
-			$manager = $c->getUserManager();
354
-			$session = new \OC\Session\Memory('');
355
-			$timeFactory = new TimeFactory();
356
-			// Token providers might require a working database. This code
357
-			// might however be called when ownCloud is not yet setup.
358
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
359
-				$defaultTokenProvider = $c->query(IProvider::class);
360
-			} else {
361
-				$defaultTokenProvider = null;
362
-			}
363
-
364
-			$dispatcher = $c->getEventDispatcher();
365
-
366
-			$userSession = new \OC\User\Session(
367
-				$manager,
368
-				$session,
369
-				$timeFactory,
370
-				$defaultTokenProvider,
371
-				$c->getConfig(),
372
-				$c->getSecureRandom(),
373
-				$c->getLockdownManager(),
374
-				$c->getLogger()
375
-			);
376
-			$userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
377
-				\OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
378
-			});
379
-			$userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
380
-				/** @var $user \OC\User\User */
381
-				\OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
382
-			});
383
-			$userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) {
384
-				/** @var $user \OC\User\User */
385
-				\OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
386
-				$dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
387
-			});
388
-			$userSession->listen('\OC\User', 'postDelete', function ($user) {
389
-				/** @var $user \OC\User\User */
390
-				\OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
391
-			});
392
-			$userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
393
-				/** @var $user \OC\User\User */
394
-				\OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
395
-			});
396
-			$userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
397
-				/** @var $user \OC\User\User */
398
-				\OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
399
-			});
400
-			$userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
401
-				\OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
402
-			});
403
-			$userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
404
-				/** @var $user \OC\User\User */
405
-				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
406
-			});
407
-			$userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
408
-				/** @var $user \OC\User\User */
409
-				\OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
410
-			});
411
-			$userSession->listen('\OC\User', 'logout', function () {
412
-				\OC_Hook::emit('OC_User', 'logout', array());
413
-			});
414
-			$userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) {
415
-				/** @var $user \OC\User\User */
416
-				\OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
417
-				$dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value]));
418
-			});
419
-			return $userSession;
420
-		});
421
-		$this->registerAlias('UserSession', \OCP\IUserSession::class);
422
-
423
-		$this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) {
424
-			return new \OC\Authentication\TwoFactorAuth\Manager(
425
-				$c->getAppManager(),
426
-				$c->getSession(),
427
-				$c->getConfig(),
428
-				$c->getActivityManager(),
429
-				$c->getLogger(),
430
-				$c->query(IProvider::class),
431
-				$c->query(ITimeFactory::class),
432
-				$c->query(EventDispatcherInterface::class)
433
-			);
434
-		});
435
-
436
-		$this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
437
-		$this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
438
-
439
-		$this->registerService(\OC\AllConfig::class, function (Server $c) {
440
-			return new \OC\AllConfig(
441
-				$c->getSystemConfig()
442
-			);
443
-		});
444
-		$this->registerAlias('AllConfig', \OC\AllConfig::class);
445
-		$this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
446
-
447
-		$this->registerService('SystemConfig', function ($c) use ($config) {
448
-			return new \OC\SystemConfig($config);
449
-		});
450
-
451
-		$this->registerService(\OC\AppConfig::class, function (Server $c) {
452
-			return new \OC\AppConfig($c->getDatabaseConnection());
453
-		});
454
-		$this->registerAlias('AppConfig', \OC\AppConfig::class);
455
-		$this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
456
-
457
-		$this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
458
-			return new \OC\L10N\Factory(
459
-				$c->getConfig(),
460
-				$c->getRequest(),
461
-				$c->getUserSession(),
462
-				\OC::$SERVERROOT
463
-			);
464
-		});
465
-		$this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
466
-
467
-		$this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
468
-			$config = $c->getConfig();
469
-			$cacheFactory = $c->getMemCacheFactory();
470
-			$request = $c->getRequest();
471
-			return new \OC\URLGenerator(
472
-				$config,
473
-				$cacheFactory,
474
-				$request
475
-			);
476
-		});
477
-		$this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
478
-
479
-		$this->registerAlias('AppFetcher', AppFetcher::class);
480
-		$this->registerAlias('CategoryFetcher', CategoryFetcher::class);
481
-
482
-		$this->registerService(\OCP\ICache::class, function ($c) {
483
-			return new Cache\File();
484
-		});
485
-		$this->registerAlias('UserCache', \OCP\ICache::class);
486
-
487
-		$this->registerService(Factory::class, function (Server $c) {
488
-
489
-			$arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
490
-				ArrayCache::class,
491
-				ArrayCache::class,
492
-				ArrayCache::class
493
-			);
494
-			$config = $c->getConfig();
495
-			$request = $c->getRequest();
496
-			$urlGenerator = new URLGenerator($config, $arrayCacheFactory, $request);
497
-
498
-			if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
499
-				$v = \OC_App::getAppVersions();
500
-				$v['core'] = implode(',', \OC_Util::getVersion());
501
-				$version = implode(',', $v);
502
-				$instanceId = \OC_Util::getInstanceId();
503
-				$path = \OC::$SERVERROOT;
504
-				$prefix = md5($instanceId . '-' . $version . '-' . $path);
505
-				return new \OC\Memcache\Factory($prefix, $c->getLogger(),
506
-					$config->getSystemValue('memcache.local', null),
507
-					$config->getSystemValue('memcache.distributed', null),
508
-					$config->getSystemValue('memcache.locking', null)
509
-				);
510
-			}
511
-			return $arrayCacheFactory;
512
-
513
-		});
514
-		$this->registerAlias('MemCacheFactory', Factory::class);
515
-		$this->registerAlias(ICacheFactory::class, Factory::class);
516
-
517
-		$this->registerService('RedisFactory', function (Server $c) {
518
-			$systemConfig = $c->getSystemConfig();
519
-			return new RedisFactory($systemConfig);
520
-		});
521
-
522
-		$this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
523
-			return new \OC\Activity\Manager(
524
-				$c->getRequest(),
525
-				$c->getUserSession(),
526
-				$c->getConfig(),
527
-				$c->query(IValidator::class)
528
-			);
529
-		});
530
-		$this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
531
-
532
-		$this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
533
-			return new \OC\Activity\EventMerger(
534
-				$c->getL10N('lib')
535
-			);
536
-		});
537
-		$this->registerAlias(IValidator::class, Validator::class);
538
-
539
-		$this->registerService(\OCP\IAvatarManager::class, function (Server $c) {
540
-			return new AvatarManager(
541
-				$c->query(\OC\User\Manager::class),
542
-				$c->getAppDataDir('avatar'),
543
-				$c->getL10N('lib'),
544
-				$c->getLogger(),
545
-				$c->getConfig()
546
-			);
547
-		});
548
-		$this->registerAlias('AvatarManager', \OCP\IAvatarManager::class);
549
-
550
-		$this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
551
-
552
-		$this->registerService(\OCP\ILogger::class, function (Server $c) {
553
-			$logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
554
-			$logger = Log::getLogClass($logType);
555
-			call_user_func(array($logger, 'init'));
556
-			$config = $this->getSystemConfig();
557
-			$registry = $c->query(\OCP\Support\CrashReport\IRegistry::class);
558
-
559
-			return new Log($logger, $config, null, $registry);
560
-		});
561
-		$this->registerAlias('Logger', \OCP\ILogger::class);
562
-
563
-		$this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
564
-			$config = $c->getConfig();
565
-			return new \OC\BackgroundJob\JobList(
566
-				$c->getDatabaseConnection(),
567
-				$config,
568
-				new TimeFactory()
569
-			);
570
-		});
571
-		$this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
572
-
573
-		$this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
574
-			$cacheFactory = $c->getMemCacheFactory();
575
-			$logger = $c->getLogger();
576
-			if ($cacheFactory->isLocalCacheAvailable()) {
577
-				$router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
578
-			} else {
579
-				$router = new \OC\Route\Router($logger);
580
-			}
581
-			return $router;
582
-		});
583
-		$this->registerAlias('Router', \OCP\Route\IRouter::class);
584
-
585
-		$this->registerService(\OCP\ISearch::class, function ($c) {
586
-			return new Search();
587
-		});
588
-		$this->registerAlias('Search', \OCP\ISearch::class);
589
-
590
-		$this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) {
591
-			return new \OC\Security\RateLimiting\Limiter(
592
-				$this->getUserSession(),
593
-				$this->getRequest(),
594
-				new \OC\AppFramework\Utility\TimeFactory(),
595
-				$c->query(\OC\Security\RateLimiting\Backend\IBackend::class)
596
-			);
597
-		});
598
-		$this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
599
-			return new \OC\Security\RateLimiting\Backend\MemoryCache(
600
-				$this->getMemCacheFactory(),
601
-				new \OC\AppFramework\Utility\TimeFactory()
602
-			);
603
-		});
604
-
605
-		$this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
606
-			return new SecureRandom();
607
-		});
608
-		$this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
609
-
610
-		$this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
611
-			return new Crypto($c->getConfig(), $c->getSecureRandom());
612
-		});
613
-		$this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
614
-
615
-		$this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
616
-			return new Hasher($c->getConfig());
617
-		});
618
-		$this->registerAlias('Hasher', \OCP\Security\IHasher::class);
619
-
620
-		$this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
621
-			return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
622
-		});
623
-		$this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
624
-
625
-		$this->registerService(IDBConnection::class, function (Server $c) {
626
-			$systemConfig = $c->getSystemConfig();
627
-			$factory = new \OC\DB\ConnectionFactory($systemConfig);
628
-			$type = $systemConfig->getValue('dbtype', 'sqlite');
629
-			if (!$factory->isValidType($type)) {
630
-				throw new \OC\DatabaseException('Invalid database type');
631
-			}
632
-			$connectionParams = $factory->createConnectionParams();
633
-			$connection = $factory->getConnection($type, $connectionParams);
634
-			$connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
635
-			return $connection;
636
-		});
637
-		$this->registerAlias('DatabaseConnection', IDBConnection::class);
638
-
639
-
640
-		$this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
641
-			$user = \OC_User::getUser();
642
-			$uid = $user ? $user : null;
643
-			return new ClientService(
644
-				$c->getConfig(),
645
-				new \OC\Security\CertificateManager(
646
-					$uid,
647
-					new View(),
648
-					$c->getConfig(),
649
-					$c->getLogger(),
650
-					$c->getSecureRandom()
651
-				)
652
-			);
653
-		});
654
-		$this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
655
-		$this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
656
-			$eventLogger = new EventLogger();
657
-			if ($c->getSystemConfig()->getValue('debug', false)) {
658
-				// In debug mode, module is being activated by default
659
-				$eventLogger->activate();
660
-			}
661
-			return $eventLogger;
662
-		});
663
-		$this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
664
-
665
-		$this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
666
-			$queryLogger = new QueryLogger();
667
-			if ($c->getSystemConfig()->getValue('debug', false)) {
668
-				// In debug mode, module is being activated by default
669
-				$queryLogger->activate();
670
-			}
671
-			return $queryLogger;
672
-		});
673
-		$this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
674
-
675
-		$this->registerService(TempManager::class, function (Server $c) {
676
-			return new TempManager(
677
-				$c->getLogger(),
678
-				$c->getConfig()
679
-			);
680
-		});
681
-		$this->registerAlias('TempManager', TempManager::class);
682
-		$this->registerAlias(ITempManager::class, TempManager::class);
683
-
684
-		$this->registerService(AppManager::class, function (Server $c) {
685
-			return new \OC\App\AppManager(
686
-				$c->getUserSession(),
687
-				$c->query(\OC\AppConfig::class),
688
-				$c->getGroupManager(),
689
-				$c->getMemCacheFactory(),
690
-				$c->getEventDispatcher()
691
-			);
692
-		});
693
-		$this->registerAlias('AppManager', AppManager::class);
694
-		$this->registerAlias(IAppManager::class, AppManager::class);
695
-
696
-		$this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
697
-			return new DateTimeZone(
698
-				$c->getConfig(),
699
-				$c->getSession()
700
-			);
701
-		});
702
-		$this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
703
-
704
-		$this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
705
-			$language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
706
-
707
-			return new DateTimeFormatter(
708
-				$c->getDateTimeZone()->getTimeZone(),
709
-				$c->getL10N('lib', $language)
710
-			);
711
-		});
712
-		$this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
713
-
714
-		$this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
715
-			$mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
716
-			$listener = new UserMountCacheListener($mountCache);
717
-			$listener->listen($c->getUserManager());
718
-			return $mountCache;
719
-		});
720
-		$this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
721
-
722
-		$this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
723
-			$loader = \OC\Files\Filesystem::getLoader();
724
-			$mountCache = $c->query('UserMountCache');
725
-			$manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
726
-
727
-			// builtin providers
728
-
729
-			$config = $c->getConfig();
730
-			$manager->registerProvider(new CacheMountProvider($config));
731
-			$manager->registerHomeProvider(new LocalHomeMountProvider());
732
-			$manager->registerHomeProvider(new ObjectHomeMountProvider($config));
733
-
734
-			return $manager;
735
-		});
736
-		$this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
737
-
738
-		$this->registerService('IniWrapper', function ($c) {
739
-			return new IniGetWrapper();
740
-		});
741
-		$this->registerService('AsyncCommandBus', function (Server $c) {
742
-			$busClass = $c->getConfig()->getSystemValue('commandbus');
743
-			if ($busClass) {
744
-				list($app, $class) = explode('::', $busClass, 2);
745
-				if ($c->getAppManager()->isInstalled($app)) {
746
-					\OC_App::loadApp($app);
747
-					return $c->query($class);
748
-				} else {
749
-					throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled");
750
-				}
751
-			} else {
752
-				$jobList = $c->getJobList();
753
-				return new CronBus($jobList);
754
-			}
755
-		});
756
-		$this->registerService('TrustedDomainHelper', function ($c) {
757
-			return new TrustedDomainHelper($this->getConfig());
758
-		});
759
-		$this->registerService('Throttler', function (Server $c) {
760
-			return new Throttler(
761
-				$c->getDatabaseConnection(),
762
-				new TimeFactory(),
763
-				$c->getLogger(),
764
-				$c->getConfig()
765
-			);
766
-		});
767
-		$this->registerService('IntegrityCodeChecker', function (Server $c) {
768
-			// IConfig and IAppManager requires a working database. This code
769
-			// might however be called when ownCloud is not yet setup.
770
-			if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
771
-				$config = $c->getConfig();
772
-				$appManager = $c->getAppManager();
773
-			} else {
774
-				$config = null;
775
-				$appManager = null;
776
-			}
777
-
778
-			return new Checker(
779
-				new EnvironmentHelper(),
780
-				new FileAccessHelper(),
781
-				new AppLocator(),
782
-				$config,
783
-				$c->getMemCacheFactory(),
784
-				$appManager,
785
-				$c->getTempManager()
786
-			);
787
-		});
788
-		$this->registerService(\OCP\IRequest::class, function ($c) {
789
-			if (isset($this['urlParams'])) {
790
-				$urlParams = $this['urlParams'];
791
-			} else {
792
-				$urlParams = [];
793
-			}
794
-
795
-			if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
796
-				&& in_array('fakeinput', stream_get_wrappers())
797
-			) {
798
-				$stream = 'fakeinput://data';
799
-			} else {
800
-				$stream = 'php://input';
801
-			}
802
-
803
-			return new Request(
804
-				[
805
-					'get' => $_GET,
806
-					'post' => $_POST,
807
-					'files' => $_FILES,
808
-					'server' => $_SERVER,
809
-					'env' => $_ENV,
810
-					'cookies' => $_COOKIE,
811
-					'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
812
-						? $_SERVER['REQUEST_METHOD']
813
-						: '',
814
-					'urlParams' => $urlParams,
815
-				],
816
-				$this->getSecureRandom(),
817
-				$this->getConfig(),
818
-				$this->getCsrfTokenManager(),
819
-				$stream
820
-			);
821
-		});
822
-		$this->registerAlias('Request', \OCP\IRequest::class);
823
-
824
-		$this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
825
-			return new Mailer(
826
-				$c->getConfig(),
827
-				$c->getLogger(),
828
-				$c->query(Defaults::class),
829
-				$c->getURLGenerator(),
830
-				$c->getL10N('lib')
831
-			);
832
-		});
833
-		$this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
834
-
835
-		$this->registerService('LDAPProvider', function (Server $c) {
836
-			$config = $c->getConfig();
837
-			$factoryClass = $config->getSystemValue('ldapProviderFactory', null);
838
-			if (is_null($factoryClass)) {
839
-				throw new \Exception('ldapProviderFactory not set');
840
-			}
841
-			/** @var \OCP\LDAP\ILDAPProviderFactory $factory */
842
-			$factory = new $factoryClass($this);
843
-			return $factory->getLDAPProvider();
844
-		});
845
-		$this->registerService(ILockingProvider::class, function (Server $c) {
846
-			$ini = $c->getIniWrapper();
847
-			$config = $c->getConfig();
848
-			$ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
849
-			if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
850
-				/** @var \OC\Memcache\Factory $memcacheFactory */
851
-				$memcacheFactory = $c->getMemCacheFactory();
852
-				$memcache = $memcacheFactory->createLocking('lock');
853
-				if (!($memcache instanceof \OC\Memcache\NullCache)) {
854
-					return new MemcacheLockingProvider($memcache, $ttl);
855
-				}
856
-				return new DBLockingProvider(
857
-					$c->getDatabaseConnection(),
858
-					$c->getLogger(),
859
-					new TimeFactory(),
860
-					$ttl,
861
-					!\OC::$CLI
862
-				);
863
-			}
864
-			return new NoopLockingProvider();
865
-		});
866
-		$this->registerAlias('LockingProvider', ILockingProvider::class);
867
-
868
-		$this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
869
-			return new \OC\Files\Mount\Manager();
870
-		});
871
-		$this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
872
-
873
-		$this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
874
-			return new \OC\Files\Type\Detection(
875
-				$c->getURLGenerator(),
876
-				\OC::$configDir,
877
-				\OC::$SERVERROOT . '/resources/config/'
878
-			);
879
-		});
880
-		$this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
881
-
882
-		$this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
883
-			return new \OC\Files\Type\Loader(
884
-				$c->getDatabaseConnection()
885
-			);
886
-		});
887
-		$this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
888
-		$this->registerService(BundleFetcher::class, function () {
889
-			return new BundleFetcher($this->getL10N('lib'));
890
-		});
891
-		$this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
892
-			return new Manager(
893
-				$c->query(IValidator::class)
894
-			);
895
-		});
896
-		$this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
897
-
898
-		$this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
899
-			$manager = new \OC\CapabilitiesManager($c->getLogger());
900
-			$manager->registerCapability(function () use ($c) {
901
-				return new \OC\OCS\CoreCapabilities($c->getConfig());
902
-			});
903
-			$manager->registerCapability(function () use ($c) {
904
-				return $c->query(\OC\Security\Bruteforce\Capabilities::class);
905
-			});
906
-			return $manager;
907
-		});
908
-		$this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
909
-
910
-		$this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
911
-			$config = $c->getConfig();
912
-			$factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
913
-			/** @var \OCP\Comments\ICommentsManagerFactory $factory */
914
-			$factory = new $factoryClass($this);
915
-			$manager = $factory->getManager();
916
-
917
-			$manager->registerDisplayNameResolver('user', function($id) use ($c) {
918
-				$manager = $c->getUserManager();
919
-				$user = $manager->get($id);
920
-				if(is_null($user)) {
921
-					$l = $c->getL10N('core');
922
-					$displayName = $l->t('Unknown user');
923
-				} else {
924
-					$displayName = $user->getDisplayName();
925
-				}
926
-				return $displayName;
927
-			});
928
-
929
-			return $manager;
930
-		});
931
-		$this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
932
-
933
-		$this->registerService('ThemingDefaults', function (Server $c) {
934
-			/*
159
+    /** @var string */
160
+    private $webRoot;
161
+
162
+    /**
163
+     * @param string $webRoot
164
+     * @param \OC\Config $config
165
+     */
166
+    public function __construct($webRoot, \OC\Config $config) {
167
+        parent::__construct();
168
+        $this->webRoot = $webRoot;
169
+
170
+        $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) {
171
+            return $c;
172
+        });
173
+
174
+        $this->registerAlias(\OCP\Calendar\IManager::class, \OC\Calendar\Manager::class);
175
+        $this->registerAlias('CalendarManager', \OC\Calendar\Manager::class);
176
+
177
+        $this->registerAlias(\OCP\Contacts\IManager::class, \OC\ContactsManager::class);
178
+        $this->registerAlias('ContactsManager', \OCP\Contacts\IManager::class);
179
+
180
+        $this->registerAlias(IActionFactory::class, ActionFactory::class);
181
+
182
+
183
+        $this->registerService(\OCP\IPreview::class, function (Server $c) {
184
+            return new PreviewManager(
185
+                $c->getConfig(),
186
+                $c->getRootFolder(),
187
+                $c->getAppDataDir('preview'),
188
+                $c->getEventDispatcher(),
189
+                $c->getSession()->get('user_id')
190
+            );
191
+        });
192
+        $this->registerAlias('PreviewManager', \OCP\IPreview::class);
193
+
194
+        $this->registerService(\OC\Preview\Watcher::class, function (Server $c) {
195
+            return new \OC\Preview\Watcher(
196
+                $c->getAppDataDir('preview')
197
+            );
198
+        });
199
+
200
+        $this->registerService('EncryptionManager', function (Server $c) {
201
+            $view = new View();
202
+            $util = new Encryption\Util(
203
+                $view,
204
+                $c->getUserManager(),
205
+                $c->getGroupManager(),
206
+                $c->getConfig()
207
+            );
208
+            return new Encryption\Manager(
209
+                $c->getConfig(),
210
+                $c->getLogger(),
211
+                $c->getL10N('core'),
212
+                new View(),
213
+                $util,
214
+                new ArrayCache()
215
+            );
216
+        });
217
+
218
+        $this->registerService('EncryptionFileHelper', function (Server $c) {
219
+            $util = new Encryption\Util(
220
+                new View(),
221
+                $c->getUserManager(),
222
+                $c->getGroupManager(),
223
+                $c->getConfig()
224
+            );
225
+            return new Encryption\File(
226
+                $util,
227
+                $c->getRootFolder(),
228
+                $c->getShareManager()
229
+            );
230
+        });
231
+
232
+        $this->registerService('EncryptionKeyStorage', function (Server $c) {
233
+            $view = new View();
234
+            $util = new Encryption\Util(
235
+                $view,
236
+                $c->getUserManager(),
237
+                $c->getGroupManager(),
238
+                $c->getConfig()
239
+            );
240
+
241
+            return new Encryption\Keys\Storage($view, $util);
242
+        });
243
+        $this->registerService('TagMapper', function (Server $c) {
244
+            return new TagMapper($c->getDatabaseConnection());
245
+        });
246
+
247
+        $this->registerService(\OCP\ITagManager::class, function (Server $c) {
248
+            $tagMapper = $c->query('TagMapper');
249
+            return new TagManager($tagMapper, $c->getUserSession());
250
+        });
251
+        $this->registerAlias('TagManager', \OCP\ITagManager::class);
252
+
253
+        $this->registerService('SystemTagManagerFactory', function (Server $c) {
254
+            $config = $c->getConfig();
255
+            $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class);
256
+            return new $factoryClass($this);
257
+        });
258
+        $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) {
259
+            return $c->query('SystemTagManagerFactory')->getManager();
260
+        });
261
+        $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class);
262
+
263
+        $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) {
264
+            return $c->query('SystemTagManagerFactory')->getObjectMapper();
265
+        });
266
+        $this->registerService('RootFolder', function (Server $c) {
267
+            $manager = \OC\Files\Filesystem::getMountManager(null);
268
+            $view = new View();
269
+            $root = new Root(
270
+                $manager,
271
+                $view,
272
+                null,
273
+                $c->getUserMountCache(),
274
+                $this->getLogger(),
275
+                $this->getUserManager()
276
+            );
277
+            $connector = new HookConnector($root, $view);
278
+            $connector->viewToNode();
279
+
280
+            $previewConnector = new \OC\Preview\WatcherConnector($root, $c->getSystemConfig());
281
+            $previewConnector->connectWatcher();
282
+
283
+            return $root;
284
+        });
285
+        $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class);
286
+
287
+        $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) {
288
+            return new LazyRoot(function () use ($c) {
289
+                return $c->query('RootFolder');
290
+            });
291
+        });
292
+        $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class);
293
+
294
+        $this->registerService(\OC\User\Manager::class, function (Server $c) {
295
+            $config = $c->getConfig();
296
+            return new \OC\User\Manager($config);
297
+        });
298
+        $this->registerAlias('UserManager', \OC\User\Manager::class);
299
+        $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class);
300
+
301
+        $this->registerService(\OCP\IGroupManager::class, function (Server $c) {
302
+            $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger());
303
+            $groupManager->listen('\OC\Group', 'preCreate', function ($gid) {
304
+                \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid));
305
+            });
306
+            $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) {
307
+                \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID()));
308
+            });
309
+            $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) {
310
+                \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID()));
311
+            });
312
+            $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) {
313
+                \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID()));
314
+            });
315
+            $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
316
+                \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID()));
317
+            });
318
+            $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) {
319
+                \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
320
+                //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks
321
+                \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID()));
322
+            });
323
+            return $groupManager;
324
+        });
325
+        $this->registerAlias('GroupManager', \OCP\IGroupManager::class);
326
+
327
+        $this->registerService(Store::class, function (Server $c) {
328
+            $session = $c->getSession();
329
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
330
+                $tokenProvider = $c->query(IProvider::class);
331
+            } else {
332
+                $tokenProvider = null;
333
+            }
334
+            $logger = $c->getLogger();
335
+            return new Store($session, $logger, $tokenProvider);
336
+        });
337
+        $this->registerAlias(IStore::class, Store::class);
338
+        $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) {
339
+            $dbConnection = $c->getDatabaseConnection();
340
+            return new Authentication\Token\DefaultTokenMapper($dbConnection);
341
+        });
342
+        $this->registerService(Authentication\Token\DefaultTokenProvider::class, function (Server $c) {
343
+            $mapper = $c->query(Authentication\Token\DefaultTokenMapper::class);
344
+            $crypto = $c->getCrypto();
345
+            $config = $c->getConfig();
346
+            $logger = $c->getLogger();
347
+            $timeFactory = new TimeFactory();
348
+            return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory);
349
+        });
350
+        $this->registerAlias(IProvider::class, Authentication\Token\DefaultTokenProvider::class);
351
+
352
+        $this->registerService(\OCP\IUserSession::class, function (Server $c) {
353
+            $manager = $c->getUserManager();
354
+            $session = new \OC\Session\Memory('');
355
+            $timeFactory = new TimeFactory();
356
+            // Token providers might require a working database. This code
357
+            // might however be called when ownCloud is not yet setup.
358
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
359
+                $defaultTokenProvider = $c->query(IProvider::class);
360
+            } else {
361
+                $defaultTokenProvider = null;
362
+            }
363
+
364
+            $dispatcher = $c->getEventDispatcher();
365
+
366
+            $userSession = new \OC\User\Session(
367
+                $manager,
368
+                $session,
369
+                $timeFactory,
370
+                $defaultTokenProvider,
371
+                $c->getConfig(),
372
+                $c->getSecureRandom(),
373
+                $c->getLockdownManager(),
374
+                $c->getLogger()
375
+            );
376
+            $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) {
377
+                \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password));
378
+            });
379
+            $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) {
380
+                /** @var $user \OC\User\User */
381
+                \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password));
382
+            });
383
+            $userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) {
384
+                /** @var $user \OC\User\User */
385
+                \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID()));
386
+                $dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user));
387
+            });
388
+            $userSession->listen('\OC\User', 'postDelete', function ($user) {
389
+                /** @var $user \OC\User\User */
390
+                \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID()));
391
+            });
392
+            $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) {
393
+                /** @var $user \OC\User\User */
394
+                \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
395
+            });
396
+            $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) {
397
+                /** @var $user \OC\User\User */
398
+                \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword));
399
+            });
400
+            $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) {
401
+                \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password));
402
+            });
403
+            $userSession->listen('\OC\User', 'postLogin', function ($user, $password) {
404
+                /** @var $user \OC\User\User */
405
+                \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
406
+            });
407
+            $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) {
408
+                /** @var $user \OC\User\User */
409
+                \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password));
410
+            });
411
+            $userSession->listen('\OC\User', 'logout', function () {
412
+                \OC_Hook::emit('OC_User', 'logout', array());
413
+            });
414
+            $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) {
415
+                /** @var $user \OC\User\User */
416
+                \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue));
417
+                $dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value]));
418
+            });
419
+            return $userSession;
420
+        });
421
+        $this->registerAlias('UserSession', \OCP\IUserSession::class);
422
+
423
+        $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) {
424
+            return new \OC\Authentication\TwoFactorAuth\Manager(
425
+                $c->getAppManager(),
426
+                $c->getSession(),
427
+                $c->getConfig(),
428
+                $c->getActivityManager(),
429
+                $c->getLogger(),
430
+                $c->query(IProvider::class),
431
+                $c->query(ITimeFactory::class),
432
+                $c->query(EventDispatcherInterface::class)
433
+            );
434
+        });
435
+
436
+        $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class);
437
+        $this->registerAlias('NavigationManager', \OCP\INavigationManager::class);
438
+
439
+        $this->registerService(\OC\AllConfig::class, function (Server $c) {
440
+            return new \OC\AllConfig(
441
+                $c->getSystemConfig()
442
+            );
443
+        });
444
+        $this->registerAlias('AllConfig', \OC\AllConfig::class);
445
+        $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class);
446
+
447
+        $this->registerService('SystemConfig', function ($c) use ($config) {
448
+            return new \OC\SystemConfig($config);
449
+        });
450
+
451
+        $this->registerService(\OC\AppConfig::class, function (Server $c) {
452
+            return new \OC\AppConfig($c->getDatabaseConnection());
453
+        });
454
+        $this->registerAlias('AppConfig', \OC\AppConfig::class);
455
+        $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class);
456
+
457
+        $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) {
458
+            return new \OC\L10N\Factory(
459
+                $c->getConfig(),
460
+                $c->getRequest(),
461
+                $c->getUserSession(),
462
+                \OC::$SERVERROOT
463
+            );
464
+        });
465
+        $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class);
466
+
467
+        $this->registerService(\OCP\IURLGenerator::class, function (Server $c) {
468
+            $config = $c->getConfig();
469
+            $cacheFactory = $c->getMemCacheFactory();
470
+            $request = $c->getRequest();
471
+            return new \OC\URLGenerator(
472
+                $config,
473
+                $cacheFactory,
474
+                $request
475
+            );
476
+        });
477
+        $this->registerAlias('URLGenerator', \OCP\IURLGenerator::class);
478
+
479
+        $this->registerAlias('AppFetcher', AppFetcher::class);
480
+        $this->registerAlias('CategoryFetcher', CategoryFetcher::class);
481
+
482
+        $this->registerService(\OCP\ICache::class, function ($c) {
483
+            return new Cache\File();
484
+        });
485
+        $this->registerAlias('UserCache', \OCP\ICache::class);
486
+
487
+        $this->registerService(Factory::class, function (Server $c) {
488
+
489
+            $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(),
490
+                ArrayCache::class,
491
+                ArrayCache::class,
492
+                ArrayCache::class
493
+            );
494
+            $config = $c->getConfig();
495
+            $request = $c->getRequest();
496
+            $urlGenerator = new URLGenerator($config, $arrayCacheFactory, $request);
497
+
498
+            if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
499
+                $v = \OC_App::getAppVersions();
500
+                $v['core'] = implode(',', \OC_Util::getVersion());
501
+                $version = implode(',', $v);
502
+                $instanceId = \OC_Util::getInstanceId();
503
+                $path = \OC::$SERVERROOT;
504
+                $prefix = md5($instanceId . '-' . $version . '-' . $path);
505
+                return new \OC\Memcache\Factory($prefix, $c->getLogger(),
506
+                    $config->getSystemValue('memcache.local', null),
507
+                    $config->getSystemValue('memcache.distributed', null),
508
+                    $config->getSystemValue('memcache.locking', null)
509
+                );
510
+            }
511
+            return $arrayCacheFactory;
512
+
513
+        });
514
+        $this->registerAlias('MemCacheFactory', Factory::class);
515
+        $this->registerAlias(ICacheFactory::class, Factory::class);
516
+
517
+        $this->registerService('RedisFactory', function (Server $c) {
518
+            $systemConfig = $c->getSystemConfig();
519
+            return new RedisFactory($systemConfig);
520
+        });
521
+
522
+        $this->registerService(\OCP\Activity\IManager::class, function (Server $c) {
523
+            return new \OC\Activity\Manager(
524
+                $c->getRequest(),
525
+                $c->getUserSession(),
526
+                $c->getConfig(),
527
+                $c->query(IValidator::class)
528
+            );
529
+        });
530
+        $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class);
531
+
532
+        $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) {
533
+            return new \OC\Activity\EventMerger(
534
+                $c->getL10N('lib')
535
+            );
536
+        });
537
+        $this->registerAlias(IValidator::class, Validator::class);
538
+
539
+        $this->registerService(\OCP\IAvatarManager::class, function (Server $c) {
540
+            return new AvatarManager(
541
+                $c->query(\OC\User\Manager::class),
542
+                $c->getAppDataDir('avatar'),
543
+                $c->getL10N('lib'),
544
+                $c->getLogger(),
545
+                $c->getConfig()
546
+            );
547
+        });
548
+        $this->registerAlias('AvatarManager', \OCP\IAvatarManager::class);
549
+
550
+        $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class);
551
+
552
+        $this->registerService(\OCP\ILogger::class, function (Server $c) {
553
+            $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file');
554
+            $logger = Log::getLogClass($logType);
555
+            call_user_func(array($logger, 'init'));
556
+            $config = $this->getSystemConfig();
557
+            $registry = $c->query(\OCP\Support\CrashReport\IRegistry::class);
558
+
559
+            return new Log($logger, $config, null, $registry);
560
+        });
561
+        $this->registerAlias('Logger', \OCP\ILogger::class);
562
+
563
+        $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) {
564
+            $config = $c->getConfig();
565
+            return new \OC\BackgroundJob\JobList(
566
+                $c->getDatabaseConnection(),
567
+                $config,
568
+                new TimeFactory()
569
+            );
570
+        });
571
+        $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class);
572
+
573
+        $this->registerService(\OCP\Route\IRouter::class, function (Server $c) {
574
+            $cacheFactory = $c->getMemCacheFactory();
575
+            $logger = $c->getLogger();
576
+            if ($cacheFactory->isLocalCacheAvailable()) {
577
+                $router = new \OC\Route\CachingRouter($cacheFactory->createLocal('route'), $logger);
578
+            } else {
579
+                $router = new \OC\Route\Router($logger);
580
+            }
581
+            return $router;
582
+        });
583
+        $this->registerAlias('Router', \OCP\Route\IRouter::class);
584
+
585
+        $this->registerService(\OCP\ISearch::class, function ($c) {
586
+            return new Search();
587
+        });
588
+        $this->registerAlias('Search', \OCP\ISearch::class);
589
+
590
+        $this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) {
591
+            return new \OC\Security\RateLimiting\Limiter(
592
+                $this->getUserSession(),
593
+                $this->getRequest(),
594
+                new \OC\AppFramework\Utility\TimeFactory(),
595
+                $c->query(\OC\Security\RateLimiting\Backend\IBackend::class)
596
+            );
597
+        });
598
+        $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) {
599
+            return new \OC\Security\RateLimiting\Backend\MemoryCache(
600
+                $this->getMemCacheFactory(),
601
+                new \OC\AppFramework\Utility\TimeFactory()
602
+            );
603
+        });
604
+
605
+        $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) {
606
+            return new SecureRandom();
607
+        });
608
+        $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class);
609
+
610
+        $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) {
611
+            return new Crypto($c->getConfig(), $c->getSecureRandom());
612
+        });
613
+        $this->registerAlias('Crypto', \OCP\Security\ICrypto::class);
614
+
615
+        $this->registerService(\OCP\Security\IHasher::class, function (Server $c) {
616
+            return new Hasher($c->getConfig());
617
+        });
618
+        $this->registerAlias('Hasher', \OCP\Security\IHasher::class);
619
+
620
+        $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) {
621
+            return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection());
622
+        });
623
+        $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class);
624
+
625
+        $this->registerService(IDBConnection::class, function (Server $c) {
626
+            $systemConfig = $c->getSystemConfig();
627
+            $factory = new \OC\DB\ConnectionFactory($systemConfig);
628
+            $type = $systemConfig->getValue('dbtype', 'sqlite');
629
+            if (!$factory->isValidType($type)) {
630
+                throw new \OC\DatabaseException('Invalid database type');
631
+            }
632
+            $connectionParams = $factory->createConnectionParams();
633
+            $connection = $factory->getConnection($type, $connectionParams);
634
+            $connection->getConfiguration()->setSQLLogger($c->getQueryLogger());
635
+            return $connection;
636
+        });
637
+        $this->registerAlias('DatabaseConnection', IDBConnection::class);
638
+
639
+
640
+        $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) {
641
+            $user = \OC_User::getUser();
642
+            $uid = $user ? $user : null;
643
+            return new ClientService(
644
+                $c->getConfig(),
645
+                new \OC\Security\CertificateManager(
646
+                    $uid,
647
+                    new View(),
648
+                    $c->getConfig(),
649
+                    $c->getLogger(),
650
+                    $c->getSecureRandom()
651
+                )
652
+            );
653
+        });
654
+        $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class);
655
+        $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) {
656
+            $eventLogger = new EventLogger();
657
+            if ($c->getSystemConfig()->getValue('debug', false)) {
658
+                // In debug mode, module is being activated by default
659
+                $eventLogger->activate();
660
+            }
661
+            return $eventLogger;
662
+        });
663
+        $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class);
664
+
665
+        $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) {
666
+            $queryLogger = new QueryLogger();
667
+            if ($c->getSystemConfig()->getValue('debug', false)) {
668
+                // In debug mode, module is being activated by default
669
+                $queryLogger->activate();
670
+            }
671
+            return $queryLogger;
672
+        });
673
+        $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class);
674
+
675
+        $this->registerService(TempManager::class, function (Server $c) {
676
+            return new TempManager(
677
+                $c->getLogger(),
678
+                $c->getConfig()
679
+            );
680
+        });
681
+        $this->registerAlias('TempManager', TempManager::class);
682
+        $this->registerAlias(ITempManager::class, TempManager::class);
683
+
684
+        $this->registerService(AppManager::class, function (Server $c) {
685
+            return new \OC\App\AppManager(
686
+                $c->getUserSession(),
687
+                $c->query(\OC\AppConfig::class),
688
+                $c->getGroupManager(),
689
+                $c->getMemCacheFactory(),
690
+                $c->getEventDispatcher()
691
+            );
692
+        });
693
+        $this->registerAlias('AppManager', AppManager::class);
694
+        $this->registerAlias(IAppManager::class, AppManager::class);
695
+
696
+        $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) {
697
+            return new DateTimeZone(
698
+                $c->getConfig(),
699
+                $c->getSession()
700
+            );
701
+        });
702
+        $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class);
703
+
704
+        $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) {
705
+            $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null);
706
+
707
+            return new DateTimeFormatter(
708
+                $c->getDateTimeZone()->getTimeZone(),
709
+                $c->getL10N('lib', $language)
710
+            );
711
+        });
712
+        $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class);
713
+
714
+        $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) {
715
+            $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger());
716
+            $listener = new UserMountCacheListener($mountCache);
717
+            $listener->listen($c->getUserManager());
718
+            return $mountCache;
719
+        });
720
+        $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class);
721
+
722
+        $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) {
723
+            $loader = \OC\Files\Filesystem::getLoader();
724
+            $mountCache = $c->query('UserMountCache');
725
+            $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache);
726
+
727
+            // builtin providers
728
+
729
+            $config = $c->getConfig();
730
+            $manager->registerProvider(new CacheMountProvider($config));
731
+            $manager->registerHomeProvider(new LocalHomeMountProvider());
732
+            $manager->registerHomeProvider(new ObjectHomeMountProvider($config));
733
+
734
+            return $manager;
735
+        });
736
+        $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class);
737
+
738
+        $this->registerService('IniWrapper', function ($c) {
739
+            return new IniGetWrapper();
740
+        });
741
+        $this->registerService('AsyncCommandBus', function (Server $c) {
742
+            $busClass = $c->getConfig()->getSystemValue('commandbus');
743
+            if ($busClass) {
744
+                list($app, $class) = explode('::', $busClass, 2);
745
+                if ($c->getAppManager()->isInstalled($app)) {
746
+                    \OC_App::loadApp($app);
747
+                    return $c->query($class);
748
+                } else {
749
+                    throw new ServiceUnavailableException("The app providing the command bus ($app) is not enabled");
750
+                }
751
+            } else {
752
+                $jobList = $c->getJobList();
753
+                return new CronBus($jobList);
754
+            }
755
+        });
756
+        $this->registerService('TrustedDomainHelper', function ($c) {
757
+            return new TrustedDomainHelper($this->getConfig());
758
+        });
759
+        $this->registerService('Throttler', function (Server $c) {
760
+            return new Throttler(
761
+                $c->getDatabaseConnection(),
762
+                new TimeFactory(),
763
+                $c->getLogger(),
764
+                $c->getConfig()
765
+            );
766
+        });
767
+        $this->registerService('IntegrityCodeChecker', function (Server $c) {
768
+            // IConfig and IAppManager requires a working database. This code
769
+            // might however be called when ownCloud is not yet setup.
770
+            if (\OC::$server->getSystemConfig()->getValue('installed', false)) {
771
+                $config = $c->getConfig();
772
+                $appManager = $c->getAppManager();
773
+            } else {
774
+                $config = null;
775
+                $appManager = null;
776
+            }
777
+
778
+            return new Checker(
779
+                new EnvironmentHelper(),
780
+                new FileAccessHelper(),
781
+                new AppLocator(),
782
+                $config,
783
+                $c->getMemCacheFactory(),
784
+                $appManager,
785
+                $c->getTempManager()
786
+            );
787
+        });
788
+        $this->registerService(\OCP\IRequest::class, function ($c) {
789
+            if (isset($this['urlParams'])) {
790
+                $urlParams = $this['urlParams'];
791
+            } else {
792
+                $urlParams = [];
793
+            }
794
+
795
+            if (defined('PHPUNIT_RUN') && PHPUNIT_RUN
796
+                && in_array('fakeinput', stream_get_wrappers())
797
+            ) {
798
+                $stream = 'fakeinput://data';
799
+            } else {
800
+                $stream = 'php://input';
801
+            }
802
+
803
+            return new Request(
804
+                [
805
+                    'get' => $_GET,
806
+                    'post' => $_POST,
807
+                    'files' => $_FILES,
808
+                    'server' => $_SERVER,
809
+                    'env' => $_ENV,
810
+                    'cookies' => $_COOKIE,
811
+                    'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
812
+                        ? $_SERVER['REQUEST_METHOD']
813
+                        : '',
814
+                    'urlParams' => $urlParams,
815
+                ],
816
+                $this->getSecureRandom(),
817
+                $this->getConfig(),
818
+                $this->getCsrfTokenManager(),
819
+                $stream
820
+            );
821
+        });
822
+        $this->registerAlias('Request', \OCP\IRequest::class);
823
+
824
+        $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) {
825
+            return new Mailer(
826
+                $c->getConfig(),
827
+                $c->getLogger(),
828
+                $c->query(Defaults::class),
829
+                $c->getURLGenerator(),
830
+                $c->getL10N('lib')
831
+            );
832
+        });
833
+        $this->registerAlias('Mailer', \OCP\Mail\IMailer::class);
834
+
835
+        $this->registerService('LDAPProvider', function (Server $c) {
836
+            $config = $c->getConfig();
837
+            $factoryClass = $config->getSystemValue('ldapProviderFactory', null);
838
+            if (is_null($factoryClass)) {
839
+                throw new \Exception('ldapProviderFactory not set');
840
+            }
841
+            /** @var \OCP\LDAP\ILDAPProviderFactory $factory */
842
+            $factory = new $factoryClass($this);
843
+            return $factory->getLDAPProvider();
844
+        });
845
+        $this->registerService(ILockingProvider::class, function (Server $c) {
846
+            $ini = $c->getIniWrapper();
847
+            $config = $c->getConfig();
848
+            $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time')));
849
+            if ($config->getSystemValue('filelocking.enabled', true) or (defined('PHPUNIT_RUN') && PHPUNIT_RUN)) {
850
+                /** @var \OC\Memcache\Factory $memcacheFactory */
851
+                $memcacheFactory = $c->getMemCacheFactory();
852
+                $memcache = $memcacheFactory->createLocking('lock');
853
+                if (!($memcache instanceof \OC\Memcache\NullCache)) {
854
+                    return new MemcacheLockingProvider($memcache, $ttl);
855
+                }
856
+                return new DBLockingProvider(
857
+                    $c->getDatabaseConnection(),
858
+                    $c->getLogger(),
859
+                    new TimeFactory(),
860
+                    $ttl,
861
+                    !\OC::$CLI
862
+                );
863
+            }
864
+            return new NoopLockingProvider();
865
+        });
866
+        $this->registerAlias('LockingProvider', ILockingProvider::class);
867
+
868
+        $this->registerService(\OCP\Files\Mount\IMountManager::class, function () {
869
+            return new \OC\Files\Mount\Manager();
870
+        });
871
+        $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class);
872
+
873
+        $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) {
874
+            return new \OC\Files\Type\Detection(
875
+                $c->getURLGenerator(),
876
+                \OC::$configDir,
877
+                \OC::$SERVERROOT . '/resources/config/'
878
+            );
879
+        });
880
+        $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class);
881
+
882
+        $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) {
883
+            return new \OC\Files\Type\Loader(
884
+                $c->getDatabaseConnection()
885
+            );
886
+        });
887
+        $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class);
888
+        $this->registerService(BundleFetcher::class, function () {
889
+            return new BundleFetcher($this->getL10N('lib'));
890
+        });
891
+        $this->registerService(\OCP\Notification\IManager::class, function (Server $c) {
892
+            return new Manager(
893
+                $c->query(IValidator::class)
894
+            );
895
+        });
896
+        $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class);
897
+
898
+        $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) {
899
+            $manager = new \OC\CapabilitiesManager($c->getLogger());
900
+            $manager->registerCapability(function () use ($c) {
901
+                return new \OC\OCS\CoreCapabilities($c->getConfig());
902
+            });
903
+            $manager->registerCapability(function () use ($c) {
904
+                return $c->query(\OC\Security\Bruteforce\Capabilities::class);
905
+            });
906
+            return $manager;
907
+        });
908
+        $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class);
909
+
910
+        $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) {
911
+            $config = $c->getConfig();
912
+            $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class);
913
+            /** @var \OCP\Comments\ICommentsManagerFactory $factory */
914
+            $factory = new $factoryClass($this);
915
+            $manager = $factory->getManager();
916
+
917
+            $manager->registerDisplayNameResolver('user', function($id) use ($c) {
918
+                $manager = $c->getUserManager();
919
+                $user = $manager->get($id);
920
+                if(is_null($user)) {
921
+                    $l = $c->getL10N('core');
922
+                    $displayName = $l->t('Unknown user');
923
+                } else {
924
+                    $displayName = $user->getDisplayName();
925
+                }
926
+                return $displayName;
927
+            });
928
+
929
+            return $manager;
930
+        });
931
+        $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class);
932
+
933
+        $this->registerService('ThemingDefaults', function (Server $c) {
934
+            /*
935 935
 			 * Dark magic for autoloader.
936 936
 			 * If we do a class_exists it will try to load the class which will
937 937
 			 * make composer cache the result. Resulting in errors when enabling
938 938
 			 * the theming app.
939 939
 			 */
940
-			$prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
941
-			if (isset($prefixes['OCA\\Theming\\'])) {
942
-				$classExists = true;
943
-			} else {
944
-				$classExists = false;
945
-			}
946
-
947
-			if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
948
-				return new ThemingDefaults(
949
-					$c->getConfig(),
950
-					$c->getL10N('theming'),
951
-					$c->getURLGenerator(),
952
-					$c->getMemCacheFactory(),
953
-					new Util($c->getConfig(), $this->getAppManager(), $c->getAppDataDir('theming')),
954
-					new ImageManager($c->getConfig(), $c->getAppDataDir('theming'), $c->getURLGenerator()),
955
-					$c->getAppManager()
956
-				);
957
-			}
958
-			return new \OC_Defaults();
959
-		});
960
-		$this->registerService(SCSSCacher::class, function (Server $c) {
961
-			/** @var Factory $cacheFactory */
962
-			$cacheFactory = $c->query(Factory::class);
963
-			return new SCSSCacher(
964
-				$c->getLogger(),
965
-				$c->query(\OC\Files\AppData\Factory::class),
966
-				$c->getURLGenerator(),
967
-				$c->getConfig(),
968
-				$c->getThemingDefaults(),
969
-				\OC::$SERVERROOT,
970
-				$this->getMemCacheFactory()
971
-			);
972
-		});
973
-		$this->registerService(JSCombiner::class, function (Server $c) {
974
-			/** @var Factory $cacheFactory */
975
-			$cacheFactory = $c->query(Factory::class);
976
-			return new JSCombiner(
977
-				$c->getAppDataDir('js'),
978
-				$c->getURLGenerator(),
979
-				$this->getMemCacheFactory(),
980
-				$c->getSystemConfig(),
981
-				$c->getLogger()
982
-			);
983
-		});
984
-		$this->registerService(EventDispatcher::class, function () {
985
-			return new EventDispatcher();
986
-		});
987
-		$this->registerAlias('EventDispatcher', EventDispatcher::class);
988
-		$this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
989
-
990
-		$this->registerService('CryptoWrapper', function (Server $c) {
991
-			// FIXME: Instantiiated here due to cyclic dependency
992
-			$request = new Request(
993
-				[
994
-					'get' => $_GET,
995
-					'post' => $_POST,
996
-					'files' => $_FILES,
997
-					'server' => $_SERVER,
998
-					'env' => $_ENV,
999
-					'cookies' => $_COOKIE,
1000
-					'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
1001
-						? $_SERVER['REQUEST_METHOD']
1002
-						: null,
1003
-				],
1004
-				$c->getSecureRandom(),
1005
-				$c->getConfig()
1006
-			);
1007
-
1008
-			return new CryptoWrapper(
1009
-				$c->getConfig(),
1010
-				$c->getCrypto(),
1011
-				$c->getSecureRandom(),
1012
-				$request
1013
-			);
1014
-		});
1015
-		$this->registerService('CsrfTokenManager', function (Server $c) {
1016
-			$tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
1017
-
1018
-			return new CsrfTokenManager(
1019
-				$tokenGenerator,
1020
-				$c->query(SessionStorage::class)
1021
-			);
1022
-		});
1023
-		$this->registerService(SessionStorage::class, function (Server $c) {
1024
-			return new SessionStorage($c->getSession());
1025
-		});
1026
-		$this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) {
1027
-			return new ContentSecurityPolicyManager();
1028
-		});
1029
-		$this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class);
1030
-
1031
-		$this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) {
1032
-			return new ContentSecurityPolicyNonceManager(
1033
-				$c->getCsrfTokenManager(),
1034
-				$c->getRequest()
1035
-			);
1036
-		});
1037
-
1038
-		$this->registerService(\OCP\Share\IManager::class, function (Server $c) {
1039
-			$config = $c->getConfig();
1040
-			$factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
1041
-			/** @var \OCP\Share\IProviderFactory $factory */
1042
-			$factory = new $factoryClass($this);
1043
-
1044
-			$manager = new \OC\Share20\Manager(
1045
-				$c->getLogger(),
1046
-				$c->getConfig(),
1047
-				$c->getSecureRandom(),
1048
-				$c->getHasher(),
1049
-				$c->getMountManager(),
1050
-				$c->getGroupManager(),
1051
-				$c->getL10N('lib'),
1052
-				$c->getL10NFactory(),
1053
-				$factory,
1054
-				$c->getUserManager(),
1055
-				$c->getLazyRootFolder(),
1056
-				$c->getEventDispatcher(),
1057
-				$c->getMailer(),
1058
-				$c->getURLGenerator(),
1059
-				$c->getThemingDefaults()
1060
-			);
1061
-
1062
-			return $manager;
1063
-		});
1064
-		$this->registerAlias('ShareManager', \OCP\Share\IManager::class);
1065
-
1066
-		$this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) {
1067
-			$instance = new Collaboration\Collaborators\Search($c);
1068
-
1069
-			// register default plugins
1070
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
1071
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]);
1072
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]);
1073
-			$instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]);
1074
-
1075
-			return $instance;
1076
-		});
1077
-		$this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class);
1078
-
1079
-		$this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class);
1080
-
1081
-		$this->registerService('SettingsManager', function (Server $c) {
1082
-			$manager = new \OC\Settings\Manager(
1083
-				$c->getLogger(),
1084
-				$c->getDatabaseConnection(),
1085
-				$c->getL10N('lib'),
1086
-				$c->getConfig(),
1087
-				$c->getEncryptionManager(),
1088
-				$c->getUserManager(),
1089
-				$c->getLockingProvider(),
1090
-				$c->getRequest(),
1091
-				$c->getURLGenerator(),
1092
-				$c->query(AccountManager::class),
1093
-				$c->getGroupManager(),
1094
-				$c->getL10NFactory(),
1095
-				$c->getAppManager()
1096
-			);
1097
-			return $manager;
1098
-		});
1099
-		$this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
1100
-			return new \OC\Files\AppData\Factory(
1101
-				$c->getRootFolder(),
1102
-				$c->getSystemConfig()
1103
-			);
1104
-		});
1105
-
1106
-		$this->registerService('LockdownManager', function (Server $c) {
1107
-			return new LockdownManager(function () use ($c) {
1108
-				return $c->getSession();
1109
-			});
1110
-		});
1111
-
1112
-		$this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
1113
-			return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
1114
-		});
1115
-
1116
-		$this->registerService(ICloudIdManager::class, function (Server $c) {
1117
-			return new CloudIdManager();
1118
-		});
1119
-
1120
-		$this->registerService(IConfig::class, function (Server $c) {
1121
-			return new GlobalScale\Config($c->getConfig());
1122
-		});
1123
-
1124
-		$this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
1125
-			return new CloudFederationProviderManager();
1126
-		});
1127
-
1128
-		$this->registerService(ICloudFederationFactory::class, function (Server $c) {
1129
-			return new CloudFederationFactory();
1130
-		});
1131
-
1132
-		$this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
1133
-		$this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
1134
-
1135
-		$this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
1136
-		$this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
1137
-
1138
-		$this->registerService(Defaults::class, function (Server $c) {
1139
-			return new Defaults(
1140
-				$c->getThemingDefaults()
1141
-			);
1142
-		});
1143
-		$this->registerAlias('Defaults', \OCP\Defaults::class);
1144
-
1145
-		$this->registerService(\OCP\ISession::class, function (SimpleContainer $c) {
1146
-			return $c->query(\OCP\IUserSession::class)->getSession();
1147
-		});
1148
-
1149
-		$this->registerService(IShareHelper::class, function (Server $c) {
1150
-			return new ShareHelper(
1151
-				$c->query(\OCP\Share\IManager::class)
1152
-			);
1153
-		});
1154
-
1155
-		$this->registerService(Installer::class, function(Server $c) {
1156
-			return new Installer(
1157
-				$c->getAppFetcher(),
1158
-				$c->getHTTPClientService(),
1159
-				$c->getTempManager(),
1160
-				$c->getLogger(),
1161
-				$c->getConfig()
1162
-			);
1163
-		});
1164
-
1165
-		$this->registerService(IApiFactory::class, function(Server $c) {
1166
-			return new ApiFactory($c->getHTTPClientService());
1167
-		});
1168
-
1169
-		$this->registerService(IInstanceFactory::class, function(Server $c) {
1170
-			$memcacheFactory = $c->getMemCacheFactory();
1171
-			return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
1172
-		});
1173
-
1174
-		$this->registerService(IContactsStore::class, function(Server $c) {
1175
-			return new ContactsStore(
1176
-				$c->getContactsManager(),
1177
-				$c->getConfig(),
1178
-				$c->getUserManager(),
1179
-				$c->getGroupManager()
1180
-			);
1181
-		});
1182
-		$this->registerAlias(IContactsStore::class, ContactsStore::class);
1183
-
1184
-		$this->connectDispatcher();
1185
-	}
1186
-
1187
-	/**
1188
-	 * @return \OCP\Calendar\IManager
1189
-	 */
1190
-	public function getCalendarManager() {
1191
-		return $this->query('CalendarManager');
1192
-	}
1193
-
1194
-	private function connectDispatcher() {
1195
-		$dispatcher = $this->getEventDispatcher();
1196
-
1197
-		// Delete avatar on user deletion
1198
-		$dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) {
1199
-			$logger = $this->getLogger();
1200
-			$manager = $this->getAvatarManager();
1201
-			/** @var IUser $user */
1202
-			$user = $e->getSubject();
1203
-
1204
-			try {
1205
-				$avatar = $manager->getAvatar($user->getUID());
1206
-				$avatar->remove();
1207
-			} catch (NotFoundException $e) {
1208
-				// no avatar to remove
1209
-			} catch (\Exception $e) {
1210
-				// Ignore exceptions
1211
-				$logger->info('Could not cleanup avatar of ' . $user->getUID());
1212
-			}
1213
-		});
1214
-
1215
-		$dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) {
1216
-			$manager = $this->getAvatarManager();
1217
-			/** @var IUser $user */
1218
-			$user = $e->getSubject();
1219
-			$feature = $e->getArgument('feature');
1220
-			$oldValue = $e->getArgument('oldValue');
1221
-			$value = $e->getArgument('value');
1222
-
1223
-			try {
1224
-				$avatar = $manager->getAvatar($user->getUID());
1225
-				$avatar->userChanged($feature, $oldValue, $value);
1226
-			} catch (NotFoundException $e) {
1227
-				// no avatar to remove
1228
-			}
1229
-		});
1230
-	}
1231
-
1232
-	/**
1233
-	 * @return \OCP\Contacts\IManager
1234
-	 */
1235
-	public function getContactsManager() {
1236
-		return $this->query('ContactsManager');
1237
-	}
1238
-
1239
-	/**
1240
-	 * @return \OC\Encryption\Manager
1241
-	 */
1242
-	public function getEncryptionManager() {
1243
-		return $this->query('EncryptionManager');
1244
-	}
1245
-
1246
-	/**
1247
-	 * @return \OC\Encryption\File
1248
-	 */
1249
-	public function getEncryptionFilesHelper() {
1250
-		return $this->query('EncryptionFileHelper');
1251
-	}
1252
-
1253
-	/**
1254
-	 * @return \OCP\Encryption\Keys\IStorage
1255
-	 */
1256
-	public function getEncryptionKeyStorage() {
1257
-		return $this->query('EncryptionKeyStorage');
1258
-	}
1259
-
1260
-	/**
1261
-	 * The current request object holding all information about the request
1262
-	 * currently being processed is returned from this method.
1263
-	 * In case the current execution was not initiated by a web request null is returned
1264
-	 *
1265
-	 * @return \OCP\IRequest
1266
-	 */
1267
-	public function getRequest() {
1268
-		return $this->query('Request');
1269
-	}
1270
-
1271
-	/**
1272
-	 * Returns the preview manager which can create preview images for a given file
1273
-	 *
1274
-	 * @return \OCP\IPreview
1275
-	 */
1276
-	public function getPreviewManager() {
1277
-		return $this->query('PreviewManager');
1278
-	}
1279
-
1280
-	/**
1281
-	 * Returns the tag manager which can get and set tags for different object types
1282
-	 *
1283
-	 * @see \OCP\ITagManager::load()
1284
-	 * @return \OCP\ITagManager
1285
-	 */
1286
-	public function getTagManager() {
1287
-		return $this->query('TagManager');
1288
-	}
1289
-
1290
-	/**
1291
-	 * Returns the system-tag manager
1292
-	 *
1293
-	 * @return \OCP\SystemTag\ISystemTagManager
1294
-	 *
1295
-	 * @since 9.0.0
1296
-	 */
1297
-	public function getSystemTagManager() {
1298
-		return $this->query('SystemTagManager');
1299
-	}
1300
-
1301
-	/**
1302
-	 * Returns the system-tag object mapper
1303
-	 *
1304
-	 * @return \OCP\SystemTag\ISystemTagObjectMapper
1305
-	 *
1306
-	 * @since 9.0.0
1307
-	 */
1308
-	public function getSystemTagObjectMapper() {
1309
-		return $this->query('SystemTagObjectMapper');
1310
-	}
1311
-
1312
-	/**
1313
-	 * Returns the avatar manager, used for avatar functionality
1314
-	 *
1315
-	 * @return \OCP\IAvatarManager
1316
-	 */
1317
-	public function getAvatarManager() {
1318
-		return $this->query('AvatarManager');
1319
-	}
1320
-
1321
-	/**
1322
-	 * Returns the root folder of ownCloud's data directory
1323
-	 *
1324
-	 * @return \OCP\Files\IRootFolder
1325
-	 */
1326
-	public function getRootFolder() {
1327
-		return $this->query('LazyRootFolder');
1328
-	}
1329
-
1330
-	/**
1331
-	 * Returns the root folder of ownCloud's data directory
1332
-	 * This is the lazy variant so this gets only initialized once it
1333
-	 * is actually used.
1334
-	 *
1335
-	 * @return \OCP\Files\IRootFolder
1336
-	 */
1337
-	public function getLazyRootFolder() {
1338
-		return $this->query('LazyRootFolder');
1339
-	}
1340
-
1341
-	/**
1342
-	 * Returns a view to ownCloud's files folder
1343
-	 *
1344
-	 * @param string $userId user ID
1345
-	 * @return \OCP\Files\Folder|null
1346
-	 */
1347
-	public function getUserFolder($userId = null) {
1348
-		if ($userId === null) {
1349
-			$user = $this->getUserSession()->getUser();
1350
-			if (!$user) {
1351
-				return null;
1352
-			}
1353
-			$userId = $user->getUID();
1354
-		}
1355
-		$root = $this->getRootFolder();
1356
-		return $root->getUserFolder($userId);
1357
-	}
1358
-
1359
-	/**
1360
-	 * Returns an app-specific view in ownClouds data directory
1361
-	 *
1362
-	 * @return \OCP\Files\Folder
1363
-	 * @deprecated since 9.2.0 use IAppData
1364
-	 */
1365
-	public function getAppFolder() {
1366
-		$dir = '/' . \OC_App::getCurrentApp();
1367
-		$root = $this->getRootFolder();
1368
-		if (!$root->nodeExists($dir)) {
1369
-			$folder = $root->newFolder($dir);
1370
-		} else {
1371
-			$folder = $root->get($dir);
1372
-		}
1373
-		return $folder;
1374
-	}
1375
-
1376
-	/**
1377
-	 * @return \OC\User\Manager
1378
-	 */
1379
-	public function getUserManager() {
1380
-		return $this->query('UserManager');
1381
-	}
1382
-
1383
-	/**
1384
-	 * @return \OC\Group\Manager
1385
-	 */
1386
-	public function getGroupManager() {
1387
-		return $this->query('GroupManager');
1388
-	}
1389
-
1390
-	/**
1391
-	 * @return \OC\User\Session
1392
-	 */
1393
-	public function getUserSession() {
1394
-		return $this->query('UserSession');
1395
-	}
1396
-
1397
-	/**
1398
-	 * @return \OCP\ISession
1399
-	 */
1400
-	public function getSession() {
1401
-		return $this->query('UserSession')->getSession();
1402
-	}
1403
-
1404
-	/**
1405
-	 * @param \OCP\ISession $session
1406
-	 */
1407
-	public function setSession(\OCP\ISession $session) {
1408
-		$this->query(SessionStorage::class)->setSession($session);
1409
-		$this->query('UserSession')->setSession($session);
1410
-		$this->query(Store::class)->setSession($session);
1411
-	}
1412
-
1413
-	/**
1414
-	 * @return \OC\Authentication\TwoFactorAuth\Manager
1415
-	 */
1416
-	public function getTwoFactorAuthManager() {
1417
-		return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
1418
-	}
1419
-
1420
-	/**
1421
-	 * @return \OC\NavigationManager
1422
-	 */
1423
-	public function getNavigationManager() {
1424
-		return $this->query('NavigationManager');
1425
-	}
1426
-
1427
-	/**
1428
-	 * @return \OCP\IConfig
1429
-	 */
1430
-	public function getConfig() {
1431
-		return $this->query('AllConfig');
1432
-	}
1433
-
1434
-	/**
1435
-	 * @return \OC\SystemConfig
1436
-	 */
1437
-	public function getSystemConfig() {
1438
-		return $this->query('SystemConfig');
1439
-	}
1440
-
1441
-	/**
1442
-	 * Returns the app config manager
1443
-	 *
1444
-	 * @return \OCP\IAppConfig
1445
-	 */
1446
-	public function getAppConfig() {
1447
-		return $this->query('AppConfig');
1448
-	}
1449
-
1450
-	/**
1451
-	 * @return \OCP\L10N\IFactory
1452
-	 */
1453
-	public function getL10NFactory() {
1454
-		return $this->query('L10NFactory');
1455
-	}
1456
-
1457
-	/**
1458
-	 * get an L10N instance
1459
-	 *
1460
-	 * @param string $app appid
1461
-	 * @param string $lang
1462
-	 * @return IL10N
1463
-	 */
1464
-	public function getL10N($app, $lang = null) {
1465
-		return $this->getL10NFactory()->get($app, $lang);
1466
-	}
1467
-
1468
-	/**
1469
-	 * @return \OCP\IURLGenerator
1470
-	 */
1471
-	public function getURLGenerator() {
1472
-		return $this->query('URLGenerator');
1473
-	}
1474
-
1475
-	/**
1476
-	 * @return AppFetcher
1477
-	 */
1478
-	public function getAppFetcher() {
1479
-		return $this->query(AppFetcher::class);
1480
-	}
1481
-
1482
-	/**
1483
-	 * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
1484
-	 * getMemCacheFactory() instead.
1485
-	 *
1486
-	 * @return \OCP\ICache
1487
-	 * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
1488
-	 */
1489
-	public function getCache() {
1490
-		return $this->query('UserCache');
1491
-	}
1492
-
1493
-	/**
1494
-	 * Returns an \OCP\CacheFactory instance
1495
-	 *
1496
-	 * @return \OCP\ICacheFactory
1497
-	 */
1498
-	public function getMemCacheFactory() {
1499
-		return $this->query('MemCacheFactory');
1500
-	}
1501
-
1502
-	/**
1503
-	 * Returns an \OC\RedisFactory instance
1504
-	 *
1505
-	 * @return \OC\RedisFactory
1506
-	 */
1507
-	public function getGetRedisFactory() {
1508
-		return $this->query('RedisFactory');
1509
-	}
1510
-
1511
-
1512
-	/**
1513
-	 * Returns the current session
1514
-	 *
1515
-	 * @return \OCP\IDBConnection
1516
-	 */
1517
-	public function getDatabaseConnection() {
1518
-		return $this->query('DatabaseConnection');
1519
-	}
1520
-
1521
-	/**
1522
-	 * Returns the activity manager
1523
-	 *
1524
-	 * @return \OCP\Activity\IManager
1525
-	 */
1526
-	public function getActivityManager() {
1527
-		return $this->query('ActivityManager');
1528
-	}
1529
-
1530
-	/**
1531
-	 * Returns an job list for controlling background jobs
1532
-	 *
1533
-	 * @return \OCP\BackgroundJob\IJobList
1534
-	 */
1535
-	public function getJobList() {
1536
-		return $this->query('JobList');
1537
-	}
1538
-
1539
-	/**
1540
-	 * Returns a logger instance
1541
-	 *
1542
-	 * @return \OCP\ILogger
1543
-	 */
1544
-	public function getLogger() {
1545
-		return $this->query('Logger');
1546
-	}
1547
-
1548
-	/**
1549
-	 * Returns a router for generating and matching urls
1550
-	 *
1551
-	 * @return \OCP\Route\IRouter
1552
-	 */
1553
-	public function getRouter() {
1554
-		return $this->query('Router');
1555
-	}
1556
-
1557
-	/**
1558
-	 * Returns a search instance
1559
-	 *
1560
-	 * @return \OCP\ISearch
1561
-	 */
1562
-	public function getSearch() {
1563
-		return $this->query('Search');
1564
-	}
1565
-
1566
-	/**
1567
-	 * Returns a SecureRandom instance
1568
-	 *
1569
-	 * @return \OCP\Security\ISecureRandom
1570
-	 */
1571
-	public function getSecureRandom() {
1572
-		return $this->query('SecureRandom');
1573
-	}
1574
-
1575
-	/**
1576
-	 * Returns a Crypto instance
1577
-	 *
1578
-	 * @return \OCP\Security\ICrypto
1579
-	 */
1580
-	public function getCrypto() {
1581
-		return $this->query('Crypto');
1582
-	}
1583
-
1584
-	/**
1585
-	 * Returns a Hasher instance
1586
-	 *
1587
-	 * @return \OCP\Security\IHasher
1588
-	 */
1589
-	public function getHasher() {
1590
-		return $this->query('Hasher');
1591
-	}
1592
-
1593
-	/**
1594
-	 * Returns a CredentialsManager instance
1595
-	 *
1596
-	 * @return \OCP\Security\ICredentialsManager
1597
-	 */
1598
-	public function getCredentialsManager() {
1599
-		return $this->query('CredentialsManager');
1600
-	}
1601
-
1602
-	/**
1603
-	 * Get the certificate manager for the user
1604
-	 *
1605
-	 * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
1606
-	 * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
1607
-	 */
1608
-	public function getCertificateManager($userId = '') {
1609
-		if ($userId === '') {
1610
-			$userSession = $this->getUserSession();
1611
-			$user = $userSession->getUser();
1612
-			if (is_null($user)) {
1613
-				return null;
1614
-			}
1615
-			$userId = $user->getUID();
1616
-		}
1617
-		return new CertificateManager(
1618
-			$userId,
1619
-			new View(),
1620
-			$this->getConfig(),
1621
-			$this->getLogger(),
1622
-			$this->getSecureRandom()
1623
-		);
1624
-	}
1625
-
1626
-	/**
1627
-	 * Returns an instance of the HTTP client service
1628
-	 *
1629
-	 * @return \OCP\Http\Client\IClientService
1630
-	 */
1631
-	public function getHTTPClientService() {
1632
-		return $this->query('HttpClientService');
1633
-	}
1634
-
1635
-	/**
1636
-	 * Create a new event source
1637
-	 *
1638
-	 * @return \OCP\IEventSource
1639
-	 */
1640
-	public function createEventSource() {
1641
-		return new \OC_EventSource();
1642
-	}
1643
-
1644
-	/**
1645
-	 * Get the active event logger
1646
-	 *
1647
-	 * The returned logger only logs data when debug mode is enabled
1648
-	 *
1649
-	 * @return \OCP\Diagnostics\IEventLogger
1650
-	 */
1651
-	public function getEventLogger() {
1652
-		return $this->query('EventLogger');
1653
-	}
1654
-
1655
-	/**
1656
-	 * Get the active query logger
1657
-	 *
1658
-	 * The returned logger only logs data when debug mode is enabled
1659
-	 *
1660
-	 * @return \OCP\Diagnostics\IQueryLogger
1661
-	 */
1662
-	public function getQueryLogger() {
1663
-		return $this->query('QueryLogger');
1664
-	}
1665
-
1666
-	/**
1667
-	 * Get the manager for temporary files and folders
1668
-	 *
1669
-	 * @return \OCP\ITempManager
1670
-	 */
1671
-	public function getTempManager() {
1672
-		return $this->query('TempManager');
1673
-	}
1674
-
1675
-	/**
1676
-	 * Get the app manager
1677
-	 *
1678
-	 * @return \OCP\App\IAppManager
1679
-	 */
1680
-	public function getAppManager() {
1681
-		return $this->query('AppManager');
1682
-	}
1683
-
1684
-	/**
1685
-	 * Creates a new mailer
1686
-	 *
1687
-	 * @return \OCP\Mail\IMailer
1688
-	 */
1689
-	public function getMailer() {
1690
-		return $this->query('Mailer');
1691
-	}
1692
-
1693
-	/**
1694
-	 * Get the webroot
1695
-	 *
1696
-	 * @return string
1697
-	 */
1698
-	public function getWebRoot() {
1699
-		return $this->webRoot;
1700
-	}
1701
-
1702
-	/**
1703
-	 * @return \OC\OCSClient
1704
-	 */
1705
-	public function getOcsClient() {
1706
-		return $this->query('OcsClient');
1707
-	}
1708
-
1709
-	/**
1710
-	 * @return \OCP\IDateTimeZone
1711
-	 */
1712
-	public function getDateTimeZone() {
1713
-		return $this->query('DateTimeZone');
1714
-	}
1715
-
1716
-	/**
1717
-	 * @return \OCP\IDateTimeFormatter
1718
-	 */
1719
-	public function getDateTimeFormatter() {
1720
-		return $this->query('DateTimeFormatter');
1721
-	}
1722
-
1723
-	/**
1724
-	 * @return \OCP\Files\Config\IMountProviderCollection
1725
-	 */
1726
-	public function getMountProviderCollection() {
1727
-		return $this->query('MountConfigManager');
1728
-	}
1729
-
1730
-	/**
1731
-	 * Get the IniWrapper
1732
-	 *
1733
-	 * @return IniGetWrapper
1734
-	 */
1735
-	public function getIniWrapper() {
1736
-		return $this->query('IniWrapper');
1737
-	}
1738
-
1739
-	/**
1740
-	 * @return \OCP\Command\IBus
1741
-	 */
1742
-	public function getCommandBus() {
1743
-		return $this->query('AsyncCommandBus');
1744
-	}
1745
-
1746
-	/**
1747
-	 * Get the trusted domain helper
1748
-	 *
1749
-	 * @return TrustedDomainHelper
1750
-	 */
1751
-	public function getTrustedDomainHelper() {
1752
-		return $this->query('TrustedDomainHelper');
1753
-	}
1754
-
1755
-	/**
1756
-	 * Get the locking provider
1757
-	 *
1758
-	 * @return \OCP\Lock\ILockingProvider
1759
-	 * @since 8.1.0
1760
-	 */
1761
-	public function getLockingProvider() {
1762
-		return $this->query('LockingProvider');
1763
-	}
1764
-
1765
-	/**
1766
-	 * @return \OCP\Files\Mount\IMountManager
1767
-	 **/
1768
-	function getMountManager() {
1769
-		return $this->query('MountManager');
1770
-	}
1771
-
1772
-	/** @return \OCP\Files\Config\IUserMountCache */
1773
-	function getUserMountCache() {
1774
-		return $this->query('UserMountCache');
1775
-	}
1776
-
1777
-	/**
1778
-	 * Get the MimeTypeDetector
1779
-	 *
1780
-	 * @return \OCP\Files\IMimeTypeDetector
1781
-	 */
1782
-	public function getMimeTypeDetector() {
1783
-		return $this->query('MimeTypeDetector');
1784
-	}
1785
-
1786
-	/**
1787
-	 * Get the MimeTypeLoader
1788
-	 *
1789
-	 * @return \OCP\Files\IMimeTypeLoader
1790
-	 */
1791
-	public function getMimeTypeLoader() {
1792
-		return $this->query('MimeTypeLoader');
1793
-	}
1794
-
1795
-	/**
1796
-	 * Get the manager of all the capabilities
1797
-	 *
1798
-	 * @return \OC\CapabilitiesManager
1799
-	 */
1800
-	public function getCapabilitiesManager() {
1801
-		return $this->query('CapabilitiesManager');
1802
-	}
1803
-
1804
-	/**
1805
-	 * Get the EventDispatcher
1806
-	 *
1807
-	 * @return EventDispatcherInterface
1808
-	 * @since 8.2.0
1809
-	 */
1810
-	public function getEventDispatcher() {
1811
-		return $this->query('EventDispatcher');
1812
-	}
1813
-
1814
-	/**
1815
-	 * Get the Notification Manager
1816
-	 *
1817
-	 * @return \OCP\Notification\IManager
1818
-	 * @since 8.2.0
1819
-	 */
1820
-	public function getNotificationManager() {
1821
-		return $this->query('NotificationManager');
1822
-	}
1823
-
1824
-	/**
1825
-	 * @return \OCP\Comments\ICommentsManager
1826
-	 */
1827
-	public function getCommentsManager() {
1828
-		return $this->query('CommentsManager');
1829
-	}
1830
-
1831
-	/**
1832
-	 * @return \OCA\Theming\ThemingDefaults
1833
-	 */
1834
-	public function getThemingDefaults() {
1835
-		return $this->query('ThemingDefaults');
1836
-	}
1837
-
1838
-	/**
1839
-	 * @return \OC\IntegrityCheck\Checker
1840
-	 */
1841
-	public function getIntegrityCodeChecker() {
1842
-		return $this->query('IntegrityCodeChecker');
1843
-	}
1844
-
1845
-	/**
1846
-	 * @return \OC\Session\CryptoWrapper
1847
-	 */
1848
-	public function getSessionCryptoWrapper() {
1849
-		return $this->query('CryptoWrapper');
1850
-	}
1851
-
1852
-	/**
1853
-	 * @return CsrfTokenManager
1854
-	 */
1855
-	public function getCsrfTokenManager() {
1856
-		return $this->query('CsrfTokenManager');
1857
-	}
1858
-
1859
-	/**
1860
-	 * @return Throttler
1861
-	 */
1862
-	public function getBruteForceThrottler() {
1863
-		return $this->query('Throttler');
1864
-	}
1865
-
1866
-	/**
1867
-	 * @return IContentSecurityPolicyManager
1868
-	 */
1869
-	public function getContentSecurityPolicyManager() {
1870
-		return $this->query('ContentSecurityPolicyManager');
1871
-	}
1872
-
1873
-	/**
1874
-	 * @return ContentSecurityPolicyNonceManager
1875
-	 */
1876
-	public function getContentSecurityPolicyNonceManager() {
1877
-		return $this->query('ContentSecurityPolicyNonceManager');
1878
-	}
1879
-
1880
-	/**
1881
-	 * Not a public API as of 8.2, wait for 9.0
1882
-	 *
1883
-	 * @return \OCA\Files_External\Service\BackendService
1884
-	 */
1885
-	public function getStoragesBackendService() {
1886
-		return $this->query('OCA\\Files_External\\Service\\BackendService');
1887
-	}
1888
-
1889
-	/**
1890
-	 * Not a public API as of 8.2, wait for 9.0
1891
-	 *
1892
-	 * @return \OCA\Files_External\Service\GlobalStoragesService
1893
-	 */
1894
-	public function getGlobalStoragesService() {
1895
-		return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
1896
-	}
1897
-
1898
-	/**
1899
-	 * Not a public API as of 8.2, wait for 9.0
1900
-	 *
1901
-	 * @return \OCA\Files_External\Service\UserGlobalStoragesService
1902
-	 */
1903
-	public function getUserGlobalStoragesService() {
1904
-		return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
1905
-	}
1906
-
1907
-	/**
1908
-	 * Not a public API as of 8.2, wait for 9.0
1909
-	 *
1910
-	 * @return \OCA\Files_External\Service\UserStoragesService
1911
-	 */
1912
-	public function getUserStoragesService() {
1913
-		return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
1914
-	}
1915
-
1916
-	/**
1917
-	 * @return \OCP\Share\IManager
1918
-	 */
1919
-	public function getShareManager() {
1920
-		return $this->query('ShareManager');
1921
-	}
1922
-
1923
-	/**
1924
-	 * @return \OCP\Collaboration\Collaborators\ISearch
1925
-	 */
1926
-	public function getCollaboratorSearch() {
1927
-		return $this->query('CollaboratorSearch');
1928
-	}
1929
-
1930
-	/**
1931
-	 * @return \OCP\Collaboration\AutoComplete\IManager
1932
-	 */
1933
-	public function getAutoCompleteManager(){
1934
-		return $this->query(IManager::class);
1935
-	}
1936
-
1937
-	/**
1938
-	 * Returns the LDAP Provider
1939
-	 *
1940
-	 * @return \OCP\LDAP\ILDAPProvider
1941
-	 */
1942
-	public function getLDAPProvider() {
1943
-		return $this->query('LDAPProvider');
1944
-	}
1945
-
1946
-	/**
1947
-	 * @return \OCP\Settings\IManager
1948
-	 */
1949
-	public function getSettingsManager() {
1950
-		return $this->query('SettingsManager');
1951
-	}
1952
-
1953
-	/**
1954
-	 * @return \OCP\Files\IAppData
1955
-	 */
1956
-	public function getAppDataDir($app) {
1957
-		/** @var \OC\Files\AppData\Factory $factory */
1958
-		$factory = $this->query(\OC\Files\AppData\Factory::class);
1959
-		return $factory->get($app);
1960
-	}
1961
-
1962
-	/**
1963
-	 * @return \OCP\Lockdown\ILockdownManager
1964
-	 */
1965
-	public function getLockdownManager() {
1966
-		return $this->query('LockdownManager');
1967
-	}
1968
-
1969
-	/**
1970
-	 * @return \OCP\Federation\ICloudIdManager
1971
-	 */
1972
-	public function getCloudIdManager() {
1973
-		return $this->query(ICloudIdManager::class);
1974
-	}
1975
-
1976
-	/**
1977
-	 * @return \OCP\GlobalScale\IConfig
1978
-	 */
1979
-	public function getGlobalScaleConfig() {
1980
-		return $this->query(IConfig::class);
1981
-	}
1982
-
1983
-	/**
1984
-	 * @return \OCP\Federation\ICloudFederationProviderManager
1985
-	 */
1986
-	public function getCloudFederationProviderManager() {
1987
-		return $this->query(ICloudFederationProviderManager::class);
1988
-	}
1989
-
1990
-	/**
1991
-	 * @return \OCP\Remote\Api\IApiFactory
1992
-	 */
1993
-	public function getRemoteApiFactory() {
1994
-		return $this->query(IApiFactory::class);
1995
-	}
1996
-
1997
-	/**
1998
-	 * @return \OCP\Federation\ICloudFederationFactory
1999
-	 */
2000
-	public function getCloudFederationFactory() {
2001
-		return $this->query(ICloudFederationFactory::class);
2002
-	}
2003
-
2004
-	/**
2005
-	 * @return \OCP\Remote\IInstanceFactory
2006
-	 */
2007
-	public function getRemoteInstanceFactory() {
2008
-		return $this->query(IInstanceFactory::class);
2009
-	}
940
+            $prefixes = \OC::$composerAutoloader->getPrefixesPsr4();
941
+            if (isset($prefixes['OCA\\Theming\\'])) {
942
+                $classExists = true;
943
+            } else {
944
+                $classExists = false;
945
+            }
946
+
947
+            if ($classExists && $c->getConfig()->getSystemValue('installed', false) && $c->getAppManager()->isInstalled('theming') && $c->getTrustedDomainHelper()->isTrustedDomain($c->getRequest()->getInsecureServerHost())) {
948
+                return new ThemingDefaults(
949
+                    $c->getConfig(),
950
+                    $c->getL10N('theming'),
951
+                    $c->getURLGenerator(),
952
+                    $c->getMemCacheFactory(),
953
+                    new Util($c->getConfig(), $this->getAppManager(), $c->getAppDataDir('theming')),
954
+                    new ImageManager($c->getConfig(), $c->getAppDataDir('theming'), $c->getURLGenerator()),
955
+                    $c->getAppManager()
956
+                );
957
+            }
958
+            return new \OC_Defaults();
959
+        });
960
+        $this->registerService(SCSSCacher::class, function (Server $c) {
961
+            /** @var Factory $cacheFactory */
962
+            $cacheFactory = $c->query(Factory::class);
963
+            return new SCSSCacher(
964
+                $c->getLogger(),
965
+                $c->query(\OC\Files\AppData\Factory::class),
966
+                $c->getURLGenerator(),
967
+                $c->getConfig(),
968
+                $c->getThemingDefaults(),
969
+                \OC::$SERVERROOT,
970
+                $this->getMemCacheFactory()
971
+            );
972
+        });
973
+        $this->registerService(JSCombiner::class, function (Server $c) {
974
+            /** @var Factory $cacheFactory */
975
+            $cacheFactory = $c->query(Factory::class);
976
+            return new JSCombiner(
977
+                $c->getAppDataDir('js'),
978
+                $c->getURLGenerator(),
979
+                $this->getMemCacheFactory(),
980
+                $c->getSystemConfig(),
981
+                $c->getLogger()
982
+            );
983
+        });
984
+        $this->registerService(EventDispatcher::class, function () {
985
+            return new EventDispatcher();
986
+        });
987
+        $this->registerAlias('EventDispatcher', EventDispatcher::class);
988
+        $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class);
989
+
990
+        $this->registerService('CryptoWrapper', function (Server $c) {
991
+            // FIXME: Instantiiated here due to cyclic dependency
992
+            $request = new Request(
993
+                [
994
+                    'get' => $_GET,
995
+                    'post' => $_POST,
996
+                    'files' => $_FILES,
997
+                    'server' => $_SERVER,
998
+                    'env' => $_ENV,
999
+                    'cookies' => $_COOKIE,
1000
+                    'method' => (isset($_SERVER) && isset($_SERVER['REQUEST_METHOD']))
1001
+                        ? $_SERVER['REQUEST_METHOD']
1002
+                        : null,
1003
+                ],
1004
+                $c->getSecureRandom(),
1005
+                $c->getConfig()
1006
+            );
1007
+
1008
+            return new CryptoWrapper(
1009
+                $c->getConfig(),
1010
+                $c->getCrypto(),
1011
+                $c->getSecureRandom(),
1012
+                $request
1013
+            );
1014
+        });
1015
+        $this->registerService('CsrfTokenManager', function (Server $c) {
1016
+            $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom());
1017
+
1018
+            return new CsrfTokenManager(
1019
+                $tokenGenerator,
1020
+                $c->query(SessionStorage::class)
1021
+            );
1022
+        });
1023
+        $this->registerService(SessionStorage::class, function (Server $c) {
1024
+            return new SessionStorage($c->getSession());
1025
+        });
1026
+        $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) {
1027
+            return new ContentSecurityPolicyManager();
1028
+        });
1029
+        $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class);
1030
+
1031
+        $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) {
1032
+            return new ContentSecurityPolicyNonceManager(
1033
+                $c->getCsrfTokenManager(),
1034
+                $c->getRequest()
1035
+            );
1036
+        });
1037
+
1038
+        $this->registerService(\OCP\Share\IManager::class, function (Server $c) {
1039
+            $config = $c->getConfig();
1040
+            $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class);
1041
+            /** @var \OCP\Share\IProviderFactory $factory */
1042
+            $factory = new $factoryClass($this);
1043
+
1044
+            $manager = new \OC\Share20\Manager(
1045
+                $c->getLogger(),
1046
+                $c->getConfig(),
1047
+                $c->getSecureRandom(),
1048
+                $c->getHasher(),
1049
+                $c->getMountManager(),
1050
+                $c->getGroupManager(),
1051
+                $c->getL10N('lib'),
1052
+                $c->getL10NFactory(),
1053
+                $factory,
1054
+                $c->getUserManager(),
1055
+                $c->getLazyRootFolder(),
1056
+                $c->getEventDispatcher(),
1057
+                $c->getMailer(),
1058
+                $c->getURLGenerator(),
1059
+                $c->getThemingDefaults()
1060
+            );
1061
+
1062
+            return $manager;
1063
+        });
1064
+        $this->registerAlias('ShareManager', \OCP\Share\IManager::class);
1065
+
1066
+        $this->registerService(\OCP\Collaboration\Collaborators\ISearch::class, function(Server $c) {
1067
+            $instance = new Collaboration\Collaborators\Search($c);
1068
+
1069
+            // register default plugins
1070
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_USER', 'class' => UserPlugin::class]);
1071
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_GROUP', 'class' => GroupPlugin::class]);
1072
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_EMAIL', 'class' => MailPlugin::class]);
1073
+            $instance->registerPlugin(['shareType' => 'SHARE_TYPE_REMOTE', 'class' => RemotePlugin::class]);
1074
+
1075
+            return $instance;
1076
+        });
1077
+        $this->registerAlias('CollaboratorSearch', \OCP\Collaboration\Collaborators\ISearch::class);
1078
+
1079
+        $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class);
1080
+
1081
+        $this->registerService('SettingsManager', function (Server $c) {
1082
+            $manager = new \OC\Settings\Manager(
1083
+                $c->getLogger(),
1084
+                $c->getDatabaseConnection(),
1085
+                $c->getL10N('lib'),
1086
+                $c->getConfig(),
1087
+                $c->getEncryptionManager(),
1088
+                $c->getUserManager(),
1089
+                $c->getLockingProvider(),
1090
+                $c->getRequest(),
1091
+                $c->getURLGenerator(),
1092
+                $c->query(AccountManager::class),
1093
+                $c->getGroupManager(),
1094
+                $c->getL10NFactory(),
1095
+                $c->getAppManager()
1096
+            );
1097
+            return $manager;
1098
+        });
1099
+        $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) {
1100
+            return new \OC\Files\AppData\Factory(
1101
+                $c->getRootFolder(),
1102
+                $c->getSystemConfig()
1103
+            );
1104
+        });
1105
+
1106
+        $this->registerService('LockdownManager', function (Server $c) {
1107
+            return new LockdownManager(function () use ($c) {
1108
+                return $c->getSession();
1109
+            });
1110
+        });
1111
+
1112
+        $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) {
1113
+            return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService());
1114
+        });
1115
+
1116
+        $this->registerService(ICloudIdManager::class, function (Server $c) {
1117
+            return new CloudIdManager();
1118
+        });
1119
+
1120
+        $this->registerService(IConfig::class, function (Server $c) {
1121
+            return new GlobalScale\Config($c->getConfig());
1122
+        });
1123
+
1124
+        $this->registerService(ICloudFederationProviderManager::class, function (Server $c) {
1125
+            return new CloudFederationProviderManager();
1126
+        });
1127
+
1128
+        $this->registerService(ICloudFederationFactory::class, function (Server $c) {
1129
+            return new CloudFederationFactory();
1130
+        });
1131
+
1132
+        $this->registerAlias(\OCP\AppFramework\Utility\IControllerMethodReflector::class, \OC\AppFramework\Utility\ControllerMethodReflector::class);
1133
+        $this->registerAlias('ControllerMethodReflector', \OCP\AppFramework\Utility\IControllerMethodReflector::class);
1134
+
1135
+        $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class);
1136
+        $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class);
1137
+
1138
+        $this->registerService(Defaults::class, function (Server $c) {
1139
+            return new Defaults(
1140
+                $c->getThemingDefaults()
1141
+            );
1142
+        });
1143
+        $this->registerAlias('Defaults', \OCP\Defaults::class);
1144
+
1145
+        $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) {
1146
+            return $c->query(\OCP\IUserSession::class)->getSession();
1147
+        });
1148
+
1149
+        $this->registerService(IShareHelper::class, function (Server $c) {
1150
+            return new ShareHelper(
1151
+                $c->query(\OCP\Share\IManager::class)
1152
+            );
1153
+        });
1154
+
1155
+        $this->registerService(Installer::class, function(Server $c) {
1156
+            return new Installer(
1157
+                $c->getAppFetcher(),
1158
+                $c->getHTTPClientService(),
1159
+                $c->getTempManager(),
1160
+                $c->getLogger(),
1161
+                $c->getConfig()
1162
+            );
1163
+        });
1164
+
1165
+        $this->registerService(IApiFactory::class, function(Server $c) {
1166
+            return new ApiFactory($c->getHTTPClientService());
1167
+        });
1168
+
1169
+        $this->registerService(IInstanceFactory::class, function(Server $c) {
1170
+            $memcacheFactory = $c->getMemCacheFactory();
1171
+            return new InstanceFactory($memcacheFactory->createLocal('remoteinstance.'), $c->getHTTPClientService());
1172
+        });
1173
+
1174
+        $this->registerService(IContactsStore::class, function(Server $c) {
1175
+            return new ContactsStore(
1176
+                $c->getContactsManager(),
1177
+                $c->getConfig(),
1178
+                $c->getUserManager(),
1179
+                $c->getGroupManager()
1180
+            );
1181
+        });
1182
+        $this->registerAlias(IContactsStore::class, ContactsStore::class);
1183
+
1184
+        $this->connectDispatcher();
1185
+    }
1186
+
1187
+    /**
1188
+     * @return \OCP\Calendar\IManager
1189
+     */
1190
+    public function getCalendarManager() {
1191
+        return $this->query('CalendarManager');
1192
+    }
1193
+
1194
+    private function connectDispatcher() {
1195
+        $dispatcher = $this->getEventDispatcher();
1196
+
1197
+        // Delete avatar on user deletion
1198
+        $dispatcher->addListener('OCP\IUser::preDelete', function(GenericEvent $e) {
1199
+            $logger = $this->getLogger();
1200
+            $manager = $this->getAvatarManager();
1201
+            /** @var IUser $user */
1202
+            $user = $e->getSubject();
1203
+
1204
+            try {
1205
+                $avatar = $manager->getAvatar($user->getUID());
1206
+                $avatar->remove();
1207
+            } catch (NotFoundException $e) {
1208
+                // no avatar to remove
1209
+            } catch (\Exception $e) {
1210
+                // Ignore exceptions
1211
+                $logger->info('Could not cleanup avatar of ' . $user->getUID());
1212
+            }
1213
+        });
1214
+
1215
+        $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) {
1216
+            $manager = $this->getAvatarManager();
1217
+            /** @var IUser $user */
1218
+            $user = $e->getSubject();
1219
+            $feature = $e->getArgument('feature');
1220
+            $oldValue = $e->getArgument('oldValue');
1221
+            $value = $e->getArgument('value');
1222
+
1223
+            try {
1224
+                $avatar = $manager->getAvatar($user->getUID());
1225
+                $avatar->userChanged($feature, $oldValue, $value);
1226
+            } catch (NotFoundException $e) {
1227
+                // no avatar to remove
1228
+            }
1229
+        });
1230
+    }
1231
+
1232
+    /**
1233
+     * @return \OCP\Contacts\IManager
1234
+     */
1235
+    public function getContactsManager() {
1236
+        return $this->query('ContactsManager');
1237
+    }
1238
+
1239
+    /**
1240
+     * @return \OC\Encryption\Manager
1241
+     */
1242
+    public function getEncryptionManager() {
1243
+        return $this->query('EncryptionManager');
1244
+    }
1245
+
1246
+    /**
1247
+     * @return \OC\Encryption\File
1248
+     */
1249
+    public function getEncryptionFilesHelper() {
1250
+        return $this->query('EncryptionFileHelper');
1251
+    }
1252
+
1253
+    /**
1254
+     * @return \OCP\Encryption\Keys\IStorage
1255
+     */
1256
+    public function getEncryptionKeyStorage() {
1257
+        return $this->query('EncryptionKeyStorage');
1258
+    }
1259
+
1260
+    /**
1261
+     * The current request object holding all information about the request
1262
+     * currently being processed is returned from this method.
1263
+     * In case the current execution was not initiated by a web request null is returned
1264
+     *
1265
+     * @return \OCP\IRequest
1266
+     */
1267
+    public function getRequest() {
1268
+        return $this->query('Request');
1269
+    }
1270
+
1271
+    /**
1272
+     * Returns the preview manager which can create preview images for a given file
1273
+     *
1274
+     * @return \OCP\IPreview
1275
+     */
1276
+    public function getPreviewManager() {
1277
+        return $this->query('PreviewManager');
1278
+    }
1279
+
1280
+    /**
1281
+     * Returns the tag manager which can get and set tags for different object types
1282
+     *
1283
+     * @see \OCP\ITagManager::load()
1284
+     * @return \OCP\ITagManager
1285
+     */
1286
+    public function getTagManager() {
1287
+        return $this->query('TagManager');
1288
+    }
1289
+
1290
+    /**
1291
+     * Returns the system-tag manager
1292
+     *
1293
+     * @return \OCP\SystemTag\ISystemTagManager
1294
+     *
1295
+     * @since 9.0.0
1296
+     */
1297
+    public function getSystemTagManager() {
1298
+        return $this->query('SystemTagManager');
1299
+    }
1300
+
1301
+    /**
1302
+     * Returns the system-tag object mapper
1303
+     *
1304
+     * @return \OCP\SystemTag\ISystemTagObjectMapper
1305
+     *
1306
+     * @since 9.0.0
1307
+     */
1308
+    public function getSystemTagObjectMapper() {
1309
+        return $this->query('SystemTagObjectMapper');
1310
+    }
1311
+
1312
+    /**
1313
+     * Returns the avatar manager, used for avatar functionality
1314
+     *
1315
+     * @return \OCP\IAvatarManager
1316
+     */
1317
+    public function getAvatarManager() {
1318
+        return $this->query('AvatarManager');
1319
+    }
1320
+
1321
+    /**
1322
+     * Returns the root folder of ownCloud's data directory
1323
+     *
1324
+     * @return \OCP\Files\IRootFolder
1325
+     */
1326
+    public function getRootFolder() {
1327
+        return $this->query('LazyRootFolder');
1328
+    }
1329
+
1330
+    /**
1331
+     * Returns the root folder of ownCloud's data directory
1332
+     * This is the lazy variant so this gets only initialized once it
1333
+     * is actually used.
1334
+     *
1335
+     * @return \OCP\Files\IRootFolder
1336
+     */
1337
+    public function getLazyRootFolder() {
1338
+        return $this->query('LazyRootFolder');
1339
+    }
1340
+
1341
+    /**
1342
+     * Returns a view to ownCloud's files folder
1343
+     *
1344
+     * @param string $userId user ID
1345
+     * @return \OCP\Files\Folder|null
1346
+     */
1347
+    public function getUserFolder($userId = null) {
1348
+        if ($userId === null) {
1349
+            $user = $this->getUserSession()->getUser();
1350
+            if (!$user) {
1351
+                return null;
1352
+            }
1353
+            $userId = $user->getUID();
1354
+        }
1355
+        $root = $this->getRootFolder();
1356
+        return $root->getUserFolder($userId);
1357
+    }
1358
+
1359
+    /**
1360
+     * Returns an app-specific view in ownClouds data directory
1361
+     *
1362
+     * @return \OCP\Files\Folder
1363
+     * @deprecated since 9.2.0 use IAppData
1364
+     */
1365
+    public function getAppFolder() {
1366
+        $dir = '/' . \OC_App::getCurrentApp();
1367
+        $root = $this->getRootFolder();
1368
+        if (!$root->nodeExists($dir)) {
1369
+            $folder = $root->newFolder($dir);
1370
+        } else {
1371
+            $folder = $root->get($dir);
1372
+        }
1373
+        return $folder;
1374
+    }
1375
+
1376
+    /**
1377
+     * @return \OC\User\Manager
1378
+     */
1379
+    public function getUserManager() {
1380
+        return $this->query('UserManager');
1381
+    }
1382
+
1383
+    /**
1384
+     * @return \OC\Group\Manager
1385
+     */
1386
+    public function getGroupManager() {
1387
+        return $this->query('GroupManager');
1388
+    }
1389
+
1390
+    /**
1391
+     * @return \OC\User\Session
1392
+     */
1393
+    public function getUserSession() {
1394
+        return $this->query('UserSession');
1395
+    }
1396
+
1397
+    /**
1398
+     * @return \OCP\ISession
1399
+     */
1400
+    public function getSession() {
1401
+        return $this->query('UserSession')->getSession();
1402
+    }
1403
+
1404
+    /**
1405
+     * @param \OCP\ISession $session
1406
+     */
1407
+    public function setSession(\OCP\ISession $session) {
1408
+        $this->query(SessionStorage::class)->setSession($session);
1409
+        $this->query('UserSession')->setSession($session);
1410
+        $this->query(Store::class)->setSession($session);
1411
+    }
1412
+
1413
+    /**
1414
+     * @return \OC\Authentication\TwoFactorAuth\Manager
1415
+     */
1416
+    public function getTwoFactorAuthManager() {
1417
+        return $this->query('\OC\Authentication\TwoFactorAuth\Manager');
1418
+    }
1419
+
1420
+    /**
1421
+     * @return \OC\NavigationManager
1422
+     */
1423
+    public function getNavigationManager() {
1424
+        return $this->query('NavigationManager');
1425
+    }
1426
+
1427
+    /**
1428
+     * @return \OCP\IConfig
1429
+     */
1430
+    public function getConfig() {
1431
+        return $this->query('AllConfig');
1432
+    }
1433
+
1434
+    /**
1435
+     * @return \OC\SystemConfig
1436
+     */
1437
+    public function getSystemConfig() {
1438
+        return $this->query('SystemConfig');
1439
+    }
1440
+
1441
+    /**
1442
+     * Returns the app config manager
1443
+     *
1444
+     * @return \OCP\IAppConfig
1445
+     */
1446
+    public function getAppConfig() {
1447
+        return $this->query('AppConfig');
1448
+    }
1449
+
1450
+    /**
1451
+     * @return \OCP\L10N\IFactory
1452
+     */
1453
+    public function getL10NFactory() {
1454
+        return $this->query('L10NFactory');
1455
+    }
1456
+
1457
+    /**
1458
+     * get an L10N instance
1459
+     *
1460
+     * @param string $app appid
1461
+     * @param string $lang
1462
+     * @return IL10N
1463
+     */
1464
+    public function getL10N($app, $lang = null) {
1465
+        return $this->getL10NFactory()->get($app, $lang);
1466
+    }
1467
+
1468
+    /**
1469
+     * @return \OCP\IURLGenerator
1470
+     */
1471
+    public function getURLGenerator() {
1472
+        return $this->query('URLGenerator');
1473
+    }
1474
+
1475
+    /**
1476
+     * @return AppFetcher
1477
+     */
1478
+    public function getAppFetcher() {
1479
+        return $this->query(AppFetcher::class);
1480
+    }
1481
+
1482
+    /**
1483
+     * Returns an ICache instance. Since 8.1.0 it returns a fake cache. Use
1484
+     * getMemCacheFactory() instead.
1485
+     *
1486
+     * @return \OCP\ICache
1487
+     * @deprecated 8.1.0 use getMemCacheFactory to obtain a proper cache
1488
+     */
1489
+    public function getCache() {
1490
+        return $this->query('UserCache');
1491
+    }
1492
+
1493
+    /**
1494
+     * Returns an \OCP\CacheFactory instance
1495
+     *
1496
+     * @return \OCP\ICacheFactory
1497
+     */
1498
+    public function getMemCacheFactory() {
1499
+        return $this->query('MemCacheFactory');
1500
+    }
1501
+
1502
+    /**
1503
+     * Returns an \OC\RedisFactory instance
1504
+     *
1505
+     * @return \OC\RedisFactory
1506
+     */
1507
+    public function getGetRedisFactory() {
1508
+        return $this->query('RedisFactory');
1509
+    }
1510
+
1511
+
1512
+    /**
1513
+     * Returns the current session
1514
+     *
1515
+     * @return \OCP\IDBConnection
1516
+     */
1517
+    public function getDatabaseConnection() {
1518
+        return $this->query('DatabaseConnection');
1519
+    }
1520
+
1521
+    /**
1522
+     * Returns the activity manager
1523
+     *
1524
+     * @return \OCP\Activity\IManager
1525
+     */
1526
+    public function getActivityManager() {
1527
+        return $this->query('ActivityManager');
1528
+    }
1529
+
1530
+    /**
1531
+     * Returns an job list for controlling background jobs
1532
+     *
1533
+     * @return \OCP\BackgroundJob\IJobList
1534
+     */
1535
+    public function getJobList() {
1536
+        return $this->query('JobList');
1537
+    }
1538
+
1539
+    /**
1540
+     * Returns a logger instance
1541
+     *
1542
+     * @return \OCP\ILogger
1543
+     */
1544
+    public function getLogger() {
1545
+        return $this->query('Logger');
1546
+    }
1547
+
1548
+    /**
1549
+     * Returns a router for generating and matching urls
1550
+     *
1551
+     * @return \OCP\Route\IRouter
1552
+     */
1553
+    public function getRouter() {
1554
+        return $this->query('Router');
1555
+    }
1556
+
1557
+    /**
1558
+     * Returns a search instance
1559
+     *
1560
+     * @return \OCP\ISearch
1561
+     */
1562
+    public function getSearch() {
1563
+        return $this->query('Search');
1564
+    }
1565
+
1566
+    /**
1567
+     * Returns a SecureRandom instance
1568
+     *
1569
+     * @return \OCP\Security\ISecureRandom
1570
+     */
1571
+    public function getSecureRandom() {
1572
+        return $this->query('SecureRandom');
1573
+    }
1574
+
1575
+    /**
1576
+     * Returns a Crypto instance
1577
+     *
1578
+     * @return \OCP\Security\ICrypto
1579
+     */
1580
+    public function getCrypto() {
1581
+        return $this->query('Crypto');
1582
+    }
1583
+
1584
+    /**
1585
+     * Returns a Hasher instance
1586
+     *
1587
+     * @return \OCP\Security\IHasher
1588
+     */
1589
+    public function getHasher() {
1590
+        return $this->query('Hasher');
1591
+    }
1592
+
1593
+    /**
1594
+     * Returns a CredentialsManager instance
1595
+     *
1596
+     * @return \OCP\Security\ICredentialsManager
1597
+     */
1598
+    public function getCredentialsManager() {
1599
+        return $this->query('CredentialsManager');
1600
+    }
1601
+
1602
+    /**
1603
+     * Get the certificate manager for the user
1604
+     *
1605
+     * @param string $userId (optional) if not specified the current loggedin user is used, use null to get the system certificate manager
1606
+     * @return \OCP\ICertificateManager | null if $uid is null and no user is logged in
1607
+     */
1608
+    public function getCertificateManager($userId = '') {
1609
+        if ($userId === '') {
1610
+            $userSession = $this->getUserSession();
1611
+            $user = $userSession->getUser();
1612
+            if (is_null($user)) {
1613
+                return null;
1614
+            }
1615
+            $userId = $user->getUID();
1616
+        }
1617
+        return new CertificateManager(
1618
+            $userId,
1619
+            new View(),
1620
+            $this->getConfig(),
1621
+            $this->getLogger(),
1622
+            $this->getSecureRandom()
1623
+        );
1624
+    }
1625
+
1626
+    /**
1627
+     * Returns an instance of the HTTP client service
1628
+     *
1629
+     * @return \OCP\Http\Client\IClientService
1630
+     */
1631
+    public function getHTTPClientService() {
1632
+        return $this->query('HttpClientService');
1633
+    }
1634
+
1635
+    /**
1636
+     * Create a new event source
1637
+     *
1638
+     * @return \OCP\IEventSource
1639
+     */
1640
+    public function createEventSource() {
1641
+        return new \OC_EventSource();
1642
+    }
1643
+
1644
+    /**
1645
+     * Get the active event logger
1646
+     *
1647
+     * The returned logger only logs data when debug mode is enabled
1648
+     *
1649
+     * @return \OCP\Diagnostics\IEventLogger
1650
+     */
1651
+    public function getEventLogger() {
1652
+        return $this->query('EventLogger');
1653
+    }
1654
+
1655
+    /**
1656
+     * Get the active query logger
1657
+     *
1658
+     * The returned logger only logs data when debug mode is enabled
1659
+     *
1660
+     * @return \OCP\Diagnostics\IQueryLogger
1661
+     */
1662
+    public function getQueryLogger() {
1663
+        return $this->query('QueryLogger');
1664
+    }
1665
+
1666
+    /**
1667
+     * Get the manager for temporary files and folders
1668
+     *
1669
+     * @return \OCP\ITempManager
1670
+     */
1671
+    public function getTempManager() {
1672
+        return $this->query('TempManager');
1673
+    }
1674
+
1675
+    /**
1676
+     * Get the app manager
1677
+     *
1678
+     * @return \OCP\App\IAppManager
1679
+     */
1680
+    public function getAppManager() {
1681
+        return $this->query('AppManager');
1682
+    }
1683
+
1684
+    /**
1685
+     * Creates a new mailer
1686
+     *
1687
+     * @return \OCP\Mail\IMailer
1688
+     */
1689
+    public function getMailer() {
1690
+        return $this->query('Mailer');
1691
+    }
1692
+
1693
+    /**
1694
+     * Get the webroot
1695
+     *
1696
+     * @return string
1697
+     */
1698
+    public function getWebRoot() {
1699
+        return $this->webRoot;
1700
+    }
1701
+
1702
+    /**
1703
+     * @return \OC\OCSClient
1704
+     */
1705
+    public function getOcsClient() {
1706
+        return $this->query('OcsClient');
1707
+    }
1708
+
1709
+    /**
1710
+     * @return \OCP\IDateTimeZone
1711
+     */
1712
+    public function getDateTimeZone() {
1713
+        return $this->query('DateTimeZone');
1714
+    }
1715
+
1716
+    /**
1717
+     * @return \OCP\IDateTimeFormatter
1718
+     */
1719
+    public function getDateTimeFormatter() {
1720
+        return $this->query('DateTimeFormatter');
1721
+    }
1722
+
1723
+    /**
1724
+     * @return \OCP\Files\Config\IMountProviderCollection
1725
+     */
1726
+    public function getMountProviderCollection() {
1727
+        return $this->query('MountConfigManager');
1728
+    }
1729
+
1730
+    /**
1731
+     * Get the IniWrapper
1732
+     *
1733
+     * @return IniGetWrapper
1734
+     */
1735
+    public function getIniWrapper() {
1736
+        return $this->query('IniWrapper');
1737
+    }
1738
+
1739
+    /**
1740
+     * @return \OCP\Command\IBus
1741
+     */
1742
+    public function getCommandBus() {
1743
+        return $this->query('AsyncCommandBus');
1744
+    }
1745
+
1746
+    /**
1747
+     * Get the trusted domain helper
1748
+     *
1749
+     * @return TrustedDomainHelper
1750
+     */
1751
+    public function getTrustedDomainHelper() {
1752
+        return $this->query('TrustedDomainHelper');
1753
+    }
1754
+
1755
+    /**
1756
+     * Get the locking provider
1757
+     *
1758
+     * @return \OCP\Lock\ILockingProvider
1759
+     * @since 8.1.0
1760
+     */
1761
+    public function getLockingProvider() {
1762
+        return $this->query('LockingProvider');
1763
+    }
1764
+
1765
+    /**
1766
+     * @return \OCP\Files\Mount\IMountManager
1767
+     **/
1768
+    function getMountManager() {
1769
+        return $this->query('MountManager');
1770
+    }
1771
+
1772
+    /** @return \OCP\Files\Config\IUserMountCache */
1773
+    function getUserMountCache() {
1774
+        return $this->query('UserMountCache');
1775
+    }
1776
+
1777
+    /**
1778
+     * Get the MimeTypeDetector
1779
+     *
1780
+     * @return \OCP\Files\IMimeTypeDetector
1781
+     */
1782
+    public function getMimeTypeDetector() {
1783
+        return $this->query('MimeTypeDetector');
1784
+    }
1785
+
1786
+    /**
1787
+     * Get the MimeTypeLoader
1788
+     *
1789
+     * @return \OCP\Files\IMimeTypeLoader
1790
+     */
1791
+    public function getMimeTypeLoader() {
1792
+        return $this->query('MimeTypeLoader');
1793
+    }
1794
+
1795
+    /**
1796
+     * Get the manager of all the capabilities
1797
+     *
1798
+     * @return \OC\CapabilitiesManager
1799
+     */
1800
+    public function getCapabilitiesManager() {
1801
+        return $this->query('CapabilitiesManager');
1802
+    }
1803
+
1804
+    /**
1805
+     * Get the EventDispatcher
1806
+     *
1807
+     * @return EventDispatcherInterface
1808
+     * @since 8.2.0
1809
+     */
1810
+    public function getEventDispatcher() {
1811
+        return $this->query('EventDispatcher');
1812
+    }
1813
+
1814
+    /**
1815
+     * Get the Notification Manager
1816
+     *
1817
+     * @return \OCP\Notification\IManager
1818
+     * @since 8.2.0
1819
+     */
1820
+    public function getNotificationManager() {
1821
+        return $this->query('NotificationManager');
1822
+    }
1823
+
1824
+    /**
1825
+     * @return \OCP\Comments\ICommentsManager
1826
+     */
1827
+    public function getCommentsManager() {
1828
+        return $this->query('CommentsManager');
1829
+    }
1830
+
1831
+    /**
1832
+     * @return \OCA\Theming\ThemingDefaults
1833
+     */
1834
+    public function getThemingDefaults() {
1835
+        return $this->query('ThemingDefaults');
1836
+    }
1837
+
1838
+    /**
1839
+     * @return \OC\IntegrityCheck\Checker
1840
+     */
1841
+    public function getIntegrityCodeChecker() {
1842
+        return $this->query('IntegrityCodeChecker');
1843
+    }
1844
+
1845
+    /**
1846
+     * @return \OC\Session\CryptoWrapper
1847
+     */
1848
+    public function getSessionCryptoWrapper() {
1849
+        return $this->query('CryptoWrapper');
1850
+    }
1851
+
1852
+    /**
1853
+     * @return CsrfTokenManager
1854
+     */
1855
+    public function getCsrfTokenManager() {
1856
+        return $this->query('CsrfTokenManager');
1857
+    }
1858
+
1859
+    /**
1860
+     * @return Throttler
1861
+     */
1862
+    public function getBruteForceThrottler() {
1863
+        return $this->query('Throttler');
1864
+    }
1865
+
1866
+    /**
1867
+     * @return IContentSecurityPolicyManager
1868
+     */
1869
+    public function getContentSecurityPolicyManager() {
1870
+        return $this->query('ContentSecurityPolicyManager');
1871
+    }
1872
+
1873
+    /**
1874
+     * @return ContentSecurityPolicyNonceManager
1875
+     */
1876
+    public function getContentSecurityPolicyNonceManager() {
1877
+        return $this->query('ContentSecurityPolicyNonceManager');
1878
+    }
1879
+
1880
+    /**
1881
+     * Not a public API as of 8.2, wait for 9.0
1882
+     *
1883
+     * @return \OCA\Files_External\Service\BackendService
1884
+     */
1885
+    public function getStoragesBackendService() {
1886
+        return $this->query('OCA\\Files_External\\Service\\BackendService');
1887
+    }
1888
+
1889
+    /**
1890
+     * Not a public API as of 8.2, wait for 9.0
1891
+     *
1892
+     * @return \OCA\Files_External\Service\GlobalStoragesService
1893
+     */
1894
+    public function getGlobalStoragesService() {
1895
+        return $this->query('OCA\\Files_External\\Service\\GlobalStoragesService');
1896
+    }
1897
+
1898
+    /**
1899
+     * Not a public API as of 8.2, wait for 9.0
1900
+     *
1901
+     * @return \OCA\Files_External\Service\UserGlobalStoragesService
1902
+     */
1903
+    public function getUserGlobalStoragesService() {
1904
+        return $this->query('OCA\\Files_External\\Service\\UserGlobalStoragesService');
1905
+    }
1906
+
1907
+    /**
1908
+     * Not a public API as of 8.2, wait for 9.0
1909
+     *
1910
+     * @return \OCA\Files_External\Service\UserStoragesService
1911
+     */
1912
+    public function getUserStoragesService() {
1913
+        return $this->query('OCA\\Files_External\\Service\\UserStoragesService');
1914
+    }
1915
+
1916
+    /**
1917
+     * @return \OCP\Share\IManager
1918
+     */
1919
+    public function getShareManager() {
1920
+        return $this->query('ShareManager');
1921
+    }
1922
+
1923
+    /**
1924
+     * @return \OCP\Collaboration\Collaborators\ISearch
1925
+     */
1926
+    public function getCollaboratorSearch() {
1927
+        return $this->query('CollaboratorSearch');
1928
+    }
1929
+
1930
+    /**
1931
+     * @return \OCP\Collaboration\AutoComplete\IManager
1932
+     */
1933
+    public function getAutoCompleteManager(){
1934
+        return $this->query(IManager::class);
1935
+    }
1936
+
1937
+    /**
1938
+     * Returns the LDAP Provider
1939
+     *
1940
+     * @return \OCP\LDAP\ILDAPProvider
1941
+     */
1942
+    public function getLDAPProvider() {
1943
+        return $this->query('LDAPProvider');
1944
+    }
1945
+
1946
+    /**
1947
+     * @return \OCP\Settings\IManager
1948
+     */
1949
+    public function getSettingsManager() {
1950
+        return $this->query('SettingsManager');
1951
+    }
1952
+
1953
+    /**
1954
+     * @return \OCP\Files\IAppData
1955
+     */
1956
+    public function getAppDataDir($app) {
1957
+        /** @var \OC\Files\AppData\Factory $factory */
1958
+        $factory = $this->query(\OC\Files\AppData\Factory::class);
1959
+        return $factory->get($app);
1960
+    }
1961
+
1962
+    /**
1963
+     * @return \OCP\Lockdown\ILockdownManager
1964
+     */
1965
+    public function getLockdownManager() {
1966
+        return $this->query('LockdownManager');
1967
+    }
1968
+
1969
+    /**
1970
+     * @return \OCP\Federation\ICloudIdManager
1971
+     */
1972
+    public function getCloudIdManager() {
1973
+        return $this->query(ICloudIdManager::class);
1974
+    }
1975
+
1976
+    /**
1977
+     * @return \OCP\GlobalScale\IConfig
1978
+     */
1979
+    public function getGlobalScaleConfig() {
1980
+        return $this->query(IConfig::class);
1981
+    }
1982
+
1983
+    /**
1984
+     * @return \OCP\Federation\ICloudFederationProviderManager
1985
+     */
1986
+    public function getCloudFederationProviderManager() {
1987
+        return $this->query(ICloudFederationProviderManager::class);
1988
+    }
1989
+
1990
+    /**
1991
+     * @return \OCP\Remote\Api\IApiFactory
1992
+     */
1993
+    public function getRemoteApiFactory() {
1994
+        return $this->query(IApiFactory::class);
1995
+    }
1996
+
1997
+    /**
1998
+     * @return \OCP\Federation\ICloudFederationFactory
1999
+     */
2000
+    public function getCloudFederationFactory() {
2001
+        return $this->query(ICloudFederationFactory::class);
2002
+    }
2003
+
2004
+    /**
2005
+     * @return \OCP\Remote\IInstanceFactory
2006
+     */
2007
+    public function getRemoteInstanceFactory() {
2008
+        return $this->query(IInstanceFactory::class);
2009
+    }
2010 2010
 }
Please login to merge, or discard this patch.