@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | if (isset($info['transferid'])) { |
| 91 | 91 | // getNodePath is called for multiple nodes within a chunk |
| 92 | 92 | // upload call |
| 93 | - $path = $dir . '/' . $info['name']; |
|
| 93 | + $path = $dir.'/'.$info['name']; |
|
| 94 | 94 | $path = ltrim($path, '/'); |
| 95 | 95 | } |
| 96 | 96 | } |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | } catch (StorageNotAvailableException $e) { |
| 162 | 162 | throw new \Sabre\DAV\Exception\ServiceUnavailable('Storage is temporarily not available'); |
| 163 | 163 | } catch (StorageInvalidException $e) { |
| 164 | - throw new \Sabre\DAV\Exception\NotFound('Storage ' . $path . ' is invalid'); |
|
| 164 | + throw new \Sabre\DAV\Exception\NotFound('Storage '.$path.' is invalid'); |
|
| 165 | 165 | } catch (LockedException $e) { |
| 166 | 166 | throw new \Sabre\DAV\Exception\Locked(); |
| 167 | 167 | } catch (ForbiddenException $e) { |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | if (!$info) { |
| 173 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 173 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | if ($info->getType() === 'dir') { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | } else { |
| 215 | 215 | $destinationPermission = $infoDestination && $infoDestination->isCreatable(); |
| 216 | 216 | } |
| 217 | - $sourcePermission = $infoSource && $infoSource->isDeletable(); |
|
| 217 | + $sourcePermission = $infoSource && $infoSource->isDeletable(); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | if (!$destinationPermission || !$sourcePermission) { |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | $targetNodeExists = $this->nodeExists($destinationPath); |
| 225 | 225 | $sourceNode = $this->getNodeForPath($sourcePath); |
| 226 | 226 | if ($sourceNode instanceof \Sabre\DAV\ICollection && $targetNodeExists) { |
| 227 | - throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory ' . $sourceNode->getName() . ', target exists'); |
|
| 227 | + throw new \Sabre\DAV\Exception\Forbidden('Could not copy directory '.$sourceNode->getName().', target exists'); |
|
| 228 | 228 | } |
| 229 | 229 | list($sourceDir,) = \Sabre\HTTP\URLUtil::splitPath($sourcePath); |
| 230 | 230 | list($destinationDir,) = \Sabre\HTTP\URLUtil::splitPath($destinationPath); |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | return; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - $ns = '{' . $this::NS_OWNCLOUD . '}'; |
|
| 175 | + $ns = '{'.$this::NS_OWNCLOUD.'}'; |
|
| 176 | 176 | $requestedProps = []; |
| 177 | 177 | $filterRules = []; |
| 178 | 178 | |
| 179 | 179 | // parse report properties and gather filter info |
| 180 | 180 | foreach ($report as $reportProps) { |
| 181 | 181 | $name = $reportProps['name']; |
| 182 | - if ($name === $ns . 'filter-rules') { |
|
| 182 | + if ($name === $ns.'filter-rules') { |
|
| 183 | 183 | $filterRules = $reportProps['value']; |
| 184 | 184 | } else if ($name === '{DAV:}prop') { |
| 185 | 185 | // propfind properties |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | if (empty($filesUri)) { |
| 241 | 241 | return ''; |
| 242 | 242 | } |
| 243 | - return '/' . $filesUri; |
|
| 243 | + return '/'.$filesUri; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | /** |
@@ -252,15 +252,15 @@ discard block |
||
| 252 | 252 | * @throws TagNotFoundException whenever a tag was not found |
| 253 | 253 | */ |
| 254 | 254 | protected function processFilterRules($filterRules) { |
| 255 | - $ns = '{' . $this::NS_OWNCLOUD . '}'; |
|
| 255 | + $ns = '{'.$this::NS_OWNCLOUD.'}'; |
|
| 256 | 256 | $resultFileIds = null; |
| 257 | 257 | $systemTagIds = []; |
| 258 | 258 | $favoriteFilter = null; |
| 259 | 259 | foreach ($filterRules as $filterRule) { |
| 260 | - if ($filterRule['name'] === $ns . 'systemtag') { |
|
| 260 | + if ($filterRule['name'] === $ns.'systemtag') { |
|
| 261 | 261 | $systemTagIds[] = $filterRule['value']; |
| 262 | 262 | } |
| 263 | - if ($filterRule['name'] === $ns . 'favorite') { |
|
| 263 | + if ($filterRule['name'] === $ns.'favorite') { |
|
| 264 | 264 | $favoriteFilter = true; |
| 265 | 265 | } |
| 266 | 266 | } |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | if (!empty($unknownTagIds)) { |
| 302 | - throw new TagNotFoundException('Tag with ids ' . implode(', ', $unknownTagIds) . ' not found'); |
|
| 302 | + throw new TagNotFoundException('Tag with ids '.implode(', ', $unknownTagIds).' not found'); |
|
| 303 | 303 | } |
| 304 | 304 | } |
| 305 | 305 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | public function prepareResponses($filesUri, $requestedProps, $nodes) { |
| 340 | 340 | $responses = []; |
| 341 | 341 | foreach ($nodes as $node) { |
| 342 | - $propFind = new PropFind($filesUri . $node->getPath(), $requestedProps); |
|
| 342 | + $propFind = new PropFind($filesUri.$node->getPath(), $requestedProps); |
|
| 343 | 343 | |
| 344 | 344 | $this->server->getPropertiesByNode($propFind, $node); |
| 345 | 345 | // copied from Sabre Server's getPropertiesForPath |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | $responses[] = new Response( |
| 355 | - rtrim($this->server->getBaseUri(), '/') . $filesUri . $node->getPath(), |
|
| 355 | + rtrim($this->server->getBaseUri(), '/').$filesUri.$node->getPath(), |
|
| 356 | 356 | $result, |
| 357 | 357 | 200 |
| 358 | 358 | ); |
@@ -66,7 +66,7 @@ |
||
| 66 | 66 | function xmlSerialize(Writer $writer) { |
| 67 | 67 | |
| 68 | 68 | foreach ($this->checksums as $checksum) { |
| 69 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum); |
|
| 69 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}checksum', $checksum); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | } |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | // exit if we can't create a new file and we don't updatable existing file |
| 116 | 116 | $info = \OC_FileChunking::decodeName($name); |
| 117 | 117 | if (!$this->fileView->isCreatable($this->path) && |
| 118 | - !$this->fileView->isUpdatable($this->path . '/' . $info['name']) |
|
| 118 | + !$this->fileView->isUpdatable($this->path.'/'.$info['name']) |
|
| 119 | 119 | ) { |
| 120 | 120 | throw new \Sabre\DAV\Exception\Forbidden(); |
| 121 | 121 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $this->fileView->verifyPath($this->path, $name); |
| 131 | 131 | |
| 132 | - $path = $this->fileView->getAbsolutePath($this->path) . '/' . $name; |
|
| 132 | + $path = $this->fileView->getAbsolutePath($this->path).'/'.$name; |
|
| 133 | 133 | // using a dummy FileInfo is acceptable here since it will be refreshed after the put is complete |
| 134 | 134 | $info = new \OC\Files\FileInfo($path, null, null, array(), null); |
| 135 | 135 | $node = new \OCA\DAV\Connector\Sabre\File($this->fileView, $info); |
@@ -162,9 +162,9 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $this->fileView->verifyPath($this->path, $name); |
| 165 | - $newPath = $this->path . '/' . $name; |
|
| 165 | + $newPath = $this->path.'/'.$name; |
|
| 166 | 166 | if (!$this->fileView->mkdir($newPath)) { |
| 167 | - throw new \Sabre\DAV\Exception\Forbidden('Could not create directory ' . $newPath); |
|
| 167 | + throw new \Sabre\DAV\Exception\Forbidden('Could not create directory '.$newPath); |
|
| 168 | 168 | } |
| 169 | 169 | } catch (\OCP\Files\StorageNotAvailableException $e) { |
| 170 | 170 | throw new \Sabre\DAV\Exception\ServiceUnavailable($e->getMessage()); |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @throws \Sabre\DAV\Exception\ServiceUnavailable |
| 189 | 189 | */ |
| 190 | 190 | public function getChild($name, $info = null) { |
| 191 | - $path = $this->path . '/' . $name; |
|
| 191 | + $path = $this->path.'/'.$name; |
|
| 192 | 192 | if (is_null($info)) { |
| 193 | 193 | try { |
| 194 | 194 | $this->fileView->verifyPath($this->path, $name); |
@@ -203,7 +203,7 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | if (!$info) { |
| 206 | - throw new \Sabre\DAV\Exception\NotFound('File with name ' . $path . ' could not be located'); |
|
| 206 | + throw new \Sabre\DAV\Exception\NotFound('File with name '.$path.' could not be located'); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | if ($info['mimetype'] == 'httpd/unix-directory') { |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | // (required old code) instead of "updateFile". |
| 256 | 256 | // |
| 257 | 257 | // TODO: resolve chunk file name here and implement "updateFile" |
| 258 | - $path = $this->path . '/' . $name; |
|
| 258 | + $path = $this->path.'/'.$name; |
|
| 259 | 259 | return $this->fileView->file_exists($path); |
| 260 | 260 | |
| 261 | 261 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | */ |
| 65 | 65 | public function beforeHandler(RequestInterface $request) { |
| 66 | 66 | $userAgent = $request->getHeader('User-Agent'); |
| 67 | - if($userAgent === null) { |
|
| 67 | + if ($userAgent === null) { |
|
| 68 | 68 | return; |
| 69 | 69 | } |
| 70 | 70 | |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | // Match on the mirall version which is in scheme "Mozilla/5.0 (%1) mirall/%2" or |
| 74 | 74 | // "mirall/%1" for older releases |
| 75 | 75 | preg_match("/(?:mirall\\/)([\d.]+)/i", $userAgent, $versionMatches); |
| 76 | - if(isset($versionMatches[1]) && |
|
| 76 | + if (isset($versionMatches[1]) && |
|
| 77 | 77 | version_compare($versionMatches[1], $minimumSupportedDesktopVersion) === -1) { |
| 78 | 78 | throw new \Sabre\DAV\Exception\Forbidden('Unsupported client version.'); |
| 79 | 79 | } |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * @return mixed|string |
| 100 | 100 | */ |
| 101 | 101 | public function getCommentsLink(Node $node) { |
| 102 | - $href = $this->server->getBaseUri(); |
|
| 102 | + $href = $this->server->getBaseUri(); |
|
| 103 | 103 | $entryPoint = strpos($href, '/remote.php/'); |
| 104 | - if($entryPoint === false) { |
|
| 104 | + if ($entryPoint === false) { |
|
| 105 | 105 | // in case we end up somewhere else, unexpectedly. |
| 106 | 106 | return null; |
| 107 | 107 | } |
| 108 | - $commentsPart = 'dav/comments/files/' . rawurldecode($node->getId()); |
|
| 108 | + $commentsPart = 'dav/comments/files/'.rawurldecode($node->getId()); |
|
| 109 | 109 | $href = substr_replace($href, $commentsPart, $entryPoint + strlen('/remote.php/')); |
| 110 | 110 | return $href; |
| 111 | 111 | } |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | */ |
| 120 | 120 | public function getUnreadCount(Node $node) { |
| 121 | 121 | $user = $this->userSession->getUser(); |
| 122 | - if(is_null($user)) { |
|
| 122 | + if (is_null($user)) { |
|
| 123 | 123 | return null; |
| 124 | 124 | } |
| 125 | 125 | |
@@ -71,8 +71,8 @@ discard block |
||
| 71 | 71 | return null; |
| 72 | 72 | } |
| 73 | 73 | foreach ($tree as $elem) { |
| 74 | - if ($elem['name'] === '{' . self::NS_OWNCLOUD . '}share-type') { |
|
| 75 | - $shareTypes[] = (int)$elem['value']; |
|
| 74 | + if ($elem['name'] === '{'.self::NS_OWNCLOUD.'}share-type') { |
|
| 75 | + $shareTypes[] = (int) $elem['value']; |
|
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | return new self($shareTypes); |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | function xmlSerialize(Writer $writer) { |
| 88 | 88 | foreach ($this->shareTypes as $shareType) { |
| 89 | - $writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType); |
|
| 89 | + $writer->writeElement('{'.self::NS_OWNCLOUD.'}share-type', $shareType); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -92,7 +92,7 @@ discard block |
||
| 92 | 92 | throw new Forbidden(); |
| 93 | 93 | } |
| 94 | 94 | } catch (StorageNotAvailableException $e) { |
| 95 | - throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
| 95 | + throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | // verify path of the target |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | if ($needsPartFile) { |
| 114 | 114 | // mark file as partial while uploading (ignored by the scanner) |
| 115 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
| 115 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
| 116 | 116 | } else { |
| 117 | 117 | // upload file directly as the final path |
| 118 | 118 | $partFilePath = $this->path; |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
| 139 | 139 | $expected = $_SERVER['CONTENT_LENGTH']; |
| 140 | 140 | } |
| 141 | - throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
| 141 | + throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // if content length is sent by client: |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
| 148 | 148 | $expected = $_SERVER['CONTENT_LENGTH']; |
| 149 | 149 | if ($count != $expected) { |
| 150 | - throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); |
|
| 150 | + throw new BadRequest('expected filesize '.$expected.' got '.$count); |
|
| 151 | 151 | } |
| 152 | 152 | } |
| 153 | 153 | |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | } catch (StorageNotAvailableException $e) { |
| 230 | - throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); |
|
| 230 | + throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | - return '"' . $this->info->getEtag() . '"'; |
|
| 233 | + return '"'.$this->info->getEtag().'"'; |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | private function getPartFileBasePath($path) { |
@@ -309,9 +309,9 @@ discard block |
||
| 309 | 309 | return $res; |
| 310 | 310 | } catch (GenericEncryptionException $e) { |
| 311 | 311 | // returning 503 will allow retry of the operation at a later point in time |
| 312 | - throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
| 312 | + throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
| 313 | 313 | } catch (StorageNotAvailableException $e) { |
| 314 | - throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
| 314 | + throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
| 315 | 315 | } catch (ForbiddenException $ex) { |
| 316 | 316 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
| 317 | 317 | } catch (LockedException $e) { |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | throw new Forbidden(); |
| 337 | 337 | } |
| 338 | 338 | } catch (StorageNotAvailableException $e) { |
| 339 | - throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
| 339 | + throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
| 340 | 340 | } catch (ForbiddenException $ex) { |
| 341 | 341 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
| 342 | 342 | } catch (LockedException $e) { |
@@ -403,7 +403,7 @@ discard block |
||
| 403 | 403 | if ($bytesWritten != $expected) { |
| 404 | 404 | $chunk_handler->remove($info['index']); |
| 405 | 405 | throw new BadRequest( |
| 406 | - 'expected filesize ' . $expected . ' got ' . $bytesWritten); |
|
| 406 | + 'expected filesize '.$expected.' got '.$bytesWritten); |
|
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | 409 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | $needsPartFile = $this->needsPartFile($storage); |
| 414 | 414 | $partFile = null; |
| 415 | 415 | |
| 416 | - $targetPath = $path . '/' . $info['name']; |
|
| 416 | + $targetPath = $path.'/'.$info['name']; |
|
| 417 | 417 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
| 418 | 418 | list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
| 419 | 419 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | if ($needsPartFile) { |
| 431 | 431 | // we first assembly the target file as a part file |
| 432 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
| 432 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
| 433 | 433 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
| 434 | 434 | list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
| 435 | 435 | |
@@ -548,10 +548,10 @@ discard block |
||
| 548 | 548 | } |
| 549 | 549 | if ($e instanceof GenericEncryptionException) { |
| 550 | 550 | // returning 503 will allow retry of the operation at a later point in time |
| 551 | - throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
| 551 | + throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
| 552 | 552 | } |
| 553 | 553 | if ($e instanceof StorageNotAvailableException) { |
| 554 | - throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
| 554 | + throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |
@@ -49,17 +49,17 @@ |
||
| 49 | 49 | * @param \DOMElement $errorNode |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function serialize(\Sabre\DAV\Server $server,\DOMElement $errorNode) { |
|
| 52 | + public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) { |
|
| 53 | 53 | |
| 54 | 54 | // set ownCloud namespace |
| 55 | 55 | $errorNode->setAttribute('xmlns:o', self::NS_OWNCLOUD); |
| 56 | 56 | |
| 57 | 57 | // adding the retry node |
| 58 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:retry', var_export($this->retry, true)); |
|
| 58 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:retry', var_export($this->retry, true)); |
|
| 59 | 59 | $errorNode->appendChild($error); |
| 60 | 60 | |
| 61 | 61 | // adding the message node |
| 62 | - $error = $errorNode->ownerDocument->createElementNS('o:','o:reason', $this->getMessage()); |
|
| 62 | + $error = $errorNode->ownerDocument->createElementNS('o:', 'o:reason', $this->getMessage()); |
|
| 63 | 63 | $errorNode->appendChild($error); |
| 64 | 64 | } |
| 65 | 65 | } |