@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $owner = isset($_POST['owner']) ? $_POST['owner'] : null; |
| 146 | 146 | $sharedBy = isset($_POST['sharedBy']) ? $_POST['sharedBy'] : null; |
| 147 | 147 | $shareWith = isset($_POST['shareWith']) ? $_POST['shareWith'] : null; |
| 148 | - $remoteId = isset($_POST['remoteId']) ? (int)$_POST['remoteId'] : null; |
|
| 148 | + $remoteId = isset($_POST['remoteId']) ? (int) $_POST['remoteId'] : null; |
|
| 149 | 149 | $sharedByFederatedId = isset($_POST['sharedByFederatedId']) ? $_POST['sharedByFederatedId'] : null; |
| 150 | 150 | $ownerFederatedId = isset($_POST['ownerFederatedId']) ? $_POST['ownerFederatedId'] : null; |
| 151 | 151 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } catch (ProviderCouldNotAddShareException $e) { |
| 181 | 181 | throw new OCSException($e->getMessage(), 400); |
| 182 | 182 | } catch (\Exception $e) { |
| 183 | - throw new OCSException('internal server error, was not able to add share from ' . $remote, 500); |
|
| 183 | + throw new OCSException('internal server error, was not able to add share from '.$remote, 500); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | return new Http\DataResponse(); |
@@ -202,8 +202,8 @@ discard block |
||
| 202 | 202 | |
| 203 | 203 | $token = $this->request->getParam('token', null); |
| 204 | 204 | $shareWith = $this->request->getParam('shareWith', null); |
| 205 | - $permission = (int)$this->request->getParam('permission', null); |
|
| 206 | - $remoteId = (int)$this->request->getParam('remoteId', null); |
|
| 205 | + $permission = (int) $this->request->getParam('permission', null); |
|
| 206 | + $remoteId = (int) $this->request->getParam('remoteId', null); |
|
| 207 | 207 | |
| 208 | 208 | if ($id === null || |
| 209 | 209 | $token === null || |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | } catch (ProviderDoesNotExistsException $e) { |
| 232 | 232 | throw new OCSException('Server does not support federated cloud sharing', 503); |
| 233 | 233 | } catch (ShareNotFound $e) { |
| 234 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
| 234 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
| 235 | 235 | } catch (\Exception $e) { |
| 236 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
| 236 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | throw new OCSBadRequestException(); |
@@ -267,9 +267,9 @@ discard block |
||
| 267 | 267 | } catch (ProviderDoesNotExistsException $e) { |
| 268 | 268 | throw new OCSException('Server does not support federated cloud sharing', 503); |
| 269 | 269 | } catch (ShareNotFound $e) { |
| 270 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
| 270 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
| 271 | 271 | } catch (\Exception $e) { |
| 272 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
| 272 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | return new Http\DataResponse(); |
@@ -300,9 +300,9 @@ discard block |
||
| 300 | 300 | } catch (ProviderDoesNotExistsException $e) { |
| 301 | 301 | throw new OCSException('Server does not support federated cloud sharing', 503); |
| 302 | 302 | } catch (ShareNotFound $e) { |
| 303 | - $this->logger->debug('Share not found: ' . $e->getMessage()); |
|
| 303 | + $this->logger->debug('Share not found: '.$e->getMessage()); |
|
| 304 | 304 | } catch (\Exception $e) { |
| 305 | - $this->logger->debug('internal server error, can not process notification: ' . $e->getMessage()); |
|
| 305 | + $this->logger->debug('internal server error, can not process notification: '.$e->getMessage()); |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | return new Http\DataResponse(); |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $notification = ['sharedSecret' => $token]; |
| 332 | 332 | $provider->notificationReceived('SHARE_UNSHARED', $id, $notification); |
| 333 | 333 | } catch (\Exception $e) { |
| 334 | - $this->logger->debug('processing unshare notification failed: ' . $e->getMessage()); |
|
| 334 | + $this->logger->debug('processing unshare notification failed: '.$e->getMessage()); |
|
| 335 | 335 | } |
| 336 | 336 | |
| 337 | 337 | return new Http\DataResponse(); |
@@ -404,7 +404,7 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | try { |
| 406 | 406 | $provider = $this->cloudFederationProviderManager->getCloudFederationProvider('file'); |
| 407 | - $ocmPermissions = $this->ncPermissions2ocmPermissions((int)$ncPermissions); |
|
| 407 | + $ocmPermissions = $this->ncPermissions2ocmPermissions((int) $ncPermissions); |
|
| 408 | 408 | $notification = ['sharedSecret' => $token, 'permission' => $ocmPermissions]; |
| 409 | 409 | $provider->notificationReceived('RESHARE_CHANGE_PERMISSION', $id, $notification); |
| 410 | 410 | } catch (\Exception $e) { |
@@ -134,18 +134,18 @@ discard block |
||
| 134 | 134 | * @return Mount|null |
| 135 | 135 | * @throws \Doctrine\DBAL\DBALException |
| 136 | 136 | */ |
| 137 | - public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted=false, $user = null, $remoteId = -1, $parent = -1) { |
|
| 137 | + public function addShare($remote, $token, $password, $name, $owner, $shareType, $accepted = false, $user = null, $remoteId = -1, $parent = -1) { |
|
| 138 | 138 | |
| 139 | 139 | $user = $user ? $user : $this->uid; |
| 140 | 140 | $accepted = $accepted ? 1 : 0; |
| 141 | - $name = Filesystem::normalizePath('/' . $name); |
|
| 141 | + $name = Filesystem::normalizePath('/'.$name); |
|
| 142 | 142 | |
| 143 | 143 | if (!$accepted) { |
| 144 | 144 | // To avoid conflicts with the mount point generation later, |
| 145 | 145 | // we only use a temporary mount point name here. The real |
| 146 | 146 | // mount point name will be generated when accepting the share, |
| 147 | 147 | // using the original share item name. |
| 148 | - $tmpMountPointName = '{{TemporaryMountPointName#' . $name . '}}'; |
|
| 148 | + $tmpMountPointName = '{{TemporaryMountPointName#'.$name.'}}'; |
|
| 149 | 149 | $mountPoint = $tmpMountPointName; |
| 150 | 150 | $hash = md5($tmpMountPointName); |
| 151 | 151 | $data = [ |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | $i = 1; |
| 166 | 166 | while (!$this->connection->insertIfNotExist('*PREFIX*share_external', $data, ['user', 'mountpoint_hash'])) { |
| 167 | 167 | // The external share already exists for the user |
| 168 | - $data['mountpoint'] = $tmpMountPointName . '-' . $i; |
|
| 168 | + $data['mountpoint'] = $tmpMountPointName.'-'.$i; |
|
| 169 | 169 | $data['mountpoint_hash'] = md5($data['mountpoint']); |
| 170 | 170 | $i++; |
| 171 | 171 | } |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | $mountPoint = Files::buildNotExistingFileName('/', $name); |
| 176 | - $mountPoint = Filesystem::normalizePath('/' . $mountPoint); |
|
| 176 | + $mountPoint = Filesystem::normalizePath('/'.$mountPoint); |
|
| 177 | 177 | $hash = md5($mountPoint); |
| 178 | 178 | |
| 179 | 179 | $query = $this->connection->prepare(' |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $mountPoint = Filesystem::normalizePath($mountPoint); |
| 228 | 228 | $hash = md5($mountPoint); |
| 229 | 229 | |
| 230 | - if($share['share_type'] === \OCP\Share::SHARE_TYPE_USER) { |
|
| 230 | + if ($share['share_type'] === \OCP\Share::SHARE_TYPE_USER) { |
|
| 231 | 231 | $acceptShare = $this->connection->prepare(' |
| 232 | 232 | UPDATE `*PREFIX*share_external` |
| 233 | 233 | SET `accepted` = ?, |
@@ -298,14 +298,14 @@ discard block |
||
| 298 | 298 | |
| 299 | 299 | $result = $this->tryOCMEndPoint($remote, $token, $remoteId, $feedback); |
| 300 | 300 | |
| 301 | - if($result === true) { |
|
| 301 | + if ($result === true) { |
|
| 302 | 302 | return true; |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | $federationEndpoints = $this->discoveryService->discover($remote, 'FEDERATED_SHARING'); |
| 306 | 306 | $endpoint = isset($federationEndpoints['share']) ? $federationEndpoints['share'] : '/ocs/v2.php/cloud/shares'; |
| 307 | 307 | |
| 308 | - $url = rtrim($remote, '/') . $endpoint . '/' . $remoteId . '/' . $feedback . '?format=' . \OCP\Share::RESPONSE_FORMAT; |
|
| 308 | + $url = rtrim($remote, '/').$endpoint.'/'.$remoteId.'/'.$feedback.'?format='.\OCP\Share::RESPONSE_FORMAT; |
|
| 309 | 309 | $fields = array('token' => $token); |
| 310 | 310 | |
| 311 | 311 | $client = $this->clientService->newClient(); |
@@ -378,13 +378,13 @@ discard block |
||
| 378 | 378 | * @return string |
| 379 | 379 | */ |
| 380 | 380 | protected function stripPath($path) { |
| 381 | - $prefix = '/' . $this->uid . '/files'; |
|
| 381 | + $prefix = '/'.$this->uid.'/files'; |
|
| 382 | 382 | return rtrim(substr($path, strlen($prefix)), '/'); |
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | public function getMount($data) { |
| 386 | 386 | $data['manager'] = $this; |
| 387 | - $mountPoint = '/' . $this->uid . '/files' . $data['mountpoint']; |
|
| 387 | + $mountPoint = '/'.$this->uid.'/files'.$data['mountpoint']; |
|
| 388 | 388 | $data['mountpoint'] = $mountPoint; |
| 389 | 389 | $data['certificateManager'] = \OC::$server->getCertificateManager($this->uid); |
| 390 | 390 | return new Mount(self::STORAGE, $mountPoint, $data, $this, $this->storageLoader); |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | WHERE `mountpoint_hash` = ? |
| 425 | 425 | AND `user` = ? |
| 426 | 426 | '); |
| 427 | - $result = (bool)$query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
| 427 | + $result = (bool) $query->execute(array($target, $targetHash, $sourceHash, $this->uid)); |
|
| 428 | 428 | |
| 429 | 429 | return $result; |
| 430 | 430 | } |
@@ -459,9 +459,9 @@ discard block |
||
| 459 | 459 | WHERE `mountpoint_hash` = ? |
| 460 | 460 | AND `user` = ? |
| 461 | 461 | '); |
| 462 | - $result = (bool)$query->execute(array($hash, $this->uid)); |
|
| 462 | + $result = (bool) $query->execute(array($hash, $this->uid)); |
|
| 463 | 463 | |
| 464 | - if($result) { |
|
| 464 | + if ($result) { |
|
| 465 | 465 | $this->removeReShares($id); |
| 466 | 466 | } |
| 467 | 467 | |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | |
| 483 | 483 | |
| 484 | 484 | $query->delete('federated_reshares') |
| 485 | - ->where($query->expr()->in('share_id', $query->createFunction('(' . $select . ')'))); |
|
| 485 | + ->where($query->expr()->in('share_id', $query->createFunction('('.$select.')'))); |
|
| 486 | 486 | $query->execute(); |
| 487 | 487 | |
| 488 | 488 | $deleteReShares = $this->connection->getQueryBuilder(); |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | if ($result) { |
| 508 | 508 | $shares = $getShare->fetchAll(); |
| 509 | - foreach($shares as $share) { |
|
| 509 | + foreach ($shares as $share) { |
|
| 510 | 510 | $this->sendFeedbackToRemote($share['remote'], $share['share_token'], $share['remote_id'], 'decline'); |
| 511 | 511 | } |
| 512 | 512 | } |
@@ -515,7 +515,7 @@ discard block |
||
| 515 | 515 | DELETE FROM `*PREFIX*share_external` |
| 516 | 516 | WHERE `user` = ? |
| 517 | 517 | '); |
| 518 | - return (bool)$query->execute(array($uid)); |
|
| 518 | + return (bool) $query->execute(array($uid)); |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | /** |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | $supportedShareTypes = $this->config->getSupportedShareTypes($resourceType); |
| 146 | 146 | if (!in_array($shareType, $supportedShareTypes)) { |
| 147 | 147 | return new JSONResponse( |
| 148 | - ['message' => 'Share type "' . $shareType . '" not implemented'], |
|
| 148 | + ['message' => 'Share type "'.$shareType.'" not implemented'], |
|
| 149 | 149 | Http::STATUS_NOT_IMPLEMENTED |
| 150 | 150 | ); |
| 151 | 151 | } |
@@ -158,16 +158,16 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | if (!$this->userManager->userExists($shareWith)) { |
| 160 | 160 | return new JSONResponse( |
| 161 | - ['message' => 'User "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
| 161 | + ['message' => 'User "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
| 162 | 162 | Http::STATUS_BAD_REQUEST |
| 163 | 163 | ); |
| 164 | 164 | } |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | if ($shareType === 'group') { |
| 168 | - if(!$this->groupManager->groupExists($shareWithLocalId)) { |
|
| 168 | + if (!$this->groupManager->groupExists($shareWithLocalId)) { |
|
| 169 | 169 | return new JSONResponse( |
| 170 | - ['message' => 'Group "' . $shareWith . '" does not exists at ' . $this->urlGenerator->getBaseUrl()], |
|
| 170 | + ['message' => 'Group "'.$shareWith.'" does not exists at '.$this->urlGenerator->getBaseUrl()], |
|
| 171 | 171 | Http::STATUS_BAD_REQUEST |
| 172 | 172 | ); |
| 173 | 173 | } |
@@ -200,14 +200,14 @@ discard block |
||
| 200 | 200 | ); |
| 201 | 201 | } catch (\Exception $e) { |
| 202 | 202 | return new JSONResponse( |
| 203 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
| 203 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
| 204 | 204 | Http::STATUS_BAD_REQUEST |
| 205 | 205 | ); |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | $user = $this->userManager->get($shareWithLocalId); |
| 209 | 209 | $recipientDisplayName = ''; |
| 210 | - if($user) { |
|
| 210 | + if ($user) { |
|
| 211 | 211 | $recipientDisplayName = $user->getDisplayName(); |
| 212 | 212 | } |
| 213 | 213 | |
@@ -269,12 +269,12 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | catch (\Exception $e) { |
| 271 | 271 | return new JSONResponse( |
| 272 | - ['message' => 'Internal error at ' . $this->urlGenerator->getBaseUrl()], |
|
| 272 | + ['message' => 'Internal error at '.$this->urlGenerator->getBaseUrl()], |
|
| 273 | 273 | Http::STATUS_BAD_REQUEST |
| 274 | 274 | ); |
| 275 | 275 | } |
| 276 | 276 | |
| 277 | - return new JSONResponse($result,Http::STATUS_CREATED); |
|
| 277 | + return new JSONResponse($result, Http::STATUS_CREATED); |
|
| 278 | 278 | |
| 279 | 279 | } |
| 280 | 280 | |
@@ -287,13 +287,13 @@ discard block |
||
| 287 | 287 | private function mapUid($uid) { |
| 288 | 288 | \OC::$server->getURLGenerator()->linkToDocs('key'); |
| 289 | 289 | // FIXME this should be a method in the user management instead |
| 290 | - $this->logger->debug('shareWith before, ' . $uid, ['app' => $this->appName]); |
|
| 290 | + $this->logger->debug('shareWith before, '.$uid, ['app' => $this->appName]); |
|
| 291 | 291 | \OCP\Util::emitHook( |
| 292 | 292 | '\OCA\Files_Sharing\API\Server2Server', |
| 293 | 293 | 'preLoginNameUsedAsUserName', |
| 294 | 294 | array('uid' => &$uid) |
| 295 | 295 | ); |
| 296 | - $this->logger->debug('shareWith after, ' . $uid, ['app' => $this->appName]); |
|
| 296 | + $this->logger->debug('shareWith after, '.$uid, ['app' => $this->appName]); |
|
| 297 | 297 | |
| 298 | 298 | return $uid; |
| 299 | 299 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | // To find out if we are running from CLI or not |
| 173 | 173 | $this->registerParameter('isCLI', \OC::$CLI); |
| 174 | 174 | |
| 175 | - $this->registerService(\OCP\IServerContainer::class, function (IServerContainer $c) { |
|
| 175 | + $this->registerService(\OCP\IServerContainer::class, function(IServerContainer $c) { |
|
| 176 | 176 | return $c; |
| 177 | 177 | }); |
| 178 | 178 | |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $this->registerAlias(IActionFactory::class, ActionFactory::class); |
| 186 | 186 | |
| 187 | 187 | |
| 188 | - $this->registerService(\OCP\IPreview::class, function (Server $c) { |
|
| 188 | + $this->registerService(\OCP\IPreview::class, function(Server $c) { |
|
| 189 | 189 | return new PreviewManager( |
| 190 | 190 | $c->getConfig(), |
| 191 | 191 | $c->getRootFolder(), |
@@ -196,13 +196,13 @@ discard block |
||
| 196 | 196 | }); |
| 197 | 197 | $this->registerAlias('PreviewManager', \OCP\IPreview::class); |
| 198 | 198 | |
| 199 | - $this->registerService(\OC\Preview\Watcher::class, function (Server $c) { |
|
| 199 | + $this->registerService(\OC\Preview\Watcher::class, function(Server $c) { |
|
| 200 | 200 | return new \OC\Preview\Watcher( |
| 201 | 201 | $c->getAppDataDir('preview') |
| 202 | 202 | ); |
| 203 | 203 | }); |
| 204 | 204 | |
| 205 | - $this->registerService('EncryptionManager', function (Server $c) { |
|
| 205 | + $this->registerService('EncryptionManager', function(Server $c) { |
|
| 206 | 206 | $view = new View(); |
| 207 | 207 | $util = new Encryption\Util( |
| 208 | 208 | $view, |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | ); |
| 221 | 221 | }); |
| 222 | 222 | |
| 223 | - $this->registerService('EncryptionFileHelper', function (Server $c) { |
|
| 223 | + $this->registerService('EncryptionFileHelper', function(Server $c) { |
|
| 224 | 224 | $util = new Encryption\Util( |
| 225 | 225 | new View(), |
| 226 | 226 | $c->getUserManager(), |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | ); |
| 235 | 235 | }); |
| 236 | 236 | |
| 237 | - $this->registerService('EncryptionKeyStorage', function (Server $c) { |
|
| 237 | + $this->registerService('EncryptionKeyStorage', function(Server $c) { |
|
| 238 | 238 | $view = new View(); |
| 239 | 239 | $util = new Encryption\Util( |
| 240 | 240 | $view, |
@@ -245,30 +245,30 @@ discard block |
||
| 245 | 245 | |
| 246 | 246 | return new Encryption\Keys\Storage($view, $util); |
| 247 | 247 | }); |
| 248 | - $this->registerService('TagMapper', function (Server $c) { |
|
| 248 | + $this->registerService('TagMapper', function(Server $c) { |
|
| 249 | 249 | return new TagMapper($c->getDatabaseConnection()); |
| 250 | 250 | }); |
| 251 | 251 | |
| 252 | - $this->registerService(\OCP\ITagManager::class, function (Server $c) { |
|
| 252 | + $this->registerService(\OCP\ITagManager::class, function(Server $c) { |
|
| 253 | 253 | $tagMapper = $c->query('TagMapper'); |
| 254 | 254 | return new TagManager($tagMapper, $c->getUserSession()); |
| 255 | 255 | }); |
| 256 | 256 | $this->registerAlias('TagManager', \OCP\ITagManager::class); |
| 257 | 257 | |
| 258 | - $this->registerService('SystemTagManagerFactory', function (Server $c) { |
|
| 258 | + $this->registerService('SystemTagManagerFactory', function(Server $c) { |
|
| 259 | 259 | $config = $c->getConfig(); |
| 260 | 260 | $factoryClass = $config->getSystemValue('systemtags.managerFactory', SystemTagManagerFactory::class); |
| 261 | 261 | return new $factoryClass($this); |
| 262 | 262 | }); |
| 263 | - $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function (Server $c) { |
|
| 263 | + $this->registerService(\OCP\SystemTag\ISystemTagManager::class, function(Server $c) { |
|
| 264 | 264 | return $c->query('SystemTagManagerFactory')->getManager(); |
| 265 | 265 | }); |
| 266 | 266 | $this->registerAlias('SystemTagManager', \OCP\SystemTag\ISystemTagManager::class); |
| 267 | 267 | |
| 268 | - $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function (Server $c) { |
|
| 268 | + $this->registerService(\OCP\SystemTag\ISystemTagObjectMapper::class, function(Server $c) { |
|
| 269 | 269 | return $c->query('SystemTagManagerFactory')->getObjectMapper(); |
| 270 | 270 | }); |
| 271 | - $this->registerService('RootFolder', function (Server $c) { |
|
| 271 | + $this->registerService('RootFolder', function(Server $c) { |
|
| 272 | 272 | $manager = \OC\Files\Filesystem::getMountManager(null); |
| 273 | 273 | $view = new View(); |
| 274 | 274 | $root = new Root( |
@@ -289,38 +289,38 @@ discard block |
||
| 289 | 289 | }); |
| 290 | 290 | $this->registerAlias('SystemTagObjectMapper', \OCP\SystemTag\ISystemTagObjectMapper::class); |
| 291 | 291 | |
| 292 | - $this->registerService(\OCP\Files\IRootFolder::class, function (Server $c) { |
|
| 293 | - return new LazyRoot(function () use ($c) { |
|
| 292 | + $this->registerService(\OCP\Files\IRootFolder::class, function(Server $c) { |
|
| 293 | + return new LazyRoot(function() use ($c) { |
|
| 294 | 294 | return $c->query('RootFolder'); |
| 295 | 295 | }); |
| 296 | 296 | }); |
| 297 | 297 | $this->registerAlias('LazyRootFolder', \OCP\Files\IRootFolder::class); |
| 298 | 298 | |
| 299 | - $this->registerService(\OC\User\Manager::class, function (Server $c) { |
|
| 299 | + $this->registerService(\OC\User\Manager::class, function(Server $c) { |
|
| 300 | 300 | $config = $c->getConfig(); |
| 301 | 301 | return new \OC\User\Manager($config); |
| 302 | 302 | }); |
| 303 | 303 | $this->registerAlias('UserManager', \OC\User\Manager::class); |
| 304 | 304 | $this->registerAlias(\OCP\IUserManager::class, \OC\User\Manager::class); |
| 305 | 305 | |
| 306 | - $this->registerService(\OCP\IGroupManager::class, function (Server $c) { |
|
| 306 | + $this->registerService(\OCP\IGroupManager::class, function(Server $c) { |
|
| 307 | 307 | $groupManager = new \OC\Group\Manager($this->getUserManager(), $this->getLogger()); |
| 308 | - $groupManager->listen('\OC\Group', 'preCreate', function ($gid) { |
|
| 308 | + $groupManager->listen('\OC\Group', 'preCreate', function($gid) { |
|
| 309 | 309 | \OC_Hook::emit('OC_Group', 'pre_createGroup', array('run' => true, 'gid' => $gid)); |
| 310 | 310 | }); |
| 311 | - $groupManager->listen('\OC\Group', 'postCreate', function (\OC\Group\Group $gid) { |
|
| 311 | + $groupManager->listen('\OC\Group', 'postCreate', function(\OC\Group\Group $gid) { |
|
| 312 | 312 | \OC_Hook::emit('OC_User', 'post_createGroup', array('gid' => $gid->getGID())); |
| 313 | 313 | }); |
| 314 | - $groupManager->listen('\OC\Group', 'preDelete', function (\OC\Group\Group $group) { |
|
| 314 | + $groupManager->listen('\OC\Group', 'preDelete', function(\OC\Group\Group $group) { |
|
| 315 | 315 | \OC_Hook::emit('OC_Group', 'pre_deleteGroup', array('run' => true, 'gid' => $group->getGID())); |
| 316 | 316 | }); |
| 317 | - $groupManager->listen('\OC\Group', 'postDelete', function (\OC\Group\Group $group) { |
|
| 317 | + $groupManager->listen('\OC\Group', 'postDelete', function(\OC\Group\Group $group) { |
|
| 318 | 318 | \OC_Hook::emit('OC_User', 'post_deleteGroup', array('gid' => $group->getGID())); |
| 319 | 319 | }); |
| 320 | - $groupManager->listen('\OC\Group', 'preAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 320 | + $groupManager->listen('\OC\Group', 'preAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 321 | 321 | \OC_Hook::emit('OC_Group', 'pre_addToGroup', array('run' => true, 'uid' => $user->getUID(), 'gid' => $group->getGID())); |
| 322 | 322 | }); |
| 323 | - $groupManager->listen('\OC\Group', 'postAddUser', function (\OC\Group\Group $group, \OC\User\User $user) { |
|
| 323 | + $groupManager->listen('\OC\Group', 'postAddUser', function(\OC\Group\Group $group, \OC\User\User $user) { |
|
| 324 | 324 | \OC_Hook::emit('OC_Group', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
| 325 | 325 | //Minimal fix to keep it backward compatible TODO: clean up all the GroupManager hooks |
| 326 | 326 | \OC_Hook::emit('OC_User', 'post_addToGroup', array('uid' => $user->getUID(), 'gid' => $group->getGID())); |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | }); |
| 330 | 330 | $this->registerAlias('GroupManager', \OCP\IGroupManager::class); |
| 331 | 331 | |
| 332 | - $this->registerService(Store::class, function (Server $c) { |
|
| 332 | + $this->registerService(Store::class, function(Server $c) { |
|
| 333 | 333 | $session = $c->getSession(); |
| 334 | 334 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
| 335 | 335 | $tokenProvider = $c->query(IProvider::class); |
@@ -340,13 +340,13 @@ discard block |
||
| 340 | 340 | return new Store($session, $logger, $tokenProvider); |
| 341 | 341 | }); |
| 342 | 342 | $this->registerAlias(IStore::class, Store::class); |
| 343 | - $this->registerService(Authentication\Token\DefaultTokenMapper::class, function (Server $c) { |
|
| 343 | + $this->registerService(Authentication\Token\DefaultTokenMapper::class, function(Server $c) { |
|
| 344 | 344 | $dbConnection = $c->getDatabaseConnection(); |
| 345 | 345 | return new Authentication\Token\DefaultTokenMapper($dbConnection); |
| 346 | 346 | }); |
| 347 | 347 | $this->registerAlias(IProvider::class, Authentication\Token\Manager::class); |
| 348 | 348 | |
| 349 | - $this->registerService(\OCP\IUserSession::class, function (Server $c) { |
|
| 349 | + $this->registerService(\OCP\IUserSession::class, function(Server $c) { |
|
| 350 | 350 | $manager = $c->getUserManager(); |
| 351 | 351 | $session = new \OC\Session\Memory(''); |
| 352 | 352 | $timeFactory = new TimeFactory(); |
@@ -370,45 +370,45 @@ discard block |
||
| 370 | 370 | $c->getLockdownManager(), |
| 371 | 371 | $c->getLogger() |
| 372 | 372 | ); |
| 373 | - $userSession->listen('\OC\User', 'preCreateUser', function ($uid, $password) { |
|
| 373 | + $userSession->listen('\OC\User', 'preCreateUser', function($uid, $password) { |
|
| 374 | 374 | \OC_Hook::emit('OC_User', 'pre_createUser', array('run' => true, 'uid' => $uid, 'password' => $password)); |
| 375 | 375 | }); |
| 376 | - $userSession->listen('\OC\User', 'postCreateUser', function ($user, $password) { |
|
| 376 | + $userSession->listen('\OC\User', 'postCreateUser', function($user, $password) { |
|
| 377 | 377 | /** @var $user \OC\User\User */ |
| 378 | 378 | \OC_Hook::emit('OC_User', 'post_createUser', array('uid' => $user->getUID(), 'password' => $password)); |
| 379 | 379 | }); |
| 380 | - $userSession->listen('\OC\User', 'preDelete', function ($user) use ($dispatcher) { |
|
| 380 | + $userSession->listen('\OC\User', 'preDelete', function($user) use ($dispatcher) { |
|
| 381 | 381 | /** @var $user \OC\User\User */ |
| 382 | 382 | \OC_Hook::emit('OC_User', 'pre_deleteUser', array('run' => true, 'uid' => $user->getUID())); |
| 383 | 383 | $dispatcher->dispatch('OCP\IUser::preDelete', new GenericEvent($user)); |
| 384 | 384 | }); |
| 385 | - $userSession->listen('\OC\User', 'postDelete', function ($user) { |
|
| 385 | + $userSession->listen('\OC\User', 'postDelete', function($user) { |
|
| 386 | 386 | /** @var $user \OC\User\User */ |
| 387 | 387 | \OC_Hook::emit('OC_User', 'post_deleteUser', array('uid' => $user->getUID())); |
| 388 | 388 | }); |
| 389 | - $userSession->listen('\OC\User', 'preSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 389 | + $userSession->listen('\OC\User', 'preSetPassword', function($user, $password, $recoveryPassword) { |
|
| 390 | 390 | /** @var $user \OC\User\User */ |
| 391 | 391 | \OC_Hook::emit('OC_User', 'pre_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
| 392 | 392 | }); |
| 393 | - $userSession->listen('\OC\User', 'postSetPassword', function ($user, $password, $recoveryPassword) { |
|
| 393 | + $userSession->listen('\OC\User', 'postSetPassword', function($user, $password, $recoveryPassword) { |
|
| 394 | 394 | /** @var $user \OC\User\User */ |
| 395 | 395 | \OC_Hook::emit('OC_User', 'post_setPassword', array('run' => true, 'uid' => $user->getUID(), 'password' => $password, 'recoveryPassword' => $recoveryPassword)); |
| 396 | 396 | }); |
| 397 | - $userSession->listen('\OC\User', 'preLogin', function ($uid, $password) { |
|
| 397 | + $userSession->listen('\OC\User', 'preLogin', function($uid, $password) { |
|
| 398 | 398 | \OC_Hook::emit('OC_User', 'pre_login', array('run' => true, 'uid' => $uid, 'password' => $password)); |
| 399 | 399 | }); |
| 400 | - $userSession->listen('\OC\User', 'postLogin', function ($user, $password) { |
|
| 400 | + $userSession->listen('\OC\User', 'postLogin', function($user, $password) { |
|
| 401 | 401 | /** @var $user \OC\User\User */ |
| 402 | 402 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
| 403 | 403 | }); |
| 404 | - $userSession->listen('\OC\User', 'postRememberedLogin', function ($user, $password) { |
|
| 404 | + $userSession->listen('\OC\User', 'postRememberedLogin', function($user, $password) { |
|
| 405 | 405 | /** @var $user \OC\User\User */ |
| 406 | 406 | \OC_Hook::emit('OC_User', 'post_login', array('run' => true, 'uid' => $user->getUID(), 'password' => $password)); |
| 407 | 407 | }); |
| 408 | - $userSession->listen('\OC\User', 'logout', function () { |
|
| 408 | + $userSession->listen('\OC\User', 'logout', function() { |
|
| 409 | 409 | \OC_Hook::emit('OC_User', 'logout', array()); |
| 410 | 410 | }); |
| 411 | - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) use ($dispatcher) { |
|
| 411 | + $userSession->listen('\OC\User', 'changeUser', function($user, $feature, $value, $oldValue) use ($dispatcher) { |
|
| 412 | 412 | /** @var $user \OC\User\User */ |
| 413 | 413 | \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); |
| 414 | 414 | $dispatcher->dispatch('OCP\IUser::changeUser', new GenericEvent($user, ['feature' => $feature, 'oldValue' => $oldValue, 'value' => $value])); |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | }); |
| 418 | 418 | $this->registerAlias('UserSession', \OCP\IUserSession::class); |
| 419 | 419 | |
| 420 | - $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function (Server $c) { |
|
| 420 | + $this->registerService(\OC\Authentication\TwoFactorAuth\Manager::class, function(Server $c) { |
|
| 421 | 421 | return new \OC\Authentication\TwoFactorAuth\Manager( |
| 422 | 422 | $c->getAppManager(), |
| 423 | 423 | $c->getSession(), |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | $this->registerAlias(\OCP\INavigationManager::class, \OC\NavigationManager::class); |
| 434 | 434 | $this->registerAlias('NavigationManager', \OCP\INavigationManager::class); |
| 435 | 435 | |
| 436 | - $this->registerService(\OC\AllConfig::class, function (Server $c) { |
|
| 436 | + $this->registerService(\OC\AllConfig::class, function(Server $c) { |
|
| 437 | 437 | return new \OC\AllConfig( |
| 438 | 438 | $c->getSystemConfig() |
| 439 | 439 | ); |
@@ -441,17 +441,17 @@ discard block |
||
| 441 | 441 | $this->registerAlias('AllConfig', \OC\AllConfig::class); |
| 442 | 442 | $this->registerAlias(\OCP\IConfig::class, \OC\AllConfig::class); |
| 443 | 443 | |
| 444 | - $this->registerService('SystemConfig', function ($c) use ($config) { |
|
| 444 | + $this->registerService('SystemConfig', function($c) use ($config) { |
|
| 445 | 445 | return new \OC\SystemConfig($config); |
| 446 | 446 | }); |
| 447 | 447 | |
| 448 | - $this->registerService(\OC\AppConfig::class, function (Server $c) { |
|
| 448 | + $this->registerService(\OC\AppConfig::class, function(Server $c) { |
|
| 449 | 449 | return new \OC\AppConfig($c->getDatabaseConnection()); |
| 450 | 450 | }); |
| 451 | 451 | $this->registerAlias('AppConfig', \OC\AppConfig::class); |
| 452 | 452 | $this->registerAlias(\OCP\IAppConfig::class, \OC\AppConfig::class); |
| 453 | 453 | |
| 454 | - $this->registerService(\OCP\L10N\IFactory::class, function (Server $c) { |
|
| 454 | + $this->registerService(\OCP\L10N\IFactory::class, function(Server $c) { |
|
| 455 | 455 | return new \OC\L10N\Factory( |
| 456 | 456 | $c->getConfig(), |
| 457 | 457 | $c->getRequest(), |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | }); |
| 462 | 462 | $this->registerAlias('L10NFactory', \OCP\L10N\IFactory::class); |
| 463 | 463 | |
| 464 | - $this->registerService(\OCP\IURLGenerator::class, function (Server $c) { |
|
| 464 | + $this->registerService(\OCP\IURLGenerator::class, function(Server $c) { |
|
| 465 | 465 | $config = $c->getConfig(); |
| 466 | 466 | $cacheFactory = $c->getMemCacheFactory(); |
| 467 | 467 | $request = $c->getRequest(); |
@@ -476,12 +476,12 @@ discard block |
||
| 476 | 476 | $this->registerAlias('AppFetcher', AppFetcher::class); |
| 477 | 477 | $this->registerAlias('CategoryFetcher', CategoryFetcher::class); |
| 478 | 478 | |
| 479 | - $this->registerService(\OCP\ICache::class, function ($c) { |
|
| 479 | + $this->registerService(\OCP\ICache::class, function($c) { |
|
| 480 | 480 | return new Cache\File(); |
| 481 | 481 | }); |
| 482 | 482 | $this->registerAlias('UserCache', \OCP\ICache::class); |
| 483 | 483 | |
| 484 | - $this->registerService(Factory::class, function (Server $c) { |
|
| 484 | + $this->registerService(Factory::class, function(Server $c) { |
|
| 485 | 485 | |
| 486 | 486 | $arrayCacheFactory = new \OC\Memcache\Factory('', $c->getLogger(), |
| 487 | 487 | ArrayCache::class, |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | $version = implode(',', $v); |
| 499 | 499 | $instanceId = \OC_Util::getInstanceId(); |
| 500 | 500 | $path = \OC::$SERVERROOT; |
| 501 | - $prefix = md5($instanceId . '-' . $version . '-' . $path); |
|
| 501 | + $prefix = md5($instanceId.'-'.$version.'-'.$path); |
|
| 502 | 502 | return new \OC\Memcache\Factory($prefix, $c->getLogger(), |
| 503 | 503 | $config->getSystemValue('memcache.local', null), |
| 504 | 504 | $config->getSystemValue('memcache.distributed', null), |
@@ -511,12 +511,12 @@ discard block |
||
| 511 | 511 | $this->registerAlias('MemCacheFactory', Factory::class); |
| 512 | 512 | $this->registerAlias(ICacheFactory::class, Factory::class); |
| 513 | 513 | |
| 514 | - $this->registerService('RedisFactory', function (Server $c) { |
|
| 514 | + $this->registerService('RedisFactory', function(Server $c) { |
|
| 515 | 515 | $systemConfig = $c->getSystemConfig(); |
| 516 | 516 | return new RedisFactory($systemConfig); |
| 517 | 517 | }); |
| 518 | 518 | |
| 519 | - $this->registerService(\OCP\Activity\IManager::class, function (Server $c) { |
|
| 519 | + $this->registerService(\OCP\Activity\IManager::class, function(Server $c) { |
|
| 520 | 520 | return new \OC\Activity\Manager( |
| 521 | 521 | $c->getRequest(), |
| 522 | 522 | $c->getUserSession(), |
@@ -526,14 +526,14 @@ discard block |
||
| 526 | 526 | }); |
| 527 | 527 | $this->registerAlias('ActivityManager', \OCP\Activity\IManager::class); |
| 528 | 528 | |
| 529 | - $this->registerService(\OCP\Activity\IEventMerger::class, function (Server $c) { |
|
| 529 | + $this->registerService(\OCP\Activity\IEventMerger::class, function(Server $c) { |
|
| 530 | 530 | return new \OC\Activity\EventMerger( |
| 531 | 531 | $c->getL10N('lib') |
| 532 | 532 | ); |
| 533 | 533 | }); |
| 534 | 534 | $this->registerAlias(IValidator::class, Validator::class); |
| 535 | 535 | |
| 536 | - $this->registerService(\OCP\IAvatarManager::class, function (Server $c) { |
|
| 536 | + $this->registerService(\OCP\IAvatarManager::class, function(Server $c) { |
|
| 537 | 537 | return new AvatarManager( |
| 538 | 538 | $c->query(\OC\User\Manager::class), |
| 539 | 539 | $c->getAppDataDir('avatar'), |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | |
| 547 | 547 | $this->registerAlias(\OCP\Support\CrashReport\IRegistry::class, \OC\Support\CrashReport\Registry::class); |
| 548 | 548 | |
| 549 | - $this->registerService(\OCP\ILogger::class, function (Server $c) { |
|
| 549 | + $this->registerService(\OCP\ILogger::class, function(Server $c) { |
|
| 550 | 550 | $logType = $c->query('AllConfig')->getSystemValue('log_type', 'file'); |
| 551 | 551 | $factory = new LogFactory($c, $this->getSystemConfig()); |
| 552 | 552 | $logger = $factory->get($logType); |
@@ -556,11 +556,11 @@ discard block |
||
| 556 | 556 | }); |
| 557 | 557 | $this->registerAlias('Logger', \OCP\ILogger::class); |
| 558 | 558 | |
| 559 | - $this->registerService(ILogFactory::class, function (Server $c) { |
|
| 559 | + $this->registerService(ILogFactory::class, function(Server $c) { |
|
| 560 | 560 | return new LogFactory($c, $this->getSystemConfig()); |
| 561 | 561 | }); |
| 562 | 562 | |
| 563 | - $this->registerService(\OCP\BackgroundJob\IJobList::class, function (Server $c) { |
|
| 563 | + $this->registerService(\OCP\BackgroundJob\IJobList::class, function(Server $c) { |
|
| 564 | 564 | $config = $c->getConfig(); |
| 565 | 565 | return new \OC\BackgroundJob\JobList( |
| 566 | 566 | $c->getDatabaseConnection(), |
@@ -570,7 +570,7 @@ discard block |
||
| 570 | 570 | }); |
| 571 | 571 | $this->registerAlias('JobList', \OCP\BackgroundJob\IJobList::class); |
| 572 | 572 | |
| 573 | - $this->registerService(\OCP\Route\IRouter::class, function (Server $c) { |
|
| 573 | + $this->registerService(\OCP\Route\IRouter::class, function(Server $c) { |
|
| 574 | 574 | $cacheFactory = $c->getMemCacheFactory(); |
| 575 | 575 | $logger = $c->getLogger(); |
| 576 | 576 | if ($cacheFactory->isLocalCacheAvailable()) { |
@@ -582,12 +582,12 @@ discard block |
||
| 582 | 582 | }); |
| 583 | 583 | $this->registerAlias('Router', \OCP\Route\IRouter::class); |
| 584 | 584 | |
| 585 | - $this->registerService(\OCP\ISearch::class, function ($c) { |
|
| 585 | + $this->registerService(\OCP\ISearch::class, function($c) { |
|
| 586 | 586 | return new Search(); |
| 587 | 587 | }); |
| 588 | 588 | $this->registerAlias('Search', \OCP\ISearch::class); |
| 589 | 589 | |
| 590 | - $this->registerService(\OC\Security\RateLimiting\Limiter::class, function (Server $c) { |
|
| 590 | + $this->registerService(\OC\Security\RateLimiting\Limiter::class, function(Server $c) { |
|
| 591 | 591 | return new \OC\Security\RateLimiting\Limiter( |
| 592 | 592 | $this->getUserSession(), |
| 593 | 593 | $this->getRequest(), |
@@ -595,34 +595,34 @@ discard block |
||
| 595 | 595 | $c->query(\OC\Security\RateLimiting\Backend\IBackend::class) |
| 596 | 596 | ); |
| 597 | 597 | }); |
| 598 | - $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function ($c) { |
|
| 598 | + $this->registerService(\OC\Security\RateLimiting\Backend\IBackend::class, function($c) { |
|
| 599 | 599 | return new \OC\Security\RateLimiting\Backend\MemoryCache( |
| 600 | 600 | $this->getMemCacheFactory(), |
| 601 | 601 | new \OC\AppFramework\Utility\TimeFactory() |
| 602 | 602 | ); |
| 603 | 603 | }); |
| 604 | 604 | |
| 605 | - $this->registerService(\OCP\Security\ISecureRandom::class, function ($c) { |
|
| 605 | + $this->registerService(\OCP\Security\ISecureRandom::class, function($c) { |
|
| 606 | 606 | return new SecureRandom(); |
| 607 | 607 | }); |
| 608 | 608 | $this->registerAlias('SecureRandom', \OCP\Security\ISecureRandom::class); |
| 609 | 609 | |
| 610 | - $this->registerService(\OCP\Security\ICrypto::class, function (Server $c) { |
|
| 610 | + $this->registerService(\OCP\Security\ICrypto::class, function(Server $c) { |
|
| 611 | 611 | return new Crypto($c->getConfig(), $c->getSecureRandom()); |
| 612 | 612 | }); |
| 613 | 613 | $this->registerAlias('Crypto', \OCP\Security\ICrypto::class); |
| 614 | 614 | |
| 615 | - $this->registerService(\OCP\Security\IHasher::class, function (Server $c) { |
|
| 615 | + $this->registerService(\OCP\Security\IHasher::class, function(Server $c) { |
|
| 616 | 616 | return new Hasher($c->getConfig()); |
| 617 | 617 | }); |
| 618 | 618 | $this->registerAlias('Hasher', \OCP\Security\IHasher::class); |
| 619 | 619 | |
| 620 | - $this->registerService(\OCP\Security\ICredentialsManager::class, function (Server $c) { |
|
| 620 | + $this->registerService(\OCP\Security\ICredentialsManager::class, function(Server $c) { |
|
| 621 | 621 | return new CredentialsManager($c->getCrypto(), $c->getDatabaseConnection()); |
| 622 | 622 | }); |
| 623 | 623 | $this->registerAlias('CredentialsManager', \OCP\Security\ICredentialsManager::class); |
| 624 | 624 | |
| 625 | - $this->registerService(IDBConnection::class, function (Server $c) { |
|
| 625 | + $this->registerService(IDBConnection::class, function(Server $c) { |
|
| 626 | 626 | $systemConfig = $c->getSystemConfig(); |
| 627 | 627 | $factory = new \OC\DB\ConnectionFactory($systemConfig); |
| 628 | 628 | $type = $systemConfig->getValue('dbtype', 'sqlite'); |
@@ -637,7 +637,7 @@ discard block |
||
| 637 | 637 | $this->registerAlias('DatabaseConnection', IDBConnection::class); |
| 638 | 638 | |
| 639 | 639 | |
| 640 | - $this->registerService(\OCP\Http\Client\IClientService::class, function (Server $c) { |
|
| 640 | + $this->registerService(\OCP\Http\Client\IClientService::class, function(Server $c) { |
|
| 641 | 641 | $user = \OC_User::getUser(); |
| 642 | 642 | $uid = $user ? $user : null; |
| 643 | 643 | return new ClientService( |
@@ -652,7 +652,7 @@ discard block |
||
| 652 | 652 | ); |
| 653 | 653 | }); |
| 654 | 654 | $this->registerAlias('HttpClientService', \OCP\Http\Client\IClientService::class); |
| 655 | - $this->registerService(\OCP\Diagnostics\IEventLogger::class, function (Server $c) { |
|
| 655 | + $this->registerService(\OCP\Diagnostics\IEventLogger::class, function(Server $c) { |
|
| 656 | 656 | $eventLogger = new EventLogger(); |
| 657 | 657 | if ($c->getSystemConfig()->getValue('debug', false)) { |
| 658 | 658 | // In debug mode, module is being activated by default |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | }); |
| 663 | 663 | $this->registerAlias('EventLogger', \OCP\Diagnostics\IEventLogger::class); |
| 664 | 664 | |
| 665 | - $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function (Server $c) { |
|
| 665 | + $this->registerService(\OCP\Diagnostics\IQueryLogger::class, function(Server $c) { |
|
| 666 | 666 | $queryLogger = new QueryLogger(); |
| 667 | 667 | if ($c->getSystemConfig()->getValue('debug', false)) { |
| 668 | 668 | // In debug mode, module is being activated by default |
@@ -672,7 +672,7 @@ discard block |
||
| 672 | 672 | }); |
| 673 | 673 | $this->registerAlias('QueryLogger', \OCP\Diagnostics\IQueryLogger::class); |
| 674 | 674 | |
| 675 | - $this->registerService(TempManager::class, function (Server $c) { |
|
| 675 | + $this->registerService(TempManager::class, function(Server $c) { |
|
| 676 | 676 | return new TempManager( |
| 677 | 677 | $c->getLogger(), |
| 678 | 678 | $c->getConfig() |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | $this->registerAlias('TempManager', TempManager::class); |
| 682 | 682 | $this->registerAlias(ITempManager::class, TempManager::class); |
| 683 | 683 | |
| 684 | - $this->registerService(AppManager::class, function (Server $c) { |
|
| 684 | + $this->registerService(AppManager::class, function(Server $c) { |
|
| 685 | 685 | return new \OC\App\AppManager( |
| 686 | 686 | $c->getUserSession(), |
| 687 | 687 | $c->query(\OC\AppConfig::class), |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | $this->registerAlias('AppManager', AppManager::class); |
| 694 | 694 | $this->registerAlias(IAppManager::class, AppManager::class); |
| 695 | 695 | |
| 696 | - $this->registerService(\OCP\IDateTimeZone::class, function (Server $c) { |
|
| 696 | + $this->registerService(\OCP\IDateTimeZone::class, function(Server $c) { |
|
| 697 | 697 | return new DateTimeZone( |
| 698 | 698 | $c->getConfig(), |
| 699 | 699 | $c->getSession() |
@@ -701,7 +701,7 @@ discard block |
||
| 701 | 701 | }); |
| 702 | 702 | $this->registerAlias('DateTimeZone', \OCP\IDateTimeZone::class); |
| 703 | 703 | |
| 704 | - $this->registerService(\OCP\IDateTimeFormatter::class, function (Server $c) { |
|
| 704 | + $this->registerService(\OCP\IDateTimeFormatter::class, function(Server $c) { |
|
| 705 | 705 | $language = $c->getConfig()->getUserValue($c->getSession()->get('user_id'), 'core', 'lang', null); |
| 706 | 706 | |
| 707 | 707 | return new DateTimeFormatter( |
@@ -711,7 +711,7 @@ discard block |
||
| 711 | 711 | }); |
| 712 | 712 | $this->registerAlias('DateTimeFormatter', \OCP\IDateTimeFormatter::class); |
| 713 | 713 | |
| 714 | - $this->registerService(\OCP\Files\Config\IUserMountCache::class, function (Server $c) { |
|
| 714 | + $this->registerService(\OCP\Files\Config\IUserMountCache::class, function(Server $c) { |
|
| 715 | 715 | $mountCache = new UserMountCache($c->getDatabaseConnection(), $c->getUserManager(), $c->getLogger()); |
| 716 | 716 | $listener = new UserMountCacheListener($mountCache); |
| 717 | 717 | $listener->listen($c->getUserManager()); |
@@ -719,7 +719,7 @@ discard block |
||
| 719 | 719 | }); |
| 720 | 720 | $this->registerAlias('UserMountCache', \OCP\Files\Config\IUserMountCache::class); |
| 721 | 721 | |
| 722 | - $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function (Server $c) { |
|
| 722 | + $this->registerService(\OCP\Files\Config\IMountProviderCollection::class, function(Server $c) { |
|
| 723 | 723 | $loader = \OC\Files\Filesystem::getLoader(); |
| 724 | 724 | $mountCache = $c->query('UserMountCache'); |
| 725 | 725 | $manager = new \OC\Files\Config\MountProviderCollection($loader, $mountCache); |
@@ -735,10 +735,10 @@ discard block |
||
| 735 | 735 | }); |
| 736 | 736 | $this->registerAlias('MountConfigManager', \OCP\Files\Config\IMountProviderCollection::class); |
| 737 | 737 | |
| 738 | - $this->registerService('IniWrapper', function ($c) { |
|
| 738 | + $this->registerService('IniWrapper', function($c) { |
|
| 739 | 739 | return new IniGetWrapper(); |
| 740 | 740 | }); |
| 741 | - $this->registerService('AsyncCommandBus', function (Server $c) { |
|
| 741 | + $this->registerService('AsyncCommandBus', function(Server $c) { |
|
| 742 | 742 | $busClass = $c->getConfig()->getSystemValue('commandbus'); |
| 743 | 743 | if ($busClass) { |
| 744 | 744 | list($app, $class) = explode('::', $busClass, 2); |
@@ -753,10 +753,10 @@ discard block |
||
| 753 | 753 | return new CronBus($jobList); |
| 754 | 754 | } |
| 755 | 755 | }); |
| 756 | - $this->registerService('TrustedDomainHelper', function ($c) { |
|
| 756 | + $this->registerService('TrustedDomainHelper', function($c) { |
|
| 757 | 757 | return new TrustedDomainHelper($this->getConfig()); |
| 758 | 758 | }); |
| 759 | - $this->registerService('Throttler', function (Server $c) { |
|
| 759 | + $this->registerService('Throttler', function(Server $c) { |
|
| 760 | 760 | return new Throttler( |
| 761 | 761 | $c->getDatabaseConnection(), |
| 762 | 762 | new TimeFactory(), |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | $c->getConfig() |
| 765 | 765 | ); |
| 766 | 766 | }); |
| 767 | - $this->registerService('IntegrityCodeChecker', function (Server $c) { |
|
| 767 | + $this->registerService('IntegrityCodeChecker', function(Server $c) { |
|
| 768 | 768 | // IConfig and IAppManager requires a working database. This code |
| 769 | 769 | // might however be called when ownCloud is not yet setup. |
| 770 | 770 | if (\OC::$server->getSystemConfig()->getValue('installed', false)) { |
@@ -785,7 +785,7 @@ discard block |
||
| 785 | 785 | $c->getTempManager() |
| 786 | 786 | ); |
| 787 | 787 | }); |
| 788 | - $this->registerService(\OCP\IRequest::class, function ($c) { |
|
| 788 | + $this->registerService(\OCP\IRequest::class, function($c) { |
|
| 789 | 789 | if (isset($this['urlParams'])) { |
| 790 | 790 | $urlParams = $this['urlParams']; |
| 791 | 791 | } else { |
@@ -821,7 +821,7 @@ discard block |
||
| 821 | 821 | }); |
| 822 | 822 | $this->registerAlias('Request', \OCP\IRequest::class); |
| 823 | 823 | |
| 824 | - $this->registerService(\OCP\Mail\IMailer::class, function (Server $c) { |
|
| 824 | + $this->registerService(\OCP\Mail\IMailer::class, function(Server $c) { |
|
| 825 | 825 | return new Mailer( |
| 826 | 826 | $c->getConfig(), |
| 827 | 827 | $c->getLogger(), |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | }); |
| 833 | 833 | $this->registerAlias('Mailer', \OCP\Mail\IMailer::class); |
| 834 | 834 | |
| 835 | - $this->registerService('LDAPProvider', function (Server $c) { |
|
| 835 | + $this->registerService('LDAPProvider', function(Server $c) { |
|
| 836 | 836 | $config = $c->getConfig(); |
| 837 | 837 | $factoryClass = $config->getSystemValue('ldapProviderFactory', null); |
| 838 | 838 | if (is_null($factoryClass)) { |
@@ -842,7 +842,7 @@ discard block |
||
| 842 | 842 | $factory = new $factoryClass($this); |
| 843 | 843 | return $factory->getLDAPProvider(); |
| 844 | 844 | }); |
| 845 | - $this->registerService(ILockingProvider::class, function (Server $c) { |
|
| 845 | + $this->registerService(ILockingProvider::class, function(Server $c) { |
|
| 846 | 846 | $ini = $c->getIniWrapper(); |
| 847 | 847 | $config = $c->getConfig(); |
| 848 | 848 | $ttl = $config->getSystemValue('filelocking.ttl', max(3600, $ini->getNumeric('max_execution_time'))); |
@@ -865,49 +865,49 @@ discard block |
||
| 865 | 865 | }); |
| 866 | 866 | $this->registerAlias('LockingProvider', ILockingProvider::class); |
| 867 | 867 | |
| 868 | - $this->registerService(\OCP\Files\Mount\IMountManager::class, function () { |
|
| 868 | + $this->registerService(\OCP\Files\Mount\IMountManager::class, function() { |
|
| 869 | 869 | return new \OC\Files\Mount\Manager(); |
| 870 | 870 | }); |
| 871 | 871 | $this->registerAlias('MountManager', \OCP\Files\Mount\IMountManager::class); |
| 872 | 872 | |
| 873 | - $this->registerService(\OCP\Files\IMimeTypeDetector::class, function (Server $c) { |
|
| 873 | + $this->registerService(\OCP\Files\IMimeTypeDetector::class, function(Server $c) { |
|
| 874 | 874 | return new \OC\Files\Type\Detection( |
| 875 | 875 | $c->getURLGenerator(), |
| 876 | 876 | \OC::$configDir, |
| 877 | - \OC::$SERVERROOT . '/resources/config/' |
|
| 877 | + \OC::$SERVERROOT.'/resources/config/' |
|
| 878 | 878 | ); |
| 879 | 879 | }); |
| 880 | 880 | $this->registerAlias('MimeTypeDetector', \OCP\Files\IMimeTypeDetector::class); |
| 881 | 881 | |
| 882 | - $this->registerService(\OCP\Files\IMimeTypeLoader::class, function (Server $c) { |
|
| 882 | + $this->registerService(\OCP\Files\IMimeTypeLoader::class, function(Server $c) { |
|
| 883 | 883 | return new \OC\Files\Type\Loader( |
| 884 | 884 | $c->getDatabaseConnection() |
| 885 | 885 | ); |
| 886 | 886 | }); |
| 887 | 887 | $this->registerAlias('MimeTypeLoader', \OCP\Files\IMimeTypeLoader::class); |
| 888 | - $this->registerService(BundleFetcher::class, function () { |
|
| 888 | + $this->registerService(BundleFetcher::class, function() { |
|
| 889 | 889 | return new BundleFetcher($this->getL10N('lib')); |
| 890 | 890 | }); |
| 891 | - $this->registerService(\OCP\Notification\IManager::class, function (Server $c) { |
|
| 891 | + $this->registerService(\OCP\Notification\IManager::class, function(Server $c) { |
|
| 892 | 892 | return new Manager( |
| 893 | 893 | $c->query(IValidator::class) |
| 894 | 894 | ); |
| 895 | 895 | }); |
| 896 | 896 | $this->registerAlias('NotificationManager', \OCP\Notification\IManager::class); |
| 897 | 897 | |
| 898 | - $this->registerService(\OC\CapabilitiesManager::class, function (Server $c) { |
|
| 898 | + $this->registerService(\OC\CapabilitiesManager::class, function(Server $c) { |
|
| 899 | 899 | $manager = new \OC\CapabilitiesManager($c->getLogger()); |
| 900 | - $manager->registerCapability(function () use ($c) { |
|
| 900 | + $manager->registerCapability(function() use ($c) { |
|
| 901 | 901 | return new \OC\OCS\CoreCapabilities($c->getConfig()); |
| 902 | 902 | }); |
| 903 | - $manager->registerCapability(function () use ($c) { |
|
| 903 | + $manager->registerCapability(function() use ($c) { |
|
| 904 | 904 | return $c->query(\OC\Security\Bruteforce\Capabilities::class); |
| 905 | 905 | }); |
| 906 | 906 | return $manager; |
| 907 | 907 | }); |
| 908 | 908 | $this->registerAlias('CapabilitiesManager', \OC\CapabilitiesManager::class); |
| 909 | 909 | |
| 910 | - $this->registerService(\OCP\Comments\ICommentsManager::class, function (Server $c) { |
|
| 910 | + $this->registerService(\OCP\Comments\ICommentsManager::class, function(Server $c) { |
|
| 911 | 911 | $config = $c->getConfig(); |
| 912 | 912 | $factoryClass = $config->getSystemValue('comments.managerFactory', CommentsManagerFactory::class); |
| 913 | 913 | /** @var \OCP\Comments\ICommentsManagerFactory $factory */ |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | $manager->registerDisplayNameResolver('user', function($id) use ($c) { |
| 918 | 918 | $manager = $c->getUserManager(); |
| 919 | 919 | $user = $manager->get($id); |
| 920 | - if(is_null($user)) { |
|
| 920 | + if (is_null($user)) { |
|
| 921 | 921 | $l = $c->getL10N('core'); |
| 922 | 922 | $displayName = $l->t('Unknown user'); |
| 923 | 923 | } else { |
@@ -930,7 +930,7 @@ discard block |
||
| 930 | 930 | }); |
| 931 | 931 | $this->registerAlias('CommentsManager', \OCP\Comments\ICommentsManager::class); |
| 932 | 932 | |
| 933 | - $this->registerService('ThemingDefaults', function (Server $c) { |
|
| 933 | + $this->registerService('ThemingDefaults', function(Server $c) { |
|
| 934 | 934 | /* |
| 935 | 935 | * Dark magic for autoloader. |
| 936 | 936 | * If we do a class_exists it will try to load the class which will |
@@ -957,7 +957,7 @@ discard block |
||
| 957 | 957 | } |
| 958 | 958 | return new \OC_Defaults(); |
| 959 | 959 | }); |
| 960 | - $this->registerService(SCSSCacher::class, function (Server $c) { |
|
| 960 | + $this->registerService(SCSSCacher::class, function(Server $c) { |
|
| 961 | 961 | /** @var Factory $cacheFactory */ |
| 962 | 962 | $cacheFactory = $c->query(Factory::class); |
| 963 | 963 | return new SCSSCacher( |
@@ -970,7 +970,7 @@ discard block |
||
| 970 | 970 | $this->getMemCacheFactory() |
| 971 | 971 | ); |
| 972 | 972 | }); |
| 973 | - $this->registerService(JSCombiner::class, function (Server $c) { |
|
| 973 | + $this->registerService(JSCombiner::class, function(Server $c) { |
|
| 974 | 974 | /** @var Factory $cacheFactory */ |
| 975 | 975 | $cacheFactory = $c->query(Factory::class); |
| 976 | 976 | return new JSCombiner( |
@@ -981,13 +981,13 @@ discard block |
||
| 981 | 981 | $c->getLogger() |
| 982 | 982 | ); |
| 983 | 983 | }); |
| 984 | - $this->registerService(EventDispatcher::class, function () { |
|
| 984 | + $this->registerService(EventDispatcher::class, function() { |
|
| 985 | 985 | return new EventDispatcher(); |
| 986 | 986 | }); |
| 987 | 987 | $this->registerAlias('EventDispatcher', EventDispatcher::class); |
| 988 | 988 | $this->registerAlias(EventDispatcherInterface::class, EventDispatcher::class); |
| 989 | 989 | |
| 990 | - $this->registerService('CryptoWrapper', function (Server $c) { |
|
| 990 | + $this->registerService('CryptoWrapper', function(Server $c) { |
|
| 991 | 991 | // FIXME: Instantiiated here due to cyclic dependency |
| 992 | 992 | $request = new Request( |
| 993 | 993 | [ |
@@ -1012,7 +1012,7 @@ discard block |
||
| 1012 | 1012 | $request |
| 1013 | 1013 | ); |
| 1014 | 1014 | }); |
| 1015 | - $this->registerService('CsrfTokenManager', function (Server $c) { |
|
| 1015 | + $this->registerService('CsrfTokenManager', function(Server $c) { |
|
| 1016 | 1016 | $tokenGenerator = new CsrfTokenGenerator($c->getSecureRandom()); |
| 1017 | 1017 | |
| 1018 | 1018 | return new CsrfTokenManager( |
@@ -1020,22 +1020,22 @@ discard block |
||
| 1020 | 1020 | $c->query(SessionStorage::class) |
| 1021 | 1021 | ); |
| 1022 | 1022 | }); |
| 1023 | - $this->registerService(SessionStorage::class, function (Server $c) { |
|
| 1023 | + $this->registerService(SessionStorage::class, function(Server $c) { |
|
| 1024 | 1024 | return new SessionStorage($c->getSession()); |
| 1025 | 1025 | }); |
| 1026 | - $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function (Server $c) { |
|
| 1026 | + $this->registerService(\OCP\Security\IContentSecurityPolicyManager::class, function(Server $c) { |
|
| 1027 | 1027 | return new ContentSecurityPolicyManager(); |
| 1028 | 1028 | }); |
| 1029 | 1029 | $this->registerAlias('ContentSecurityPolicyManager', \OCP\Security\IContentSecurityPolicyManager::class); |
| 1030 | 1030 | |
| 1031 | - $this->registerService('ContentSecurityPolicyNonceManager', function (Server $c) { |
|
| 1031 | + $this->registerService('ContentSecurityPolicyNonceManager', function(Server $c) { |
|
| 1032 | 1032 | return new ContentSecurityPolicyNonceManager( |
| 1033 | 1033 | $c->getCsrfTokenManager(), |
| 1034 | 1034 | $c->getRequest() |
| 1035 | 1035 | ); |
| 1036 | 1036 | }); |
| 1037 | 1037 | |
| 1038 | - $this->registerService(\OCP\Share\IManager::class, function (Server $c) { |
|
| 1038 | + $this->registerService(\OCP\Share\IManager::class, function(Server $c) { |
|
| 1039 | 1039 | $config = $c->getConfig(); |
| 1040 | 1040 | $factoryClass = $config->getSystemValue('sharing.managerFactory', ProviderFactory::class); |
| 1041 | 1041 | /** @var \OCP\Share\IProviderFactory $factory */ |
@@ -1078,7 +1078,7 @@ discard block |
||
| 1078 | 1078 | |
| 1079 | 1079 | $this->registerAlias(\OCP\Collaboration\AutoComplete\IManager::class, \OC\Collaboration\AutoComplete\Manager::class); |
| 1080 | 1080 | |
| 1081 | - $this->registerService('SettingsManager', function (Server $c) { |
|
| 1081 | + $this->registerService('SettingsManager', function(Server $c) { |
|
| 1082 | 1082 | $manager = new \OC\Settings\Manager( |
| 1083 | 1083 | $c->getLogger(), |
| 1084 | 1084 | $c->getDatabaseConnection(), |
@@ -1096,36 +1096,36 @@ discard block |
||
| 1096 | 1096 | ); |
| 1097 | 1097 | return $manager; |
| 1098 | 1098 | }); |
| 1099 | - $this->registerService(\OC\Files\AppData\Factory::class, function (Server $c) { |
|
| 1099 | + $this->registerService(\OC\Files\AppData\Factory::class, function(Server $c) { |
|
| 1100 | 1100 | return new \OC\Files\AppData\Factory( |
| 1101 | 1101 | $c->getRootFolder(), |
| 1102 | 1102 | $c->getSystemConfig() |
| 1103 | 1103 | ); |
| 1104 | 1104 | }); |
| 1105 | 1105 | |
| 1106 | - $this->registerService('LockdownManager', function (Server $c) { |
|
| 1107 | - return new LockdownManager(function () use ($c) { |
|
| 1106 | + $this->registerService('LockdownManager', function(Server $c) { |
|
| 1107 | + return new LockdownManager(function() use ($c) { |
|
| 1108 | 1108 | return $c->getSession(); |
| 1109 | 1109 | }); |
| 1110 | 1110 | }); |
| 1111 | 1111 | |
| 1112 | - $this->registerService(\OCP\OCS\IDiscoveryService::class, function (Server $c) { |
|
| 1112 | + $this->registerService(\OCP\OCS\IDiscoveryService::class, function(Server $c) { |
|
| 1113 | 1113 | return new DiscoveryService($c->getMemCacheFactory(), $c->getHTTPClientService()); |
| 1114 | 1114 | }); |
| 1115 | 1115 | |
| 1116 | - $this->registerService(ICloudIdManager::class, function (Server $c) { |
|
| 1116 | + $this->registerService(ICloudIdManager::class, function(Server $c) { |
|
| 1117 | 1117 | return new CloudIdManager(); |
| 1118 | 1118 | }); |
| 1119 | 1119 | |
| 1120 | - $this->registerService(IConfig::class, function (Server $c) { |
|
| 1120 | + $this->registerService(IConfig::class, function(Server $c) { |
|
| 1121 | 1121 | return new GlobalScale\Config($c->getConfig()); |
| 1122 | 1122 | }); |
| 1123 | 1123 | |
| 1124 | - $this->registerService(ICloudFederationProviderManager::class, function (Server $c) { |
|
| 1124 | + $this->registerService(ICloudFederationProviderManager::class, function(Server $c) { |
|
| 1125 | 1125 | return new CloudFederationProviderManager($c->getAppManager(), $c->getHTTPClientService(), $c->getCloudIdManager(), $c->getLogger()); |
| 1126 | 1126 | }); |
| 1127 | 1127 | |
| 1128 | - $this->registerService(ICloudFederationFactory::class, function (Server $c) { |
|
| 1128 | + $this->registerService(ICloudFederationFactory::class, function(Server $c) { |
|
| 1129 | 1129 | return new CloudFederationFactory(); |
| 1130 | 1130 | }); |
| 1131 | 1131 | |
@@ -1135,18 +1135,18 @@ discard block |
||
| 1135 | 1135 | $this->registerAlias(\OCP\AppFramework\Utility\ITimeFactory::class, \OC\AppFramework\Utility\TimeFactory::class); |
| 1136 | 1136 | $this->registerAlias('TimeFactory', \OCP\AppFramework\Utility\ITimeFactory::class); |
| 1137 | 1137 | |
| 1138 | - $this->registerService(Defaults::class, function (Server $c) { |
|
| 1138 | + $this->registerService(Defaults::class, function(Server $c) { |
|
| 1139 | 1139 | return new Defaults( |
| 1140 | 1140 | $c->getThemingDefaults() |
| 1141 | 1141 | ); |
| 1142 | 1142 | }); |
| 1143 | 1143 | $this->registerAlias('Defaults', \OCP\Defaults::class); |
| 1144 | 1144 | |
| 1145 | - $this->registerService(\OCP\ISession::class, function (SimpleContainer $c) { |
|
| 1145 | + $this->registerService(\OCP\ISession::class, function(SimpleContainer $c) { |
|
| 1146 | 1146 | return $c->query(\OCP\IUserSession::class)->getSession(); |
| 1147 | 1147 | }); |
| 1148 | 1148 | |
| 1149 | - $this->registerService(IShareHelper::class, function (Server $c) { |
|
| 1149 | + $this->registerService(IShareHelper::class, function(Server $c) { |
|
| 1150 | 1150 | return new ShareHelper( |
| 1151 | 1151 | $c->query(\OCP\Share\IManager::class) |
| 1152 | 1152 | ); |
@@ -1208,11 +1208,11 @@ discard block |
||
| 1208 | 1208 | // no avatar to remove |
| 1209 | 1209 | } catch (\Exception $e) { |
| 1210 | 1210 | // Ignore exceptions |
| 1211 | - $logger->info('Could not cleanup avatar of ' . $user->getUID()); |
|
| 1211 | + $logger->info('Could not cleanup avatar of '.$user->getUID()); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | }); |
| 1214 | 1214 | |
| 1215 | - $dispatcher->addListener('OCP\IUser::changeUser', function (GenericEvent $e) { |
|
| 1215 | + $dispatcher->addListener('OCP\IUser::changeUser', function(GenericEvent $e) { |
|
| 1216 | 1216 | $manager = $this->getAvatarManager(); |
| 1217 | 1217 | /** @var IUser $user */ |
| 1218 | 1218 | $user = $e->getSubject(); |
@@ -1363,7 +1363,7 @@ discard block |
||
| 1363 | 1363 | * @deprecated since 9.2.0 use IAppData |
| 1364 | 1364 | */ |
| 1365 | 1365 | public function getAppFolder() { |
| 1366 | - $dir = '/' . \OC_App::getCurrentApp(); |
|
| 1366 | + $dir = '/'.\OC_App::getCurrentApp(); |
|
| 1367 | 1367 | $root = $this->getRootFolder(); |
| 1368 | 1368 | if (!$root->nodeExists($dir)) { |
| 1369 | 1369 | $folder = $root->newFolder($dir); |
@@ -1938,7 +1938,7 @@ discard block |
||
| 1938 | 1938 | /** |
| 1939 | 1939 | * @return \OCP\Collaboration\AutoComplete\IManager |
| 1940 | 1940 | */ |
| 1941 | - public function getAutoCompleteManager(){ |
|
| 1941 | + public function getAutoCompleteManager() { |
|
| 1942 | 1942 | return $this->query(IManager::class); |
| 1943 | 1943 | } |
| 1944 | 1944 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $secure = $protocol === 'https'; |
| 80 | 80 | $federatedSharingEndpoints = $discoveryService->discover($this->cloudId->getRemote(), 'FEDERATED_SHARING'); |
| 81 | 81 | $webDavEndpoint = isset($federatedSharingEndpoints['webdav']) ? $federatedSharingEndpoints['webdav'] : '/public.php/webdav'; |
| 82 | - $root = rtrim($root, '/') . $webDavEndpoint; |
|
| 82 | + $root = rtrim($root, '/').$webDavEndpoint; |
|
| 83 | 83 | $this->mountPoint = $options['mountpoint']; |
| 84 | 84 | $this->token = $options['token']; |
| 85 | 85 | |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | 'host' => $host, |
| 89 | 89 | 'root' => $root, |
| 90 | 90 | 'user' => $options['token'], |
| 91 | - 'password' => (string)$options['password'] |
|
| 91 | + 'password' => (string) $options['password'] |
|
| 92 | 92 | )); |
| 93 | 93 | } |
| 94 | 94 | |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | * @return string |
| 129 | 129 | */ |
| 130 | 130 | public function getId() { |
| 131 | - return 'shared::' . md5($this->token . '@' . $this->getRemote()); |
|
| 131 | + return 'shared::'.md5($this->token.'@'.$this->getRemote()); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | public function getCache($path = '', $storage = null) { |
@@ -249,9 +249,9 @@ discard block |
||
| 249 | 249 | */ |
| 250 | 250 | protected function testRemote() { |
| 251 | 251 | try { |
| 252 | - return $this->testRemoteUrl($this->getRemote() . '/ocs-provider/index.php') |
|
| 253 | - || $this->testRemoteUrl($this->getRemote() . '/ocs-provider/') |
|
| 254 | - || $this->testRemoteUrl($this->getRemote() . '/status.php'); |
|
| 252 | + return $this->testRemoteUrl($this->getRemote().'/ocs-provider/index.php') |
|
| 253 | + || $this->testRemoteUrl($this->getRemote().'/ocs-provider/') |
|
| 254 | + || $this->testRemoteUrl($this->getRemote().'/status.php'); |
|
| 255 | 255 | } catch (\Exception $e) { |
| 256 | 256 | return false; |
| 257 | 257 | } |
@@ -263,8 +263,8 @@ discard block |
||
| 263 | 263 | */ |
| 264 | 264 | private function testRemoteUrl($url) { |
| 265 | 265 | $cache = $this->memcacheFactory->createDistributed('files_sharing_remote_url'); |
| 266 | - if($cache->hasKey($url)) { |
|
| 267 | - return (bool)$cache->get($url); |
|
| 266 | + if ($cache->hasKey($url)) { |
|
| 267 | + return (bool) $cache->get($url); |
|
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $client = $this->httpClient->newClient(); |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | $returnValue = false; |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | - $cache->set($url, $returnValue, 60*60*24); |
|
| 284 | + $cache->set($url, $returnValue, 60 * 60 * 24); |
|
| 285 | 285 | return $returnValue; |
| 286 | 286 | } |
| 287 | 287 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @return bool |
| 293 | 293 | */ |
| 294 | 294 | public function remoteIsOwnCloud() { |
| 295 | - if(defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote() . '/status.php')) { |
|
| 295 | + if (defined('PHPUNIT_RUN') || !$this->testRemoteUrl($this->getRemote().'/status.php')) { |
|
| 296 | 296 | return false; |
| 297 | 297 | } |
| 298 | 298 | return true; |
@@ -310,11 +310,11 @@ discard block |
||
| 310 | 310 | $password = $this->getPassword(); |
| 311 | 311 | |
| 312 | 312 | // If remote is not an ownCloud do not try to get any share info |
| 313 | - if(!$this->remoteIsOwnCloud()) { |
|
| 313 | + if (!$this->remoteIsOwnCloud()) { |
|
| 314 | 314 | return ['status' => 'unsupported']; |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - $url = rtrim($remote, '/') . '/index.php/apps/files_sharing/shareinfo?t=' . $token; |
|
| 317 | + $url = rtrim($remote, '/').'/index.php/apps/files_sharing/shareinfo?t='.$token; |
|
| 318 | 318 | |
| 319 | 319 | // TODO: DI |
| 320 | 320 | $client = \OC::$server->getHTTPClientService()->newClient(); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | try { |
| 383 | 383 | $ocmPermissions = json_decode($ocmPermissions); |
| 384 | 384 | $ncPermissions = 0; |
| 385 | - foreach($ocmPermissions as $permission) { |
|
| 385 | + foreach ($ocmPermissions as $permission) { |
|
| 386 | 386 | switch (strtolower($permission)) { |
| 387 | 387 | case 'read': |
| 388 | 388 | $ncPermissions += Constants::PERMISSION_READ; |
@@ -4,13 +4,13 @@ discard block |
||
| 4 | 4 | script('federatedfilesharing', 'settings-admin'); |
| 5 | 5 | ?> |
| 6 | 6 | |
| 7 | -<?php if($_['internalOnly'] === false): ?> |
|
| 7 | +<?php if ($_['internalOnly'] === false): ?> |
|
| 8 | 8 | |
| 9 | 9 | <div id="fileSharingSettings" class="section"> |
| 10 | 10 | <h2> |
| 11 | - <?php p($l->t('Federated Cloud Sharing'));?> |
|
| 11 | + <?php p($l->t('Federated Cloud Sharing')); ?> |
|
| 12 | 12 | <a target="_blank" rel="noreferrer noopener" class="icon-info svg" |
| 13 | - title="<?php p($l->t('Open documentation'));?>" |
|
| 13 | + title="<?php p($l->t('Open documentation')); ?>" |
|
| 14 | 14 | href="<?php p(link_to_docs('admin-sharing-federated')); ?>"></a> |
| 15 | 15 | </h2> |
| 16 | 16 | |
@@ -20,29 +20,29 @@ discard block |
||
| 20 | 20 | <input type="checkbox" name="outgoing_server2server_share_enabled" id="outgoingServer2serverShareEnabled" class="checkbox" |
| 21 | 21 | value="1" <?php if ($_['outgoingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 22 | 22 | <label for="outgoingServer2serverShareEnabled"> |
| 23 | - <?php p($l->t('Allow users on this server to send shares to other servers'));?> |
|
| 23 | + <?php p($l->t('Allow users on this server to send shares to other servers')); ?> |
|
| 24 | 24 | </label> |
| 25 | 25 | </p> |
| 26 | 26 | <p> |
| 27 | 27 | <input type="checkbox" name="incoming_server2server_share_enabled" id="incomingServer2serverShareEnabled" class="checkbox" |
| 28 | 28 | value="1" <?php if ($_['incomingServer2serverShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 29 | 29 | <label for="incomingServer2serverShareEnabled"> |
| 30 | - <?php p($l->t('Allow users on this server to receive shares from other servers'));?> |
|
| 30 | + <?php p($l->t('Allow users on this server to receive shares from other servers')); ?> |
|
| 31 | 31 | </label><br/> |
| 32 | 32 | </p> |
| 33 | - <?php if($_['federatedGroupSharingSupported']): ?> |
|
| 33 | + <?php if ($_['federatedGroupSharingSupported']): ?> |
|
| 34 | 34 | <p> |
| 35 | 35 | <input type="checkbox" name="outgoing_server2server_group_share_enabled" id="outgoingServer2serverGroupShareEnabled" class="checkbox" |
| 36 | 36 | value="1" <?php if ($_['outgoingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 37 | 37 | <label for="outgoingServer2serverGroupShareEnabled"> |
| 38 | - <?php p($l->t('Allow users on this server to send shares to groups on other servers'));?> |
|
| 38 | + <?php p($l->t('Allow users on this server to send shares to groups on other servers')); ?> |
|
| 39 | 39 | </label> |
| 40 | 40 | </p> |
| 41 | 41 | <p> |
| 42 | 42 | <input type="checkbox" name="incoming_server2server_group_share_enabled" id="incomingServer2serverGroupShareEnabled" class="checkbox" |
| 43 | 43 | value="1" <?php if ($_['incomingServer2serverGroupShareEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 44 | 44 | <label for="incomingServer2serverGroupShareEnabled"> |
| 45 | - <?php p($l->t('Allow users on this server to receive group shares from other servers'));?> |
|
| 45 | + <?php p($l->t('Allow users on this server to receive group shares from other servers')); ?> |
|
| 46 | 46 | </label><br/> |
| 47 | 47 | </p> |
| 48 | 48 | <?php endif; ?> |
@@ -50,14 +50,14 @@ discard block |
||
| 50 | 50 | <input type="checkbox" name="lookupServerEnabled" id="lookupServerEnabled" class="checkbox" |
| 51 | 51 | value="1" <?php if ($_['lookupServerEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 52 | 52 | <label for="lookupServerEnabled"> |
| 53 | - <?php p($l->t('Search global and public address book for users'));?> |
|
| 53 | + <?php p($l->t('Search global and public address book for users')); ?> |
|
| 54 | 54 | </label><br/> |
| 55 | 55 | </p> |
| 56 | 56 | <p> |
| 57 | 57 | <input type="checkbox" name="lookupServerUploadEnabled" id="lookupServerUploadEnabled" class="checkbox" |
| 58 | 58 | value="1" <?php if ($_['lookupServerUploadEnabled']) print_unescaped('checked="checked"'); ?> /> |
| 59 | 59 | <label for="lookupServerUploadEnabled"> |
| 60 | - <?php p($l->t('Allow users to publish their data to a global and public address book'));?> |
|
| 60 | + <?php p($l->t('Allow users to publish their data to a global and public address book')); ?> |
|
| 61 | 61 | </label><br/> |
| 62 | 62 | </p> |
| 63 | 63 | |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | // for backward compatibility make sure that the remote url stored in the |
| 173 | 173 | // database ends with a trailing slash |
| 174 | 174 | if (substr($remote, -1) !== '/') { |
| 175 | - $remote = $remote . '/'; |
|
| 175 | + $remote = $remote.'/'; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | $token = $share->getShareSecret(); |
@@ -199,16 +199,16 @@ discard block |
||
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | // FIXME this should be a method in the user management instead |
| 202 | - $this->logger->debug('shareWith before, ' . $shareWith, ['app' => 'files_sharing']); |
|
| 202 | + $this->logger->debug('shareWith before, '.$shareWith, ['app' => 'files_sharing']); |
|
| 203 | 203 | Util::emitHook( |
| 204 | 204 | '\OCA\Files_Sharing\API\Server2Server', |
| 205 | 205 | 'preLoginNameUsedAsUserName', |
| 206 | 206 | array('uid' => &$shareWith) |
| 207 | 207 | ); |
| 208 | - $this->logger->debug('shareWith after, ' . $shareWith, ['app' => 'files_sharing']); |
|
| 208 | + $this->logger->debug('shareWith after, '.$shareWith, ['app' => 'files_sharing']); |
|
| 209 | 209 | |
| 210 | 210 | if (!$this->userManager->userExists($shareWith)) { |
| 211 | - throw new ProviderCouldNotAddShareException('User does not exists', '',Http::STATUS_BAD_REQUEST); |
|
| 211 | + throw new ProviderCouldNotAddShareException('User does not exists', '', Http::STATUS_BAD_REQUEST); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | \OC_Util::setupFS($shareWith); |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | ); |
| 227 | 227 | |
| 228 | 228 | try { |
| 229 | - $externalManager->addShare($remote, $token, '', $name, $owner, $shareType,false, $shareWith, $remoteId); |
|
| 229 | + $externalManager->addShare($remote, $token, '', $name, $owner, $shareType, false, $shareWith, $remoteId); |
|
| 230 | 230 | $shareId = \OC::$server->getDatabaseConnection()->lastInsertId('*PREFIX*share_external'); |
| 231 | 231 | |
| 232 | 232 | $event = $this->activityManager->generateEvent(); |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | ->setType('remote_share') |
| 235 | 235 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_RECEIVED, [$ownerFederatedId, trim($name, '/')]) |
| 236 | 236 | ->setAffectedUser($shareWith) |
| 237 | - ->setObject('remote_share', (int)$shareId, $name); |
|
| 237 | + ->setObject('remote_share', (int) $shareId, $name); |
|
| 238 | 238 | \OC::$server->getActivityManager()->publish($event); |
| 239 | 239 | |
| 240 | 240 | if ($shareType === Share::SHARE_TYPE_USER) { |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | 'level' => ILogger::ERROR, |
| 253 | 253 | 'app' => 'files_sharing' |
| 254 | 254 | ]); |
| 255 | - throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from ' . $remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
| 255 | + throw new ProviderCouldNotAddShareException('internal server error, was not able to add share from '.$remote, '', HTTP::STATUS_INTERNAL_SERVER_ERROR); |
|
| 256 | 256 | } |
| 257 | 257 | } |
| 258 | 258 | |
@@ -329,12 +329,12 @@ discard block |
||
| 329 | 329 | |
| 330 | 330 | $declineAction = $notification->createAction(); |
| 331 | 331 | $declineAction->setLabel('decline') |
| 332 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'DELETE'); |
|
| 332 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'DELETE'); |
|
| 333 | 333 | $notification->addAction($declineAction); |
| 334 | 334 | |
| 335 | 335 | $acceptAction = $notification->createAction(); |
| 336 | 336 | $acceptAction->setLabel('accept') |
| 337 | - ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/' . $shareId)), 'POST'); |
|
| 337 | + ->setLink($this->urlGenerator->getAbsoluteURL($this->urlGenerator->linkTo('', 'ocs/v2.php/apps/files_sharing/api/v1/remote_shares/pending/'.$shareId)), 'POST'); |
|
| 338 | 338 | $notification->addAction($acceptAction); |
| 339 | 339 | |
| 340 | 340 | $this->notificationManager->notify($notification); |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | */ |
| 395 | 395 | protected function executeAcceptShare(IShare $share) { |
| 396 | 396 | try { |
| 397 | - $fileId = (int)$share->getNode()->getId(); |
|
| 397 | + $fileId = (int) $share->getNode()->getId(); |
|
| 398 | 398 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
| 399 | 399 | } catch (\Exception $e) { |
| 400 | 400 | throw new ShareNotFound(); |
@@ -472,7 +472,7 @@ discard block |
||
| 472 | 472 | $this->federatedShareProvider->removeShareFromTable($share); |
| 473 | 473 | |
| 474 | 474 | try { |
| 475 | - $fileId = (int)$share->getNode()->getId(); |
|
| 475 | + $fileId = (int) $share->getNode()->getId(); |
|
| 476 | 476 | list($file, $link) = $this->getFile($this->getCorrectUid($share), $fileId); |
| 477 | 477 | } catch (\Exception $e) { |
| 478 | 478 | throw new ShareNotFound(); |
@@ -573,7 +573,7 @@ discard block |
||
| 573 | 573 | $notification = $this->notificationManager->createNotification(); |
| 574 | 574 | $notification->setApp('files_sharing') |
| 575 | 575 | ->setUser($share['user']) |
| 576 | - ->setObject('remote_share', (int)$share['id']); |
|
| 576 | + ->setObject('remote_share', (int) $share['id']); |
|
| 577 | 577 | $this->notificationManager->markProcessed($notification); |
| 578 | 578 | |
| 579 | 579 | $event = $this->activityManager->generateEvent(); |
@@ -581,7 +581,7 @@ discard block |
||
| 581 | 581 | ->setType('remote_share') |
| 582 | 582 | ->setSubject(RemoteShares::SUBJECT_REMOTE_SHARE_UNSHARED, [$owner->getId(), $path]) |
| 583 | 583 | ->setAffectedUser($user) |
| 584 | - ->setObject('remote_share', (int)$share['id'], $path); |
|
| 584 | + ->setObject('remote_share', (int) $share['id'], $path); |
|
| 585 | 585 | \OC::$server->getActivityManager()->publish($event); |
| 586 | 586 | } |
| 587 | 587 | |
@@ -629,7 +629,7 @@ discard block |
||
| 629 | 629 | $owner = $share->getShareOwner(); |
| 630 | 630 | $currentServer = $this->addressHandler->generateRemoteURL(); |
| 631 | 631 | if ($this->addressHandler->compareAddresses($user, $remote, $owner, $currentServer)) { |
| 632 | - throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: ' . $id); |
|
| 632 | + throw new ProviderCouldNotAddShareException('Resharing back to the owner is not allowed: '.$id); |
|
| 633 | 633 | } |
| 634 | 634 | } catch (\Exception $e) { |
| 635 | 635 | throw new ProviderCouldNotAddShareException($e->getMessage()); |
@@ -643,10 +643,10 @@ discard block |
||
| 643 | 643 | $share->setSharedBy($share->getSharedWith()); |
| 644 | 644 | $share->setSharedWith($shareWith); |
| 645 | 645 | $result = $this->federatedShareProvider->create($share); |
| 646 | - $this->federatedShareProvider->storeRemoteId((int)$result->getId(), $senderId); |
|
| 646 | + $this->federatedShareProvider->storeRemoteId((int) $result->getId(), $senderId); |
|
| 647 | 647 | return ['token' => $result->getToken(), 'providerId' => $result->getId()]; |
| 648 | 648 | } else { |
| 649 | - throw new ProviderCouldNotAddShareException('resharing not allowed for share: ' . $id); |
|
| 649 | + throw new ProviderCouldNotAddShareException('resharing not allowed for share: '.$id); |
|
| 650 | 650 | } |
| 651 | 651 | |
| 652 | 652 | } |
@@ -692,7 +692,7 @@ discard block |
||
| 692 | 692 | */ |
| 693 | 693 | protected function ocmPermissions2ncPermissions(array $ocmPermissions) { |
| 694 | 694 | $ncPermissions = 0; |
| 695 | - foreach($ocmPermissions as $permission) { |
|
| 695 | + foreach ($ocmPermissions as $permission) { |
|
| 696 | 696 | switch (strtolower($permission)) { |
| 697 | 697 | case 'read': |
| 698 | 698 | $ncPermissions += Constants::PERMISSION_READ; |