@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | } else { |
106 | 106 | // Update old classes to new namespace |
107 | 107 | if (strpos($storage, 'OC_Filestorage_') !== false) { |
108 | - $storage = '\OC\Files\Storage\\' . substr($storage, 15); |
|
108 | + $storage = '\OC\Files\Storage\\'.substr($storage, 15); |
|
109 | 109 | } |
110 | 110 | $this->class = $storage; |
111 | 111 | $this->arguments = $arguments; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | return; |
158 | 158 | } |
159 | 159 | } else { |
160 | - \OCP\Util::writeLog('core', 'storage backend ' . $this->class . ' not found', \OCP\Util::ERROR); |
|
160 | + \OCP\Util::writeLog('core', 'storage backend '.$this->class.' not found', \OCP\Util::ERROR); |
|
161 | 161 | $this->invalidStorage = true; |
162 | 162 | return; |
163 | 163 | } |
@@ -207,13 +207,13 @@ discard block |
||
207 | 207 | */ |
208 | 208 | public function getInternalPath($path) { |
209 | 209 | $path = Filesystem::normalizePath($path, true, false, true); |
210 | - if ($this->mountPoint === $path or $this->mountPoint . '/' === $path) { |
|
210 | + if ($this->mountPoint === $path or $this->mountPoint.'/' === $path) { |
|
211 | 211 | $internalPath = ''; |
212 | 212 | } else { |
213 | 213 | $internalPath = substr($path, strlen($this->mountPoint)); |
214 | 214 | } |
215 | 215 | // substr returns false instead of an empty string, we always want a string |
216 | - return (string)$internalPath; |
|
216 | + return (string) $internalPath; |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | */ |
267 | 267 | public function getStorageRootId() { |
268 | 268 | if (is_null($this->rootId)) { |
269 | - $this->rootId = (int)$this->getStorage()->getCache()->getId(''); |
|
269 | + $this->rootId = (int) $this->getStorage()->getCache()->getId(''); |
|
270 | 270 | } |
271 | 271 | return $this->rootId; |
272 | 272 | } |
@@ -39,6 +39,6 @@ |
||
39 | 39 | */ |
40 | 40 | public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { |
41 | 41 | $arguments = ['user' => $user]; |
42 | - return new MountPoint('\OC\Files\Storage\Home', '/' . $user->getUID(), $arguments, $loader); |
|
42 | + return new MountPoint('\OC\Files\Storage\Home', '/'.$user->getUID(), $arguments, $loader); |
|
43 | 43 | } |
44 | 44 | } |
@@ -57,7 +57,7 @@ |
||
57 | 57 | * @param string $mountPoint |
58 | 58 | * @param string $target |
59 | 59 | */ |
60 | - public function moveMount($mountPoint, $target){ |
|
60 | + public function moveMount($mountPoint, $target) { |
|
61 | 61 | $this->mounts[$target] = $this->mounts[$mountPoint]; |
62 | 62 | unset($this->mounts[$mountPoint]); |
63 | 63 | } |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | throw new \RuntimeException('no instance id!'); |
74 | 74 | } |
75 | 75 | |
76 | - $name = 'appdata_' . $instanceId; |
|
76 | + $name = 'appdata_'.$instanceId; |
|
77 | 77 | |
78 | 78 | try { |
79 | 79 | $appDataFolder = $this->rootFolder->get($name); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | try { |
92 | 92 | $appDataFolder = $appDataFolder->newFolder($this->appId); |
93 | 93 | } catch (NotPermittedException $e) { |
94 | - throw new \RuntimeException('Could not get appdata folder for ' . $this->appId); |
|
94 | + throw new \RuntimeException('Could not get appdata folder for '.$this->appId); |
|
95 | 95 | } |
96 | 96 | } |
97 | 97 |
@@ -409,17 +409,17 @@ discard block |
||
409 | 409 | $userObject = $userManager->get($user); |
410 | 410 | |
411 | 411 | if (is_null($userObject)) { |
412 | - \OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, \OCP\Util::ERROR); |
|
412 | + \OCP\Util::writeLog('files', ' Backends provided no user object for '.$user, \OCP\Util::ERROR); |
|
413 | 413 | // reset flag, this will make it possible to rethrow the exception if called again |
414 | 414 | unset(self::$usersSetup[$user]); |
415 | - throw new \OC\User\NoUserException('Backends provided no user object for ' . $user); |
|
415 | + throw new \OC\User\NoUserException('Backends provided no user object for '.$user); |
|
416 | 416 | } |
417 | 417 | |
418 | 418 | $realUid = $userObject->getUID(); |
419 | 419 | // workaround in case of different casings |
420 | 420 | if ($user !== $realUid) { |
421 | 421 | $stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50)); |
422 | - \OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $realUid . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN); |
|
422 | + \OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "'.$realUid.'" got "'.$user.'". Stack: '.$stack, \OCP\Util::WARN); |
|
423 | 423 | $user = $realUid; |
424 | 424 | |
425 | 425 | // again with the correct casing |
@@ -453,11 +453,11 @@ discard block |
||
453 | 453 | } else { |
454 | 454 | self::getMountManager()->addMount(new MountPoint( |
455 | 455 | new NullStorage([]), |
456 | - '/' . $user |
|
456 | + '/'.$user |
|
457 | 457 | )); |
458 | 458 | self::getMountManager()->addMount(new MountPoint( |
459 | 459 | new NullStorage([]), |
460 | - '/' . $user . '/files' |
|
460 | + '/'.$user.'/files' |
|
461 | 461 | )); |
462 | 462 | } |
463 | 463 | \OC_Hook::emit('OC_Filesystem', 'post_initMountPoints', array('user' => $user)); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | private static function listenForNewMountProviders(MountProviderCollection $mountConfigManager, IUserManager $userManager) { |
473 | 473 | if (!self::$listeningForProviders) { |
474 | 474 | self::$listeningForProviders = true; |
475 | - $mountConfigManager->listen('\OC\Files\Config', 'registerMountProvider', function (IMountProvider $provider) use ($userManager) { |
|
475 | + $mountConfigManager->listen('\OC\Files\Config', 'registerMountProvider', function(IMountProvider $provider) use ($userManager) { |
|
476 | 476 | foreach (Filesystem::$usersSetup as $user => $setup) { |
477 | 477 | $userObject = $userManager->get($user); |
478 | 478 | if ($userObject) { |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * @return string |
568 | 568 | */ |
569 | 569 | static public function getLocalPath($path) { |
570 | - $datadir = \OC_User::getHome(\OC_User::getUser()) . '/files'; |
|
570 | + $datadir = \OC_User::getHome(\OC_User::getUser()).'/files'; |
|
571 | 571 | $newpath = $path; |
572 | 572 | if (strncmp($newpath, $datadir, strlen($datadir)) == 0) { |
573 | 573 | $newpath = substr($path, strlen($datadir)); |
@@ -584,7 +584,7 @@ discard block |
||
584 | 584 | static public function isValidPath($path) { |
585 | 585 | $path = self::normalizePath($path); |
586 | 586 | if (!$path || $path[0] !== '/') { |
587 | - $path = '/' . $path; |
|
587 | + $path = '/'.$path; |
|
588 | 588 | } |
589 | 589 | if (strpos($path, '/../') !== false || strrchr($path, '/') === '/..') { |
590 | 590 | return false; |
@@ -813,7 +813,7 @@ discard block |
||
813 | 813 | * conversion should get removed as soon as all existing |
814 | 814 | * function calls have been fixed. |
815 | 815 | */ |
816 | - $path = (string)$path; |
|
816 | + $path = (string) $path; |
|
817 | 817 | |
818 | 818 | $cacheKey = json_encode([$path, $stripTrailingSlash, $isAbsolutePath, $keepUnicode]); |
819 | 819 | |
@@ -835,7 +835,7 @@ discard block |
||
835 | 835 | |
836 | 836 | //add leading slash |
837 | 837 | if ($path[0] !== '/') { |
838 | - $path = '/' . $path; |
|
838 | + $path = '/'.$path; |
|
839 | 839 | } |
840 | 840 | |
841 | 841 | // remove '/./' |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $unencryptedSize, |
157 | 157 | $headerSize, |
158 | 158 | $signed, |
159 | - $wrapper = 'OC\Files\Stream\Encryption') { |
|
159 | + $wrapper = 'OC\Files\Stream\Encryption') { |
|
160 | 160 | |
161 | 161 | $context = stream_context_create(array( |
162 | 162 | 'ocencryption' => array( |
@@ -195,9 +195,9 @@ discard block |
||
195 | 195 | try { |
196 | 196 | stream_wrapper_register($protocol, $class); |
197 | 197 | if (@rewinddir($source) === false) { |
198 | - $wrapped = fopen($protocol . '://', $mode, false, $context); |
|
198 | + $wrapped = fopen($protocol.'://', $mode, false, $context); |
|
199 | 199 | } else { |
200 | - $wrapped = opendir($protocol . '://', $context); |
|
200 | + $wrapped = opendir($protocol.'://', $context); |
|
201 | 201 | } |
202 | 202 | } catch (\BadMethodCallException $e) { |
203 | 203 | stream_wrapper_unregister($protocol); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | if (array_key_exists($property, $context)) { |
222 | 222 | $this->{$property} = $context[$property]; |
223 | 223 | } else { |
224 | - throw new \BadMethodCallException('Invalid context, "' . $property . '" options not set'); |
|
224 | + throw new \BadMethodCallException('Invalid context, "'.$property.'" options not set'); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | return $context; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | // for seekable streams the pointer is moved back to the beginning of the encrypted block |
322 | 322 | // flush will start writing there when the position moves to another block |
323 | - $positionInFile = (int)floor($this->position / $this->unencryptedBlockSize) * |
|
323 | + $positionInFile = (int) floor($this->position / $this->unencryptedBlockSize) * |
|
324 | 324 | $this->util->getBlockSize() + $this->headerSize; |
325 | 325 | $resultFseek = $this->parentStreamSeek($positionInFile); |
326 | 326 | |
@@ -337,14 +337,14 @@ discard block |
||
337 | 337 | // update position and liberate $data |
338 | 338 | if ($remainingLength < ($this->unencryptedBlockSize - $blockPosition)) { |
339 | 339 | $this->cache = substr($this->cache, 0, $blockPosition) |
340 | - . $data . substr($this->cache, $blockPosition + $remainingLength); |
|
340 | + . $data.substr($this->cache, $blockPosition + $remainingLength); |
|
341 | 341 | $this->position += $remainingLength; |
342 | 342 | $length += $remainingLength; |
343 | 343 | $data = ''; |
344 | 344 | // if $data doesn't fit the current block, the fill the current block and reiterate |
345 | 345 | // after the block is filled, it is flushed and $data is updatedxxx |
346 | 346 | } else { |
347 | - $this->cache = substr($this->cache, 0, $blockPosition) . |
|
347 | + $this->cache = substr($this->cache, 0, $blockPosition). |
|
348 | 348 | substr($data, 0, $this->unencryptedBlockSize - $blockPosition); |
349 | 349 | $this->flush(); |
350 | 350 | $this->position += ($this->unencryptedBlockSize - $blockPosition); |
@@ -402,10 +402,10 @@ discard block |
||
402 | 402 | |
403 | 403 | public function stream_close() { |
404 | 404 | $this->flush('end'); |
405 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
406 | - $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); |
|
405 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
406 | + $remainingData = $this->encryptionModule->end($this->fullPath, $position.'end'); |
|
407 | 407 | if ($this->readOnly === false) { |
408 | - if(!empty($remainingData)) { |
|
408 | + if (!empty($remainingData)) { |
|
409 | 409 | parent::stream_write($remainingData); |
410 | 410 | } |
411 | 411 | $this->encryptionStorage->updateUnencryptedSize($this->fullPath, $this->unencryptedSize); |
@@ -424,16 +424,16 @@ discard block |
||
424 | 424 | // automatically attempted when the file is written to disk - |
425 | 425 | // we are handling that separately here and we don't want to |
426 | 426 | // get into an infinite loop |
427 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
428 | - $encrypted = $this->encryptionModule->encrypt($this->cache, $position . $positionPrefix); |
|
427 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
428 | + $encrypted = $this->encryptionModule->encrypt($this->cache, $position.$positionPrefix); |
|
429 | 429 | $bytesWritten = parent::stream_write($encrypted); |
430 | 430 | $this->writeFlag = false; |
431 | 431 | // Check whether the write concerns the last block |
432 | 432 | // If so then update the encrypted filesize |
433 | 433 | // Note that the unencrypted pointer and filesize are NOT yet updated when flush() is called |
434 | 434 | // We recalculate the encrypted filesize as we do not know the context of calling flush() |
435 | - $completeBlocksInFile=(int)floor($this->unencryptedSize/$this->unencryptedBlockSize); |
|
436 | - if ($completeBlocksInFile === (int)floor($this->position/$this->unencryptedBlockSize)) { |
|
435 | + $completeBlocksInFile = (int) floor($this->unencryptedSize / $this->unencryptedBlockSize); |
|
436 | + if ($completeBlocksInFile === (int) floor($this->position / $this->unencryptedBlockSize)) { |
|
437 | 437 | $this->size = $this->util->getBlockSize() * $completeBlocksInFile; |
438 | 438 | $this->size += $bytesWritten; |
439 | 439 | $this->size += $this->headerSize; |
@@ -452,9 +452,9 @@ discard block |
||
452 | 452 | if ($this->cache === '' && !($this->position === $this->unencryptedSize && ($this->position % $this->unencryptedBlockSize) === 0)) { |
453 | 453 | // Get the data from the file handle |
454 | 454 | $data = parent::stream_read($this->util->getBlockSize()); |
455 | - $position = (int)floor($this->position/$this->unencryptedBlockSize); |
|
456 | - $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); |
|
457 | - if($numberOfChunks === $position) { |
|
455 | + $position = (int) floor($this->position / $this->unencryptedBlockSize); |
|
456 | + $numberOfChunks = (int) ($this->unencryptedSize / $this->unencryptedBlockSize); |
|
457 | + if ($numberOfChunks === $position) { |
|
458 | 458 | $position .= 'end'; |
459 | 459 | } |
460 | 460 | $this->cache = $this->encryptionModule->decrypt($data, $position); |
@@ -66,10 +66,10 @@ |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | public function stream_seek($offset, $whence = SEEK_SET) { |
69 | - if ($whence === SEEK_END){ |
|
69 | + if ($whence === SEEK_END) { |
|
70 | 70 | // go to the end to find out last position's offset |
71 | 71 | $oldOffset = $this->stream_tell(); |
72 | - if (fseek($this->source, 0, $whence) !== 0){ |
|
72 | + if (fseek($this->source, 0, $whence) !== 0) { |
|
73 | 73 | return false; |
74 | 74 | } |
75 | 75 | $whence = SEEK_SET; |
@@ -33,15 +33,15 @@ |
||
33 | 33 | * @param array $params |
34 | 34 | */ |
35 | 35 | public function __construct($params) { |
36 | - if ( ! isset($params['user']) || ! $params['user'] instanceof User) { |
|
36 | + if (!isset($params['user']) || !$params['user'] instanceof User) { |
|
37 | 37 | throw new \Exception('missing user object in parameters'); |
38 | 38 | } |
39 | 39 | $this->user = $params['user']; |
40 | 40 | parent::__construct($params); |
41 | 41 | } |
42 | 42 | |
43 | - public function getId () { |
|
44 | - return 'object::user:' . $this->user->getUID(); |
|
43 | + public function getId() { |
|
44 | + return 'object::user:'.$this->user->getUID(); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -50,6 +50,6 @@ |
||
50 | 50 | public function getBucket($numBuckets = 64) { |
51 | 51 | $hash = md5($this->user->getUID()); |
52 | 52 | $num = hexdec(substr($hash, 0, 4)); |
53 | - return (string)($num % $numBuckets); |
|
53 | + return (string) ($num % $numBuckets); |
|
54 | 54 | } |
55 | 55 | } |