@@ -28,7 +28,6 @@ |
||
| 28 | 28 | use Icewind\Streams\CallbackWrapper; |
| 29 | 29 | use Icewind\Streams\IteratorDirectory; |
| 30 | 30 | use OC\Files\Cache\CacheEntry; |
| 31 | -use OC\Files\Stream\CountReadStream; |
|
| 32 | 31 | use OCP\Files\NotFoundException; |
| 33 | 32 | use OCP\Files\ObjectStore\IObjectStore; |
| 34 | 33 | |
@@ -57,9 +57,9 @@ discard block |
||
| 57 | 57 | throw new \Exception('missing IObjectStore instance'); |
| 58 | 58 | } |
| 59 | 59 | if (isset($params['storageid'])) { |
| 60 | - $this->id = 'object::store:' . $params['storageid']; |
|
| 60 | + $this->id = 'object::store:'.$params['storageid']; |
|
| 61 | 61 | } else { |
| 62 | - $this->id = 'object::store:' . $this->objectStore->getStorageId(); |
|
| 62 | + $this->id = 'object::store:'.$this->objectStore->getStorageId(); |
|
| 63 | 63 | } |
| 64 | 64 | if (isset($params['objectPrefix'])) { |
| 65 | 65 | $this->objectPrefix = $params['objectPrefix']; |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | if ($ex->getCode() !== 404) { |
| 194 | 194 | $this->logger->logException($ex, [ |
| 195 | 195 | 'app' => 'objectstore', |
| 196 | - 'message' => 'Could not delete object ' . $this->getURN($stat['fileid']) . ' for ' . $path, |
|
| 196 | + 'message' => 'Could not delete object '.$this->getURN($stat['fileid']).' for '.$path, |
|
| 197 | 197 | ]); |
| 198 | 198 | return false; |
| 199 | 199 | } else { |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | */ |
| 227 | 227 | protected function getURN($fileId) { |
| 228 | 228 | if (is_numeric($fileId)) { |
| 229 | - return $this->objectPrefix . $fileId; |
|
| 229 | + return $this->objectPrefix.$fileId; |
|
| 230 | 230 | } |
| 231 | 231 | return null; |
| 232 | 232 | } |
@@ -274,13 +274,13 @@ discard block |
||
| 274 | 274 | } catch (NotFoundException $e) { |
| 275 | 275 | $this->logger->logException($e, [ |
| 276 | 276 | 'app' => 'objectstore', |
| 277 | - 'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
| 277 | + 'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path, |
|
| 278 | 278 | ]); |
| 279 | 279 | throw $e; |
| 280 | 280 | } catch (\Exception $ex) { |
| 281 | 281 | $this->logger->logException($ex, [ |
| 282 | 282 | 'app' => 'objectstore', |
| 283 | - 'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
| 283 | + 'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path, |
|
| 284 | 284 | ]); |
| 285 | 285 | return false; |
| 286 | 286 | } |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | file_put_contents($tmpFile, $source); |
| 311 | 311 | } |
| 312 | 312 | $handle = fopen($tmpFile, $mode); |
| 313 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
| 313 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
| 314 | 314 | $this->writeBack($tmpFile, $path); |
| 315 | 315 | }); |
| 316 | 316 | } |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | public function file_exists($path) { |
| 321 | 321 | $path = $this->normalizePath($path); |
| 322 | - return (bool)$this->stat($path); |
|
| 322 | + return (bool) $this->stat($path); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | public function rename($source, $target) { |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | } catch (\Exception $ex) { |
| 377 | 377 | $this->logger->logException($ex, [ |
| 378 | 378 | 'app' => 'objectstore', |
| 379 | - 'message' => 'Could not create object for ' . $path, |
|
| 379 | + 'message' => 'Could not create object for '.$path, |
|
| 380 | 380 | ]); |
| 381 | 381 | return false; |
| 382 | 382 | } |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | $this->getCache()->remove($path); |
| 417 | 417 | $this->logger->logException($ex, [ |
| 418 | 418 | 'app' => 'objectstore', |
| 419 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
| 419 | + 'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path, |
|
| 420 | 420 | ]); |
| 421 | 421 | throw $ex; // make this bubble up |
| 422 | 422 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | throw new Forbidden(); |
| 95 | 95 | } |
| 96 | 96 | } catch (StorageNotAvailableException $e) { |
| 97 | - throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
| 97 | + throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | // verify path of the target |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | |
| 115 | 115 | if ($needsPartFile) { |
| 116 | 116 | // mark file as partial while uploading (ignored by the scanner) |
| 117 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
| 117 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
| 118 | 118 | } else { |
| 119 | 119 | // upload file directly as the final path |
| 120 | 120 | $partFilePath = $this->path; |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
| 143 | 143 | $expected = $_SERVER['CONTENT_LENGTH']; |
| 144 | 144 | } |
| 145 | - throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
| 145 | + throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | // if content length is sent by client: |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
| 152 | 152 | $expected = $_SERVER['CONTENT_LENGTH']; |
| 153 | 153 | if ($count != $expected) { |
| 154 | - throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); |
|
| 154 | + throw new BadRequest('expected filesize '.$expected.' got '.$count); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $fileExists = $storage->file_exists($internalPath); |
| 184 | 184 | } |
| 185 | 185 | if (!$run || $renameOkay === false || $fileExists === false) { |
| 186 | - \OCP\Util::writeLog('webdav', 'renaming part file to final file failed ($run: ' . ( $run ? 'true' : 'false' ) . ', $renameOkay: ' . ( $renameOkay ? 'true' : 'false' ) . ', $fileExists: ' . ( $fileExists ? 'true' : 'false' ) . ')', \OCP\Util::ERROR); |
|
| 186 | + \OCP\Util::writeLog('webdav', 'renaming part file to final file failed ($run: '.($run ? 'true' : 'false').', $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', \OCP\Util::ERROR); |
|
| 187 | 187 | throw new Exception('Could not rename part file to final file'); |
| 188 | 188 | } |
| 189 | 189 | } catch (ForbiddenException $ex) { |
@@ -232,10 +232,10 @@ discard block |
||
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | } catch (StorageNotAvailableException $e) { |
| 235 | - throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); |
|
| 235 | + throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | - return '"' . $this->info->getEtag() . '"'; |
|
| 238 | + return '"'.$this->info->getEtag().'"'; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | private function getPartFileBasePath($path) { |
@@ -318,15 +318,15 @@ discard block |
||
| 318 | 318 | return $res; |
| 319 | 319 | } catch (GenericEncryptionException $e) { |
| 320 | 320 | // returning 503 will allow retry of the operation at a later point in time |
| 321 | - throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
| 321 | + throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
| 322 | 322 | } catch (StorageNotAvailableException $e) { |
| 323 | - throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
| 323 | + throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
| 324 | 324 | } catch (ForbiddenException $ex) { |
| 325 | 325 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
| 326 | 326 | } catch (LockedException $e) { |
| 327 | 327 | throw new FileLocked($e->getMessage(), $e->getCode(), $e); |
| 328 | 328 | } catch (NotFoundException $e) { |
| 329 | - throw new NotFound('File not found: ' . $e->getMessage(), $e->getCode(), $e); |
|
| 329 | + throw new NotFound('File not found: '.$e->getMessage(), $e->getCode(), $e); |
|
| 330 | 330 | } |
| 331 | 331 | } |
| 332 | 332 | |
@@ -347,7 +347,7 @@ discard block |
||
| 347 | 347 | throw new Forbidden(); |
| 348 | 348 | } |
| 349 | 349 | } catch (StorageNotAvailableException $e) { |
| 350 | - throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
| 350 | + throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
| 351 | 351 | } catch (ForbiddenException $ex) { |
| 352 | 352 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
| 353 | 353 | } catch (LockedException $e) { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | if ($bytesWritten != $expected) { |
| 415 | 415 | $chunk_handler->remove($info['index']); |
| 416 | 416 | throw new BadRequest( |
| 417 | - 'expected filesize ' . $expected . ' got ' . $bytesWritten); |
|
| 417 | + 'expected filesize '.$expected.' got '.$bytesWritten); |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | $needsPartFile = $this->needsPartFile($storage); |
| 425 | 425 | $partFile = null; |
| 426 | 426 | |
| 427 | - $targetPath = $path . '/' . $info['name']; |
|
| 427 | + $targetPath = $path.'/'.$info['name']; |
|
| 428 | 428 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
| 429 | 429 | list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
| 430 | 430 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | |
| 441 | 441 | if ($needsPartFile) { |
| 442 | 442 | // we first assembly the target file as a part file |
| 443 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
| 443 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
| 444 | 444 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
| 445 | 445 | list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
| 446 | 446 | |
@@ -559,10 +559,10 @@ discard block |
||
| 559 | 559 | } |
| 560 | 560 | if ($e instanceof GenericEncryptionException) { |
| 561 | 561 | // returning 503 will allow retry of the operation at a later point in time |
| 562 | - throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
| 562 | + throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
| 563 | 563 | } |
| 564 | 564 | if ($e instanceof StorageNotAvailableException) { |
| 565 | - throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
| 565 | + throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
| 566 | 566 | } |
| 567 | 567 | |
| 568 | 568 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |