@@ -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 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | */ |
226 | 226 | protected function getURN($fileId) { |
227 | 227 | if (is_numeric($fileId)) { |
228 | - return $this->objectPrefix . $fileId; |
|
228 | + return $this->objectPrefix.$fileId; |
|
229 | 229 | } |
230 | 230 | return null; |
231 | 231 | } |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | } catch (NotFoundException $e) { |
280 | 280 | $this->logger->logException($e, [ |
281 | 281 | 'app' => 'objectstore', |
282 | - 'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
282 | + 'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path, |
|
283 | 283 | ]); |
284 | 284 | throw $e; |
285 | 285 | } catch (\Exception $ex) { |
286 | 286 | $this->logger->logException($ex, [ |
287 | 287 | 'app' => 'objectstore', |
288 | - 'message' => 'Could not get object ' . $this->getURN($stat['fileid']) . ' for file ' . $path, |
|
288 | + 'message' => 'Could not get object '.$this->getURN($stat['fileid']).' for file '.$path, |
|
289 | 289 | ]); |
290 | 290 | return false; |
291 | 291 | } |
@@ -298,7 +298,7 @@ discard block |
||
298 | 298 | case 'wb+': |
299 | 299 | $tmpFile = \OC::$server->getTempManager()->getTemporaryFile($ext); |
300 | 300 | $handle = fopen($tmpFile, $mode); |
301 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
301 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
302 | 302 | $this->writeBack($tmpFile, $path); |
303 | 303 | }); |
304 | 304 | case 'a': |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | file_put_contents($tmpFile, $source); |
316 | 316 | } |
317 | 317 | $handle = fopen($tmpFile, $mode); |
318 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
318 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
319 | 319 | $this->writeBack($tmpFile, $path); |
320 | 320 | }); |
321 | 321 | } |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | public function file_exists($path) { |
326 | 326 | $path = $this->normalizePath($path); |
327 | - return (bool)$this->stat($path); |
|
327 | + return (bool) $this->stat($path); |
|
328 | 328 | } |
329 | 329 | |
330 | 330 | public function rename($source, $target) { |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | } catch (\Exception $ex) { |
382 | 382 | $this->logger->logException($ex, [ |
383 | 383 | 'app' => 'objectstore', |
384 | - 'message' => 'Could not create object for ' . $path, |
|
384 | + 'message' => 'Could not create object for '.$path, |
|
385 | 385 | ]); |
386 | 386 | throw $ex; |
387 | 387 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | } |
427 | 427 | // update stat with new data |
428 | 428 | $mTime = time(); |
429 | - $stat['size'] = (int)$size; |
|
429 | + $stat['size'] = (int) $size; |
|
430 | 430 | $stat['mtime'] = $mTime; |
431 | 431 | $stat['storage_mtime'] = $mTime; |
432 | 432 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | try { |
441 | 441 | //upload to object storage |
442 | 442 | if ($size === null) { |
443 | - $countStream = CountReadStream::wrap($stream, function ($writtenSize) use ($fileId, &$size) { |
|
443 | + $countStream = CountReadStream::wrap($stream, function($writtenSize) use ($fileId, &$size) { |
|
444 | 444 | $this->getCache()->update($fileId, [ |
445 | 445 | 'size' => $writtenSize |
446 | 446 | ]); |
@@ -457,7 +457,7 @@ discard block |
||
457 | 457 | $this->getCache()->remove($path); |
458 | 458 | $this->logger->logException($ex, [ |
459 | 459 | 'app' => 'objectstore', |
460 | - 'message' => 'Could not create object ' . $this->getURN($fileId) . ' for ' . $path, |
|
460 | + 'message' => 'Could not create object '.$this->getURN($fileId).' for '.$path, |
|
461 | 461 | ]); |
462 | 462 | throw $ex; // make this bubble up |
463 | 463 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | throw new Forbidden(); |
123 | 123 | } |
124 | 124 | } catch (StorageNotAvailableException $e) { |
125 | - throw new ServiceUnavailable("File is not updatable: " . $e->getMessage()); |
|
125 | + throw new ServiceUnavailable("File is not updatable: ".$e->getMessage()); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | // verify path of the target |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | |
146 | 146 | if ($needsPartFile) { |
147 | 147 | // mark file as partial while uploading (ignored by the scanner) |
148 | - $partFilePath = $this->getPartFileBasePath($this->path) . '.ocTransferId' . rand() . '.part'; |
|
148 | + $partFilePath = $this->getPartFileBasePath($this->path).'.ocTransferId'.rand().'.part'; |
|
149 | 149 | } else { |
150 | 150 | // upload file directly as the final path |
151 | 151 | $partFilePath = $this->path; |
@@ -188,16 +188,16 @@ discard block |
||
188 | 188 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
189 | 189 | $expected = $_SERVER['CONTENT_LENGTH']; |
190 | 190 | } |
191 | - throw new Exception('Error while copying file to target location (copied bytes: ' . $count . ', expected filesize: ' . $expected . ' )'); |
|
191 | + throw new Exception('Error while copying file to target location (copied bytes: '.$count.', expected filesize: '.$expected.' )'); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | // if content length is sent by client: |
195 | 195 | // double check if the file was fully received |
196 | 196 | // compare expected and actual size |
197 | 197 | if (isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
198 | - $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
198 | + $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
199 | 199 | if ($count !== $expected) { |
200 | - throw new BadRequest('expected filesize ' . $expected . ' got ' . $count); |
|
200 | + throw new BadRequest('expected filesize '.$expected.' got '.$count); |
|
201 | 201 | } |
202 | 202 | } |
203 | 203 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | $renameOkay = $storage->moveFromStorage($partStorage, $internalPartPath, $internalPath); |
230 | 230 | $fileExists = $storage->file_exists($internalPath); |
231 | 231 | if ($renameOkay === false || $fileExists === false) { |
232 | - \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: ' . ($renameOkay ? 'true' : 'false') . ', $fileExists: ' . ($fileExists ? 'true' : 'false') . ')', ['app' => 'webdav']); |
|
232 | + \OC::$server->getLogger()->error('renaming part file to final file failed $renameOkay: '.($renameOkay ? 'true' : 'false').', $fileExists: '.($fileExists ? 'true' : 'false').')', ['app' => 'webdav']); |
|
233 | 233 | throw new Exception('Could not rename part file to final file'); |
234 | 234 | } |
235 | 235 | } catch (ForbiddenException $ex) { |
@@ -273,10 +273,10 @@ discard block |
||
273 | 273 | } |
274 | 274 | |
275 | 275 | } catch (StorageNotAvailableException $e) { |
276 | - throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); |
|
276 | + throw new ServiceUnavailable("Failed to check file size: ".$e->getMessage()); |
|
277 | 277 | } |
278 | 278 | |
279 | - return '"' . $this->info->getEtag() . '"'; |
|
279 | + return '"'.$this->info->getEtag().'"'; |
|
280 | 280 | } |
281 | 281 | |
282 | 282 | private function getPartFileBasePath($path) { |
@@ -363,9 +363,9 @@ discard block |
||
363 | 363 | return $res; |
364 | 364 | } catch (GenericEncryptionException $e) { |
365 | 365 | // returning 503 will allow retry of the operation at a later point in time |
366 | - throw new ServiceUnavailable("Encryption not ready: " . $e->getMessage()); |
|
366 | + throw new ServiceUnavailable("Encryption not ready: ".$e->getMessage()); |
|
367 | 367 | } catch (StorageNotAvailableException $e) { |
368 | - throw new ServiceUnavailable("Failed to open file: " . $e->getMessage()); |
|
368 | + throw new ServiceUnavailable("Failed to open file: ".$e->getMessage()); |
|
369 | 369 | } catch (ForbiddenException $ex) { |
370 | 370 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
371 | 371 | } catch (LockedException $e) { |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | throw new Forbidden(); |
391 | 391 | } |
392 | 392 | } catch (StorageNotAvailableException $e) { |
393 | - throw new ServiceUnavailable("Failed to unlink: " . $e->getMessage()); |
|
393 | + throw new ServiceUnavailable("Failed to unlink: ".$e->getMessage()); |
|
394 | 394 | } catch (ForbiddenException $ex) { |
395 | 395 | throw new DAVForbiddenException($ex->getMessage(), $ex->getRetry()); |
396 | 396 | } catch (LockedException $e) { |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | //detect aborted upload |
454 | 454 | if (isset ($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] === 'PUT') { |
455 | 455 | if (isset($_SERVER['CONTENT_LENGTH'])) { |
456 | - $expected = (int)$_SERVER['CONTENT_LENGTH']; |
|
456 | + $expected = (int) $_SERVER['CONTENT_LENGTH']; |
|
457 | 457 | if ($bytesWritten !== $expected) { |
458 | 458 | $chunk_handler->remove($info['index']); |
459 | 459 | throw new BadRequest( |
460 | - 'expected filesize ' . $expected . ' got ' . $bytesWritten); |
|
460 | + 'expected filesize '.$expected.' got '.$bytesWritten); |
|
461 | 461 | } |
462 | 462 | } |
463 | 463 | } |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | $needsPartFile = $storage->needsPartFile(); |
469 | 469 | $partFile = null; |
470 | 470 | |
471 | - $targetPath = $path . '/' . $info['name']; |
|
471 | + $targetPath = $path.'/'.$info['name']; |
|
472 | 472 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
473 | 473 | list($targetStorage, $targetInternalPath) = $this->fileView->resolvePath($targetPath); |
474 | 474 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | |
485 | 485 | if ($needsPartFile) { |
486 | 486 | // we first assembly the target file as a part file |
487 | - $partFile = $this->getPartFileBasePath($path . '/' . $info['name']) . '.ocTransferId' . $info['transferid'] . '.part'; |
|
487 | + $partFile = $this->getPartFileBasePath($path.'/'.$info['name']).'.ocTransferId'.$info['transferid'].'.part'; |
|
488 | 488 | /** @var \OC\Files\Storage\Storage $targetStorage */ |
489 | 489 | list($partStorage, $partInternalPath) = $this->fileView->resolvePath($partFile); |
490 | 490 | |
@@ -588,13 +588,13 @@ discard block |
||
588 | 588 | } |
589 | 589 | if ($e instanceof GenericEncryptionException) { |
590 | 590 | // returning 503 will allow retry of the operation at a later point in time |
591 | - throw new ServiceUnavailable('Encryption not ready: ' . $e->getMessage(), 0, $e); |
|
591 | + throw new ServiceUnavailable('Encryption not ready: '.$e->getMessage(), 0, $e); |
|
592 | 592 | } |
593 | 593 | if ($e instanceof StorageNotAvailableException) { |
594 | - throw new ServiceUnavailable('Failed to write file contents: ' . $e->getMessage(), 0, $e); |
|
594 | + throw new ServiceUnavailable('Failed to write file contents: '.$e->getMessage(), 0, $e); |
|
595 | 595 | } |
596 | 596 | if ($e instanceof NotFoundException) { |
597 | - throw new NotFound('File not found: ' . $e->getMessage(), 0, $e); |
|
597 | + throw new NotFound('File not found: '.$e->getMessage(), 0, $e); |
|
598 | 598 | } |
599 | 599 | |
600 | 600 | throw new \Sabre\DAV\Exception($e->getMessage(), 0, $e); |