@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if ($ex->getCode() === Http::STATUS_UNAUTHORIZED) { |
92 | 92 | // remote server revoked access to the address book, remove it |
93 | 93 | $this->backend->deleteAddressBook($addressBookId); |
94 | - $this->logger->info('Authorization failed, remove address book: ' . $url, ['app' => 'dav']); |
|
94 | + $this->logger->info('Authorization failed, remove address book: '.$url, ['app' => 'dav']); |
|
95 | 95 | throw $ex; |
96 | 96 | } |
97 | 97 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | */ |
144 | 144 | protected function requestSyncReport($url, $userName, $addressBookUrl, $sharedSecret, $syncToken) { |
145 | 145 | $settings = [ |
146 | - 'baseUri' => $url . '/', |
|
146 | + 'baseUri' => $url.'/', |
|
147 | 147 | 'userName' => $userName, |
148 | 148 | 'password' => $sharedSecret, |
149 | 149 | ]; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | */ |
256 | 256 | public function deleteUser($userOrCardId) { |
257 | 257 | $systemAddressBook = $this->getLocalSystemAddressBook(); |
258 | - if ($userOrCardId instanceof IUser){ |
|
258 | + if ($userOrCardId instanceof IUser) { |
|
259 | 259 | $name = $userOrCardId->getBackendClassName(); |
260 | 260 | $userId = $userOrCardId->getUID(); |
261 | 261 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | if (is_null($this->localSystemAddressBook)) { |
272 | 272 | $systemPrincipal = "principals/system/system"; |
273 | 273 | $this->localSystemAddressBook = $this->ensureSystemAddressBookExists($systemPrincipal, 'system', [ |
274 | - '{' . Plugin::NS_CARDDAV . '}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
274 | + '{'.Plugin::NS_CARDDAV.'}addressbook-description' => 'System addressbook which holds all users of this instance' |
|
275 | 275 | ]); |
276 | 276 | } |
277 | 277 | |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | |
290 | 290 | // remove no longer existing |
291 | 291 | $allCards = $this->backend->getCards($systemAddressBook['id']); |
292 | - foreach($allCards as $card) { |
|
292 | + foreach ($allCards as $card) { |
|
293 | 293 | $vCard = Reader::read($card['carddata']); |
294 | 294 | $uid = $vCard->UID->getValue(); |
295 | 295 | // load backend and see if user exists |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @package OCA\Federation\Backgroundjob |
48 | 48 | */ |
49 | -class GetSharedSecret extends Job{ |
|
49 | +class GetSharedSecret extends Job { |
|
50 | 50 | |
51 | 51 | /** @var IClient */ |
52 | 52 | private $httpClient; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
156 | 156 | |
157 | 157 | // make sure that we have a well formated url |
158 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/') . $this->format; |
|
158 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/').$this->format; |
|
159 | 159 | |
160 | 160 | $result = null; |
161 | 161 | try { |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } catch (ClientException $e) { |
178 | 178 | $status = $e->getCode(); |
179 | 179 | if ($status === Http::STATUS_FORBIDDEN) { |
180 | - $this->logger->info($target . ' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
180 | + $this->logger->info($target.' refused to exchange a shared secret with you.', ['app' => 'federation']); |
|
181 | 181 | } else { |
182 | 182 | $this->logger->logException($e, ['app' => 'federation']); |
183 | 183 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | && $status !== Http::STATUS_FORBIDDEN |
193 | 193 | ) { |
194 | 194 | $this->retainJob = true; |
195 | - } else { |
|
195 | + } else { |
|
196 | 196 | // reset token if we received a valid response |
197 | 197 | $this->dbHandler->addToken($target, ''); |
198 | 198 | } |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | ); |
208 | 208 | } else { |
209 | 209 | $this->logger->error( |
210 | - 'remote server "' . $target . '"" does not return a valid shared secret', |
|
210 | + 'remote server "'.$target.'"" does not return a valid shared secret', |
|
211 | 211 | ['app' => 'federation'] |
212 | 212 | ); |
213 | 213 | $this->trustedServers->setServerStatus($target, TrustedServers::STATUS_FAILURE); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $endPoint = isset($endPoints['shared-secret']) ? $endPoints['shared-secret'] : $this->defaultEndPoint; |
156 | 156 | |
157 | 157 | // make sure that we have a well formated url |
158 | - $url = rtrim($target, '/') . '/' . trim($endPoint, '/') . $this->format; |
|
158 | + $url = rtrim($target, '/').'/'.trim($endPoint, '/').$this->format; |
|
159 | 159 | |
160 | 160 | try { |
161 | 161 | $result = $this->httpClient->post( |
@@ -175,7 +175,7 @@ discard block |
||
175 | 175 | } catch (ClientException $e) { |
176 | 176 | $status = $e->getCode(); |
177 | 177 | if ($status === Http::STATUS_FORBIDDEN) { |
178 | - $this->logger->info($target . ' refused to ask for a shared secret.', ['app' => 'federation']); |
|
178 | + $this->logger->info($target.' refused to ask for a shared secret.', ['app' => 'federation']); |
|
179 | 179 | } else { |
180 | 180 | $this->logger->logException($e, ['app' => 'federation']); |
181 | 181 | } |
@@ -120,11 +120,11 @@ discard block |
||
120 | 120 | parent::__construct(); |
121 | 121 | $this->webRoot = $webRoot; |
122 | 122 | |
123 | - $this->registerService('ContactsManager', function ($c) { |
|
123 | + $this->registerService('ContactsManager', function($c) { |
|
124 | 124 | return new ContactsManager(); |
125 | 125 | }); |
126 | 126 | |
127 | - $this->registerService('PreviewManager', function (Server $c) { |
|
127 | + $this->registerService('PreviewManager', function(Server $c) { |
|
128 | 128 | return new PreviewManager( |
129 | 129 | $c->getConfig(), |
130 | 130 | $c->getRootFolder(), |
@@ -134,17 +134,17 @@ discard block |
||
134 | 134 | ); |
135 | 135 | }); |
136 | 136 | |
137 | - $this->registerService('OCSDiscoveryService', function (Server $c) { |
|
137 | + $this->registerService('OCSDiscoveryService', function(Server $c) { |
|
138 | 138 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
139 | 139 | ; }); |
140 | 140 | |
141 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
141 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
142 | 142 | return new \OC\Preview\Watcher( |
143 | 143 | $c->getAppDataDir('preview') |
144 | 144 | ); |
145 | 145 | }); |
146 | 146 | |
147 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
147 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
148 | 148 | $view = new View(); |
149 | 149 | $util = new Encryption\Util( |
150 | 150 | $view, |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | ); |
163 | 163 | }); |
164 | 164 | |
165 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
165 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
166 | 166 | $util = new Encryption\Util( |
167 | 167 | new View(), |
168 | 168 | $c->getUserManager(), |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return new Encryption\File($util); |
173 | 173 | }); |
174 | 174 | |
175 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
175 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
176 | 176 | $view = new View(); |
177 | 177 | $util = new Encryption\Util( |
178 | 178 | $view, |
@@ -183,27 +183,27 @@ discard block |
||
183 | 183 | |
184 | 184 | return new Encryption\Keys\Storage($view, $util); |
185 | 185 | }); |
186 | - $this->registerService('TagMapper', function (Server $c) { |
|
186 | + $this->registerService('TagMapper', function(Server $c) { |
|
187 | 187 | return new TagMapper($c->getDatabaseConnection()); |
188 | 188 | }); |
189 | - $this->registerService('TagManager', function (Server $c) { |
|
189 | + $this->registerService('TagManager', function(Server $c) { |
|
190 | 190 | $tagMapper = $c->query('TagMapper'); |
191 | 191 | return new TagManager($tagMapper, $c->getUserSession()); |
192 | 192 | }); |
193 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
193 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
194 | 194 | $config = $c->getConfig(); |
195 | 195 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', '\OC\SystemTag\ManagerFactory'); |
196 | 196 | /** @var \OC\SystemTag\ManagerFactory $factory */ |
197 | 197 | $factory = new $factoryClass($this); |
198 | 198 | return $factory; |
199 | 199 | }); |
200 | - $this->registerService('SystemTagManager', function (Server $c) { |
|
200 | + $this->registerService('SystemTagManager', function(Server $c) { |
|
201 | 201 | return $c->query('SystemTagManagerFactory')->getManager(); |
202 | 202 | }); |
203 | - $this->registerService('SystemTagObjectMapper', function (Server $c) { |
|
203 | + $this->registerService('SystemTagObjectMapper', function(Server $c) { |
|
204 | 204 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
205 | 205 | }); |
206 | - $this->registerService('RootFolder', function (Server $c) { |
|
206 | + $this->registerService('RootFolder', function(Server $c) { |
|
207 | 207 | $manager = \OC\Files\Filesystem::getMountManager(null); |
208 | 208 | $view = new View(); |
209 | 209 | $root = new Root( |
@@ -227,28 +227,28 @@ discard block |
||
227 | 227 | return $c->query('RootFolder'); |
228 | 228 | }); |
229 | 229 | }); |
230 | - $this->registerService('UserManager', function (Server $c) { |
|
230 | + $this->registerService('UserManager', function(Server $c) { |
|
231 | 231 | $config = $c->getConfig(); |
232 | 232 | return new \OC\User\Manager($config); |
233 | 233 | }); |
234 | - $this->registerService('GroupManager', function (Server $c) { |
|
234 | + $this->registerService('GroupManager', function(Server $c) { |
|
235 | 235 | $groupManager = new \OC\Group\Manager($this->getUserManager()); |
236 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
236 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
237 | 237 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
238 | 238 | }); |
239 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
239 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
240 | 240 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
241 | 241 | }); |
242 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
242 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
243 | 243 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
244 | 244 | }); |
245 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
245 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
246 | 246 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
247 | 247 | }); |
248 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
248 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
249 | 249 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
250 | 250 | }); |
251 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
251 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
252 | 252 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
253 | 253 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
254 | 254 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -266,11 +266,11 @@ discard block |
||
266 | 266 | return new Store($session, $logger, $tokenProvider); |
267 | 267 | }); |
268 | 268 | $this->registerAlias(IStore::class, Store::class); |
269 | - $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function (Server $c) { |
|
269 | + $this->registerService('OC\Authentication\Token\DefaultTokenMapper', function(Server $c) { |
|
270 | 270 | $dbConnection = $c->getDatabaseConnection(); |
271 | 271 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
272 | 272 | }); |
273 | - $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function (Server $c) { |
|
273 | + $this->registerService('OC\Authentication\Token\DefaultTokenProvider', function(Server $c) { |
|
274 | 274 | $mapper = $c->query('OC\Authentication\Token\DefaultTokenMapper'); |
275 | 275 | $crypto = $c->getCrypto(); |
276 | 276 | $config = $c->getConfig(); |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | return new \OC\Authentication\Token\DefaultTokenProvider($mapper, $crypto, $config, $logger, $timeFactory); |
280 | 280 | }); |
281 | 281 | $this->registerAlias('OC\Authentication\Token\IProvider', 'OC\Authentication\Token\DefaultTokenProvider'); |
282 | - $this->registerService('UserSession', function (Server $c) { |
|
282 | + $this->registerService('UserSession', function(Server $c) { |
|
283 | 283 | $manager = $c->getUserManager(); |
284 | 284 | $session = new \OC\Session\Memory(''); |
285 | 285 | $timeFactory = new TimeFactory(); |
@@ -292,69 +292,69 @@ discard block |
||
292 | 292 | } |
293 | 293 | |
294 | 294 | $userSession = new \OC\User\Session($manager, $session, $timeFactory, $defaultTokenProvider, $c->getConfig(), $c->getSecureRandom()); |
295 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
295 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
296 | 296 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
297 | 297 | }); |
298 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
298 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
299 | 299 | /** @var $user \OC\User\User */ |
300 | 300 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
301 | 301 | }); |
302 | - $userSession->listen('\OC\User', 'preDelete', function ($user) { |
|
302 | + $userSession->listen('\OC\User', 'preDelete', function($user) { |
|
303 | 303 | /** @var $user \OC\User\User */ |
304 | 304 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
305 | 305 | }); |
306 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
306 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
307 | 307 | /** @var $user \OC\User\User */ |
308 | 308 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
309 | 309 | }); |
310 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
310 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
311 | 311 | /** @var $user \OC\User\User */ |
312 | 312 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
313 | 313 | }); |
314 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
314 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
315 | 315 | /** @var $user \OC\User\User */ |
316 | 316 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
317 | 317 | }); |
318 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
318 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
319 | 319 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
320 | 320 | }); |
321 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
321 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
322 | 322 | /** @var $user \OC\User\User */ |
323 | 323 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
324 | 324 | }); |
325 | - $userSession->listen('\OC\User', 'logout', function () { |
|
325 | + $userSession->listen('\OC\User', 'logout', function() { |
|
326 | 326 | \OC_Hook::emit('OC_User', 'logout', array()); |
327 | 327 | }); |
328 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) { |
|
328 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value) { |
|
329 | 329 | /** @var $user \OC\User\User */ |
330 | 330 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value)); |
331 | 331 | }); |
332 | 332 | return $userSession; |
333 | 333 | }); |
334 | 334 | |
335 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
335 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
336 | 336 | return new \OC\Authentication\TwoFactorAuth\Manager($c->getAppManager(), $c->getSession(), $c->getConfig(), $c->getActivityManager(), $c->getLogger()); |
337 | 337 | }); |
338 | 338 | |
339 | - $this->registerService('NavigationManager', function (Server $c) { |
|
339 | + $this->registerService('NavigationManager', function(Server $c) { |
|
340 | 340 | return new \OC\NavigationManager($c->getAppManager(), |
341 | 341 | $c->getURLGenerator(), |
342 | 342 | $c->getL10NFactory(), |
343 | 343 | $c->getUserSession(), |
344 | 344 | $c->getGroupManager()); |
345 | 345 | }); |
346 | - $this->registerService('AllConfig', function (Server $c) { |
|
346 | + $this->registerService('AllConfig', function(Server $c) { |
|
347 | 347 | return new \OC\AllConfig( |
348 | 348 | $c->getSystemConfig() |
349 | 349 | ); |
350 | 350 | }); |
351 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
351 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
352 | 352 | return new \OC\SystemConfig($config); |
353 | 353 | }); |
354 | - $this->registerService('AppConfig', function (Server $c) { |
|
354 | + $this->registerService('AppConfig', function(Server $c) { |
|
355 | 355 | return new \OC\AppConfig($c->getDatabaseConnection()); |
356 | 356 | }); |
357 | - $this->registerService('L10NFactory', function (Server $c) { |
|
357 | + $this->registerService('L10NFactory', function(Server $c) { |
|
358 | 358 | return new \OC\L10N\Factory( |
359 | 359 | $c->getConfig(), |
360 | 360 | $c->getRequest(), |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | \OC::$SERVERROOT |
363 | 363 | ); |
364 | 364 | }); |
365 | - $this->registerService('URLGenerator', function (Server $c) { |
|
365 | + $this->registerService('URLGenerator', function(Server $c) { |
|
366 | 366 | $config = $c->getConfig(); |
367 | 367 | $cacheFactory = $c->getMemCacheFactory(); |
368 | 368 | return new \OC\URLGenerator( |
@@ -370,10 +370,10 @@ discard block |
||
370 | 370 | $cacheFactory |
371 | 371 | ); |
372 | 372 | }); |
373 | - $this->registerService('AppHelper', function ($c) { |
|
373 | + $this->registerService('AppHelper', function($c) { |
|
374 | 374 | return new \OC\AppHelper(); |
375 | 375 | }); |
376 | - $this->registerService('AppFetcher', function ($c) { |
|
376 | + $this->registerService('AppFetcher', function($c) { |
|
377 | 377 | return new AppFetcher( |
378 | 378 | $this->getAppDataDir('appstore'), |
379 | 379 | $this->getHTTPClientService(), |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | $this->getConfig() |
382 | 382 | ); |
383 | 383 | }); |
384 | - $this->registerService('CategoryFetcher', function ($c) { |
|
384 | + $this->registerService('CategoryFetcher', function($c) { |
|
385 | 385 | return new CategoryFetcher( |
386 | 386 | $this->getAppDataDir('appstore'), |
387 | 387 | $this->getHTTPClientService(), |
@@ -389,19 +389,19 @@ discard block |
||
389 | 389 | $this->getConfig() |
390 | 390 | ); |
391 | 391 | }); |
392 | - $this->registerService('UserCache', function ($c) { |
|
392 | + $this->registerService('UserCache', function($c) { |
|
393 | 393 | return new Cache\File(); |
394 | 394 | }); |
395 | - $this->registerService('MemCacheFactory', function (Server $c) { |
|
395 | + $this->registerService('MemCacheFactory', function(Server $c) { |
|
396 | 396 | $config = $c->getConfig(); |
397 | 397 | |
398 | 398 | if ($config->getSystemValue('installed', false) && !(defined('PHPUNIT_RUN') && PHPUNIT_RUN)) { |
399 | 399 | $v = \OC_App::getAppVersions(); |
400 | - $v['core'] = md5(file_get_contents(\OC::$SERVERROOT . '/version.php')); |
|
400 | + $v['core'] = md5(file_get_contents(\OC::$SERVERROOT.'/version.php')); |
|
401 | 401 | $version = implode(',', $v); |
402 | 402 | $instanceId = \OC_Util::getInstanceId(); |
403 | 403 | $path = \OC::$SERVERROOT; |
404 | - $prefix = md5($instanceId . '-' . $version . '-' . $path . '-' . \OC::$WEBROOT); |
|
404 | + $prefix = md5($instanceId.'-'.$version.'-'.$path.'-'.\OC::$WEBROOT); |
|
405 | 405 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
406 | 406 | $config->getSystemValue('memcache.local', null), |
407 | 407 | $config->getSystemValue('memcache.distributed', null), |
@@ -415,11 +415,11 @@ discard block |
||
415 | 415 | '\\OC\\Memcache\\ArrayCache' |
416 | 416 | ); |
417 | 417 | }); |
418 | - $this->registerService('RedisFactory', function (Server $c) { |
|
418 | + $this->registerService('RedisFactory', function(Server $c) { |
|
419 | 419 | $systemConfig = $c->getSystemConfig(); |
420 | 420 | return new RedisFactory($systemConfig); |
421 | 421 | }); |
422 | - $this->registerService('ActivityManager', function (Server $c) { |
|
422 | + $this->registerService('ActivityManager', function(Server $c) { |
|
423 | 423 | return new \OC\Activity\Manager( |
424 | 424 | $c->getRequest(), |
425 | 425 | $c->getUserSession(), |
@@ -427,13 +427,13 @@ discard block |
||
427 | 427 | $c->query(IValidator::class) |
428 | 428 | ); |
429 | 429 | }); |
430 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
430 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
431 | 431 | return new \OC\Activity\EventMerger( |
432 | 432 | $c->getL10N('lib') |
433 | 433 | ); |
434 | 434 | }); |
435 | 435 | $this->registerAlias(IValidator::class, Validator::class); |
436 | - $this->registerService('AvatarManager', function (Server $c) { |
|
436 | + $this->registerService('AvatarManager', function(Server $c) { |
|
437 | 437 | return new AvatarManager( |
438 | 438 | $c->getUserManager(), |
439 | 439 | $c->getAppDataDir('avatar'), |
@@ -442,14 +442,14 @@ discard block |
||
442 | 442 | $c->getConfig() |
443 | 443 | ); |
444 | 444 | }); |
445 | - $this->registerService('Logger', function (Server $c) { |
|
445 | + $this->registerService('Logger', function(Server $c) { |
|
446 | 446 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
447 | 447 | $logger = Log::getLogClass($logType); |
448 | 448 | call_user_func(array($logger, 'init')); |
449 | 449 | |
450 | 450 | return new Log($logger); |
451 | 451 | }); |
452 | - $this->registerService('JobList', function (Server $c) { |
|
452 | + $this->registerService('JobList', function(Server $c) { |
|
453 | 453 | $config = $c->getConfig(); |
454 | 454 | return new \OC\BackgroundJob\JobList( |
455 | 455 | $c->getDatabaseConnection(), |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | new TimeFactory() |
458 | 458 | ); |
459 | 459 | }); |
460 | - $this->registerService('Router', function (Server $c) { |
|
460 | + $this->registerService('Router', function(Server $c) { |
|
461 | 461 | $cacheFactory = $c->getMemCacheFactory(); |
462 | 462 | $logger = $c->getLogger(); |
463 | 463 | if ($cacheFactory->isAvailable()) { |
@@ -467,22 +467,22 @@ discard block |
||
467 | 467 | } |
468 | 468 | return $router; |
469 | 469 | }); |
470 | - $this->registerService('Search', function ($c) { |
|
470 | + $this->registerService('Search', function($c) { |
|
471 | 471 | return new Search(); |
472 | 472 | }); |
473 | - $this->registerService('SecureRandom', function ($c) { |
|
473 | + $this->registerService('SecureRandom', function($c) { |
|
474 | 474 | return new SecureRandom(); |
475 | 475 | }); |
476 | - $this->registerService('Crypto', function (Server $c) { |
|
476 | + $this->registerService('Crypto', function(Server $c) { |
|
477 | 477 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
478 | 478 | }); |
479 | - $this->registerService('Hasher', function (Server $c) { |
|
479 | + $this->registerService('Hasher', function(Server $c) { |
|
480 | 480 | return new Hasher($c->getConfig()); |
481 | 481 | }); |
482 | - $this->registerService('CredentialsManager', function (Server $c) { |
|
482 | + $this->registerService('CredentialsManager', function(Server $c) { |
|
483 | 483 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
484 | 484 | }); |
485 | - $this->registerService('DatabaseConnection', function (Server $c) { |
|
485 | + $this->registerService('DatabaseConnection', function(Server $c) { |
|
486 | 486 | $systemConfig = $c->getSystemConfig(); |
487 | 487 | $factory = new \OC\DB\ConnectionFactory($c->getConfig()); |
488 | 488 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -494,14 +494,14 @@ discard block |
||
494 | 494 | $connection->getConfiguration()->setSQLLogger($c->getQueryLogger()); |
495 | 495 | return $connection; |
496 | 496 | }); |
497 | - $this->registerService('HTTPHelper', function (Server $c) { |
|
497 | + $this->registerService('HTTPHelper', function(Server $c) { |
|
498 | 498 | $config = $c->getConfig(); |
499 | 499 | return new HTTPHelper( |
500 | 500 | $config, |
501 | 501 | $c->getHTTPClientService() |
502 | 502 | ); |
503 | 503 | }); |
504 | - $this->registerService('HttpClientService', function (Server $c) { |
|
504 | + $this->registerService('HttpClientService', function(Server $c) { |
|
505 | 505 | $user = \OC_User::getUser(); |
506 | 506 | $uid = $user ? $user : null; |
507 | 507 | return new ClientService( |
@@ -509,27 +509,27 @@ discard block |
||
509 | 509 | new \OC\Security\CertificateManager($uid, new View(), $c->getConfig(), $c->getLogger()) |
510 | 510 | ); |
511 | 511 | }); |
512 | - $this->registerService('EventLogger', function (Server $c) { |
|
512 | + $this->registerService('EventLogger', function(Server $c) { |
|
513 | 513 | if ($c->getSystemConfig()->getValue('debug', false)) { |
514 | 514 | return new EventLogger(); |
515 | 515 | } else { |
516 | 516 | return new NullEventLogger(); |
517 | 517 | } |
518 | 518 | }); |
519 | - $this->registerService('QueryLogger', function (Server $c) { |
|
519 | + $this->registerService('QueryLogger', function(Server $c) { |
|
520 | 520 | if ($c->getSystemConfig()->getValue('debug', false)) { |
521 | 521 | return new QueryLogger(); |
522 | 522 | } else { |
523 | 523 | return new NullQueryLogger(); |
524 | 524 | } |
525 | 525 | }); |
526 | - $this->registerService('TempManager', function (Server $c) { |
|
526 | + $this->registerService('TempManager', function(Server $c) { |
|
527 | 527 | return new TempManager( |
528 | 528 | $c->getLogger(), |
529 | 529 | $c->getConfig() |
530 | 530 | ); |
531 | 531 | }); |
532 | - $this->registerService('AppManager', function (Server $c) { |
|
532 | + $this->registerService('AppManager', function(Server $c) { |
|
533 | 533 | return new \OC\App\AppManager( |
534 | 534 | $c->getUserSession(), |
535 | 535 | $c->getAppConfig(), |
@@ -538,13 +538,13 @@ discard block |
||
538 | 538 | $c->getEventDispatcher() |
539 | 539 | ); |
540 | 540 | }); |
541 | - $this->registerService('DateTimeZone', function (Server $c) { |
|
541 | + $this->registerService('DateTimeZone', function(Server $c) { |
|
542 | 542 | return new DateTimeZone( |
543 | 543 | $c->getConfig(), |
544 | 544 | $c->getSession() |
545 | 545 | ); |
546 | 546 | }); |
547 | - $this->registerService('DateTimeFormatter', function (Server $c) { |
|
547 | + $this->registerService('DateTimeFormatter', function(Server $c) { |
|
548 | 548 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
549 | 549 | |
550 | 550 | return new DateTimeFormatter( |
@@ -552,16 +552,16 @@ discard block |
||
552 | 552 | $c->getL10N('lib', $language) |
553 | 553 | ); |
554 | 554 | }); |
555 | - $this->registerService('UserMountCache', function (Server $c) { |
|
555 | + $this->registerService('UserMountCache', function(Server $c) { |
|
556 | 556 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
557 | 557 | $listener = new UserMountCacheListener($mountCache); |
558 | 558 | $listener->listen($c->getUserManager()); |
559 | 559 | return $mountCache; |
560 | 560 | }); |
561 | - $this->registerService('MountConfigManager', function (Server $c) { |
|
561 | + $this->registerService('MountConfigManager', function(Server $c) { |
|
562 | 562 | $loader = \OC\Files\Filesystem::getLoader(); |
563 | 563 | $mountCache = $c->query('UserMountCache'); |
564 | - $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
564 | + $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
|
565 | 565 | |
566 | 566 | // builtin providers |
567 | 567 | |
@@ -572,14 +572,14 @@ discard block |
||
572 | 572 | |
573 | 573 | return $manager; |
574 | 574 | }); |
575 | - $this->registerService('IniWrapper', function ($c) { |
|
575 | + $this->registerService('IniWrapper', function($c) { |
|
576 | 576 | return new IniGetWrapper(); |
577 | 577 | }); |
578 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
578 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
579 | 579 | $jobList = $c->getJobList(); |
580 | 580 | return new AsyncBus($jobList); |
581 | 581 | }); |
582 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
582 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
583 | 583 | return new TrustedDomainHelper($this->getConfig()); |
584 | 584 | }); |
585 | 585 | $this->registerService('Throttler', function(Server $c) { |
@@ -590,10 +590,10 @@ discard block |
||
590 | 590 | $c->getConfig() |
591 | 591 | ); |
592 | 592 | }); |
593 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
593 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
594 | 594 | // IConfig and IAppManager requires a working database. This code |
595 | 595 | // might however be called when ownCloud is not yet setup. |
596 | - if(\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
596 | + if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
|
597 | 597 | $config = $c->getConfig(); |
598 | 598 | $appManager = $c->getAppManager(); |
599 | 599 | } else { |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $c->getTempManager() |
612 | 612 | ); |
613 | 613 | }); |
614 | - $this->registerService('Request', function ($c) { |
|
614 | + $this->registerService('Request', function($c) { |
|
615 | 615 | if (isset($this['urlParams'])) { |
616 | 616 | $urlParams = $this['urlParams']; |
617 | 617 | } else { |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | $stream |
646 | 646 | ); |
647 | 647 | }); |
648 | - $this->registerService('Mailer', function (Server $c) { |
|
648 | + $this->registerService('Mailer', function(Server $c) { |
|
649 | 649 | return new Mailer( |
650 | 650 | $c->getConfig(), |
651 | 651 | $c->getLogger(), |
@@ -655,14 +655,14 @@ discard block |
||
655 | 655 | $this->registerService('LDAPProvider', function(Server $c) { |
656 | 656 | $config = $c->getConfig(); |
657 | 657 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
658 | - if(is_null($factoryClass)) { |
|
658 | + if (is_null($factoryClass)) { |
|
659 | 659 | throw new \Exception('ldapProviderFactory not set'); |
660 | 660 | } |
661 | 661 | /** @var \OCP\LDAP\ILDAPProviderFactory $factory */ |
662 | 662 | $factory = new $factoryClass($this); |
663 | 663 | return $factory->getLDAPProvider(); |
664 | 664 | }); |
665 | - $this->registerService('LockingProvider', function (Server $c) { |
|
665 | + $this->registerService('LockingProvider', function(Server $c) { |
|
666 | 666 | $ini = $c->getIniWrapper(); |
667 | 667 | $config = $c->getConfig(); |
668 | 668 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -677,29 +677,29 @@ discard block |
||
677 | 677 | } |
678 | 678 | return new NoopLockingProvider(); |
679 | 679 | }); |
680 | - $this->registerService('MountManager', function () { |
|
680 | + $this->registerService('MountManager', function() { |
|
681 | 681 | return new \OC\Files\Mount\Manager(); |
682 | 682 | }); |
683 | - $this->registerService('MimeTypeDetector', function (Server $c) { |
|
683 | + $this->registerService('MimeTypeDetector', function(Server $c) { |
|
684 | 684 | return new \OC\Files\Type\Detection( |
685 | 685 | $c->getURLGenerator(), |
686 | 686 | \OC::$configDir, |
687 | - \OC::$SERVERROOT . '/resources/config/' |
|
687 | + \OC::$SERVERROOT.'/resources/config/' |
|
688 | 688 | ); |
689 | 689 | }); |
690 | - $this->registerService('MimeTypeLoader', function (Server $c) { |
|
690 | + $this->registerService('MimeTypeLoader', function(Server $c) { |
|
691 | 691 | return new \OC\Files\Type\Loader( |
692 | 692 | $c->getDatabaseConnection() |
693 | 693 | ); |
694 | 694 | }); |
695 | - $this->registerService('NotificationManager', function (Server $c) { |
|
695 | + $this->registerService('NotificationManager', function(Server $c) { |
|
696 | 696 | return new Manager( |
697 | 697 | $c->query(IValidator::class) |
698 | 698 | ); |
699 | 699 | }); |
700 | - $this->registerService('CapabilitiesManager', function (Server $c) { |
|
700 | + $this->registerService('CapabilitiesManager', function(Server $c) { |
|
701 | 701 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
702 | - $manager->registerCapability(function () use ($c) { |
|
702 | + $manager->registerCapability(function() use ($c) { |
|
703 | 703 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
704 | 704 | }); |
705 | 705 | return $manager; |
@@ -737,10 +737,10 @@ discard block |
||
737 | 737 | } |
738 | 738 | return new \OC_Defaults(); |
739 | 739 | }); |
740 | - $this->registerService('EventDispatcher', function () { |
|
740 | + $this->registerService('EventDispatcher', function() { |
|
741 | 741 | return new EventDispatcher(); |
742 | 742 | }); |
743 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
743 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
744 | 744 | // FIXME: Instantiiated here due to cyclic dependency |
745 | 745 | $request = new Request( |
746 | 746 | [ |
@@ -765,7 +765,7 @@ discard block |
||
765 | 765 | $request |
766 | 766 | ); |
767 | 767 | }); |
768 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
768 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
769 | 769 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
770 | 770 | |
771 | 771 | return new CsrfTokenManager( |
@@ -773,10 +773,10 @@ discard block |
||
773 | 773 | $c->query(SessionStorage::class) |
774 | 774 | ); |
775 | 775 | }); |
776 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
776 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
777 | 777 | return new SessionStorage($c->getSession()); |
778 | 778 | }); |
779 | - $this->registerService('ContentSecurityPolicyManager', function (Server $c) { |
|
779 | + $this->registerService('ContentSecurityPolicyManager', function(Server $c) { |
|
780 | 780 | return new ContentSecurityPolicyManager(); |
781 | 781 | }); |
782 | 782 | $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
@@ -821,23 +821,23 @@ discard block |
||
821 | 821 | ); |
822 | 822 | return $manager; |
823 | 823 | }); |
824 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
824 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
825 | 825 | return new \OC\Files\AppData\Factory( |
826 | 826 | $c->getRootFolder(), |
827 | 827 | $c->getSystemConfig() |
828 | 828 | ); |
829 | 829 | }); |
830 | 830 | |
831 | - $this->registerService('LockdownManager', function (Server $c) { |
|
831 | + $this->registerService('LockdownManager', function(Server $c) { |
|
832 | 832 | return new LockdownManager(); |
833 | 833 | }); |
834 | 834 | |
835 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
835 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
836 | 836 | return new CloudIdManager(); |
837 | 837 | }); |
838 | 838 | |
839 | 839 | /* To trick DI since we don't extend the DIContainer here */ |
840 | - $this->registerService(CleanPreviewsBackgroundJob::class, function (Server $c) { |
|
840 | + $this->registerService(CleanPreviewsBackgroundJob::class, function(Server $c) { |
|
841 | 841 | return new CleanPreviewsBackgroundJob( |
842 | 842 | $c->getRootFolder(), |
843 | 843 | $c->getLogger(), |
@@ -989,7 +989,7 @@ discard block |
||
989 | 989 | * @deprecated since 9.2.0 use IAppData |
990 | 990 | */ |
991 | 991 | public function getAppFolder() { |
992 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
992 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
993 | 993 | $root = $this->getRootFolder(); |
994 | 994 | if (!$root->nodeExists($dir)) { |
995 | 995 | $folder = $root->newFolder($dir); |
@@ -60,18 +60,18 @@ discard block |
||
60 | 60 | */ |
61 | 61 | public function discover($remote, $service) { |
62 | 62 | // Check the cache first |
63 | - $cacheData = $this->cache->get($remote . '#' . $service); |
|
64 | - if($cacheData) { |
|
63 | + $cacheData = $this->cache->get($remote.'#'.$service); |
|
64 | + if ($cacheData) { |
|
65 | 65 | return json_decode($cacheData, true); |
66 | 66 | } |
67 | 67 | |
68 | 68 | // query the remote server for available services |
69 | 69 | try { |
70 | - $response = $this->client->get($remote . '/ocs-provider/', [ |
|
70 | + $response = $this->client->get($remote.'/ocs-provider/', [ |
|
71 | 71 | 'timeout' => 10, |
72 | 72 | 'connect_timeout' => 10, |
73 | 73 | ]); |
74 | - if($response->getStatusCode() === Http::STATUS_OK) { |
|
74 | + if ($response->getStatusCode() === Http::STATUS_OK) { |
|
75 | 75 | $decodedServices = json_decode($response->getBody(), true); |
76 | 76 | $discoveredServices = $this->getEndpoints($decodedServices, $service); |
77 | 77 | } |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | } |
82 | 82 | |
83 | 83 | // Write into cache |
84 | - $this->cache->set($remote . '#' . $service, json_encode($discoveredServices)); |
|
84 | + $this->cache->set($remote.'#'.$service, json_encode($discoveredServices)); |
|
85 | 85 | return $discoveredServices; |
86 | 86 | } |
87 | 87 | |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | |
97 | 97 | $discoveredServices = []; |
98 | 98 | |
99 | - if(is_array($decodedServices) && |
|
99 | + if (is_array($decodedServices) && |
|
100 | 100 | isset($decodedServices['services'][$service]['endpoints']) |
101 | 101 | ) { |
102 | 102 | foreach ($decodedServices['services'][$service]['endpoints'] as $endpoint => $url) { |
103 | - if($this->isSafeUrl($url)) { |
|
103 | + if ($this->isSafeUrl($url)) { |
|
104 | 104 | $discoveredServices[$endpoint] = $url; |
105 | 105 | } |
106 | 106 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * @return bool |
118 | 118 | */ |
119 | 119 | private function isSafeUrl($url) { |
120 | - return (bool)preg_match('/^[\/\.A-Za-z0-9]+$/', $url); |
|
120 | + return (bool) preg_match('/^[\/\.A-Za-z0-9]+$/', $url); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | } |