@@ -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 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | // Update the alternative mimetypes to avoid having to look them up each time. |
104 | 104 | foreach ($this->mimetypes as $mimeType) { |
105 | - $this->secureMimeTypes[$mimeType[0]] = isset($mimeType[1]) ? $mimeType[1]: $mimeType[0]; |
|
105 | + $this->secureMimeTypes[$mimeType[0]] = isset($mimeType[1]) ? $mimeType[1] : $mimeType[0]; |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | return; |
115 | 115 | } |
116 | 116 | |
117 | - $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypealiases.dist.json'), true); |
|
117 | + $this->mimeTypeAlias = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypealiases.dist.json'), true); |
|
118 | 118 | |
119 | - if (file_exists($this->customConfigDir . '/mimetypealiases.json')) { |
|
120 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/mimetypealiases.json'), true); |
|
119 | + if (file_exists($this->customConfigDir.'/mimetypealiases.json')) { |
|
120 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/mimetypealiases.json'), true); |
|
121 | 121 | $this->mimeTypeAlias = array_merge($this->mimeTypeAlias, $custom); |
122 | 122 | } |
123 | 123 | } |
@@ -138,11 +138,11 @@ discard block |
||
138 | 138 | return; |
139 | 139 | } |
140 | 140 | |
141 | - $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir . '/mimetypemapping.dist.json'), true); |
|
141 | + $mimetypeMapping = json_decode(file_get_contents($this->defaultConfigDir.'/mimetypemapping.dist.json'), true); |
|
142 | 142 | |
143 | 143 | //Check if need to load custom mappings |
144 | - if (file_exists($this->customConfigDir . '/mimetypemapping.json')) { |
|
145 | - $custom = json_decode(file_get_contents($this->customConfigDir . '/mimetypemapping.json'), true); |
|
144 | + if (file_exists($this->customConfigDir.'/mimetypemapping.json')) { |
|
145 | + $custom = json_decode(file_get_contents($this->customConfigDir.'/mimetypemapping.json'), true); |
|
146 | 146 | $mimetypeMapping = array_merge($mimetypeMapping, $custom); |
147 | 147 | } |
148 | 148 | |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | |
307 | 307 | // Icon exists? |
308 | 308 | try { |
309 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $icon . '.svg'); |
|
309 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$icon.'.svg'); |
|
310 | 310 | return $this->mimetypeIcons[$mimetype]; |
311 | 311 | } catch (\RuntimeException $e) { |
312 | 312 | // Specified image not found |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | // Try only the first part of the filetype |
316 | 316 | $mimePart = substr($icon, 0, strpos($icon, '-')); |
317 | 317 | try { |
318 | - $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/' . $mimePart . '.svg'); |
|
318 | + $this->mimetypeIcons[$mimetype] = $this->urlGenerator->imagePath('core', 'filetypes/'.$mimePart.'.svg'); |
|
319 | 319 | return $this->mimetypeIcons[$mimetype]; |
320 | 320 | } catch (\RuntimeException $e) { |
321 | 321 | // Image for the first part of the mimetype not found |
@@ -125,9 +125,9 @@ discard block |
||
125 | 125 | $path = '/'; |
126 | 126 | } |
127 | 127 | if ($path[0] !== '/') { |
128 | - $path = '/' . $path; |
|
128 | + $path = '/'.$path; |
|
129 | 129 | } |
130 | - return $this->fakeRoot . $path; |
|
130 | + return $this->fakeRoot.$path; |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | /** |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | public function chroot($fakeRoot) { |
140 | 140 | if (!$fakeRoot == '') { |
141 | 141 | if ($fakeRoot[0] !== '/') { |
142 | - $fakeRoot = '/' . $fakeRoot; |
|
142 | + $fakeRoot = '/'.$fakeRoot; |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | $this->fakeRoot = $fakeRoot; |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | // missing slashes can cause wrong matches! |
174 | - $root = rtrim($this->fakeRoot, '/') . '/'; |
|
174 | + $root = rtrim($this->fakeRoot, '/').'/'; |
|
175 | 175 | |
176 | 176 | if (strpos($path, $root) !== 0) { |
177 | 177 | return null; |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | if ($mount instanceof MoveableMount) { |
278 | 278 | // cut of /user/files to get the relative path to data/user/files |
279 | 279 | $pathParts = explode('/', $path, 4); |
280 | - $relPath = '/' . $pathParts[3]; |
|
280 | + $relPath = '/'.$pathParts[3]; |
|
281 | 281 | $this->lockFile($relPath, ILockingProvider::LOCK_SHARED, true); |
282 | 282 | \OC_Hook::emit( |
283 | 283 | Filesystem::CLASSNAME, "umount", |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | } |
689 | 689 | $postFix = (substr($path, -1, 1) === '/') ? '/' : ''; |
690 | 690 | $absolutePath = Filesystem::normalizePath($this->getAbsolutePath($path)); |
691 | - $mount = Filesystem::getMountManager()->find($absolutePath . $postFix); |
|
691 | + $mount = Filesystem::getMountManager()->find($absolutePath.$postFix); |
|
692 | 692 | if ($mount and $mount->getInternalPath($absolutePath) === '') { |
693 | 693 | return $this->removeMount($mount, $absolutePath); |
694 | 694 | } |
@@ -954,7 +954,7 @@ discard block |
||
954 | 954 | $hooks[] = 'write'; |
955 | 955 | break; |
956 | 956 | default: |
957 | - \OCP\Util::writeLog('core', 'invalid mode (' . $mode . ') for ' . $path, \OCP\Util::ERROR); |
|
957 | + \OCP\Util::writeLog('core', 'invalid mode ('.$mode.') for '.$path, \OCP\Util::ERROR); |
|
958 | 958 | } |
959 | 959 | |
960 | 960 | if ($mode !== 'r' && $mode !== 'w') { |
@@ -1058,7 +1058,7 @@ discard block |
||
1058 | 1058 | array(Filesystem::signal_param_path => $this->getHookPath($path)) |
1059 | 1059 | ); |
1060 | 1060 | } |
1061 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1061 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1062 | 1062 | if ($storage) { |
1063 | 1063 | $result = $storage->hash($type, $internalPath, $raw); |
1064 | 1064 | return $result; |
@@ -1109,7 +1109,7 @@ discard block |
||
1109 | 1109 | |
1110 | 1110 | $run = $this->runHooks($hooks, $path); |
1111 | 1111 | /** @var \OC\Files\Storage\Storage $storage */ |
1112 | - list($storage, $internalPath) = Filesystem::resolvePath($absolutePath . $postFix); |
|
1112 | + list($storage, $internalPath) = Filesystem::resolvePath($absolutePath.$postFix); |
|
1113 | 1113 | if ($run and $storage) { |
1114 | 1114 | if (in_array('write', $hooks) || in_array('delete', $hooks)) { |
1115 | 1115 | $this->changeLock($path, ILockingProvider::LOCK_EXCLUSIVE); |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | $unlockLater = true; |
1149 | 1149 | // make sure our unlocking callback will still be called if connection is aborted |
1150 | 1150 | ignore_user_abort(true); |
1151 | - $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { |
|
1151 | + $result = CallbackWrapper::wrap($result, null, null, function() use ($hooks, $path) { |
|
1152 | 1152 | if (in_array('write', $hooks)) { |
1153 | 1153 | $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); |
1154 | 1154 | } else if (in_array('read', $hooks)) { |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | return true; |
1210 | 1210 | } |
1211 | 1211 | |
1212 | - return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot . '/'); |
|
1212 | + return (strlen($fullPath) > strlen($defaultRoot)) && (substr($fullPath, 0, strlen($defaultRoot) + 1) === $defaultRoot.'/'); |
|
1213 | 1213 | } |
1214 | 1214 | |
1215 | 1215 | /** |
@@ -1228,7 +1228,7 @@ discard block |
||
1228 | 1228 | if ($hook != 'read') { |
1229 | 1229 | \OC_Hook::emit( |
1230 | 1230 | Filesystem::CLASSNAME, |
1231 | - $prefix . $hook, |
|
1231 | + $prefix.$hook, |
|
1232 | 1232 | array( |
1233 | 1233 | Filesystem::signal_param_run => &$run, |
1234 | 1234 | Filesystem::signal_param_path => $path |
@@ -1237,7 +1237,7 @@ discard block |
||
1237 | 1237 | } elseif (!$post) { |
1238 | 1238 | \OC_Hook::emit( |
1239 | 1239 | Filesystem::CLASSNAME, |
1240 | - $prefix . $hook, |
|
1240 | + $prefix.$hook, |
|
1241 | 1241 | array( |
1242 | 1242 | Filesystem::signal_param_path => $path |
1243 | 1243 | ) |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | return $this->getPartFileInfo($path); |
1333 | 1333 | } |
1334 | 1334 | $relativePath = $path; |
1335 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1335 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1336 | 1336 | |
1337 | 1337 | $mount = Filesystem::getMountManager()->find($path); |
1338 | 1338 | $storage = $mount->getStorage(); |
@@ -1356,7 +1356,7 @@ discard block |
||
1356 | 1356 | //add the sizes of other mount points to the folder |
1357 | 1357 | $extOnly = ($includeMountPoints === 'ext'); |
1358 | 1358 | $mounts = Filesystem::getMountManager()->findIn($path); |
1359 | - $info->setSubMounts(array_filter($mounts, function (IMountPoint $mount) use ($extOnly) { |
|
1359 | + $info->setSubMounts(array_filter($mounts, function(IMountPoint $mount) use ($extOnly) { |
|
1360 | 1360 | $subStorage = $mount->getStorage(); |
1361 | 1361 | return !($extOnly && $subStorage instanceof \OCA\Files_Sharing\SharedStorage); |
1362 | 1362 | })); |
@@ -1403,12 +1403,12 @@ discard block |
||
1403 | 1403 | /** |
1404 | 1404 | * @var \OC\Files\FileInfo[] $files |
1405 | 1405 | */ |
1406 | - $files = array_map(function (ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1406 | + $files = array_map(function(ICacheEntry $content) use ($path, $storage, $mount, $sharingDisabled) { |
|
1407 | 1407 | if ($sharingDisabled) { |
1408 | 1408 | $content['permissions'] = $content['permissions'] & ~\OCP\Constants::PERMISSION_SHARE; |
1409 | 1409 | } |
1410 | 1410 | $owner = $this->getUserObjectForOwner($storage->getOwner($content['path'])); |
1411 | - return new FileInfo($path . '/' . $content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1411 | + return new FileInfo($path.'/'.$content['name'], $storage, $content['path'], $content, $mount, $owner); |
|
1412 | 1412 | }, $contents); |
1413 | 1413 | |
1414 | 1414 | //add a folder for any mountpoint in this directory and add the sizes of other mountpoints to the folders |
@@ -1433,8 +1433,8 @@ discard block |
||
1433 | 1433 | // sometimes when the storage is not available it can be any exception |
1434 | 1434 | \OCP\Util::writeLog( |
1435 | 1435 | 'core', |
1436 | - 'Exception while scanning storage "' . $subStorage->getId() . '": ' . |
|
1437 | - get_class($e) . ': ' . $e->getMessage(), |
|
1436 | + 'Exception while scanning storage "'.$subStorage->getId().'": '. |
|
1437 | + get_class($e).': '.$e->getMessage(), |
|
1438 | 1438 | \OCP\Util::ERROR |
1439 | 1439 | ); |
1440 | 1440 | continue; |
@@ -1471,7 +1471,7 @@ discard block |
||
1471 | 1471 | break; |
1472 | 1472 | } |
1473 | 1473 | } |
1474 | - $rootEntry['path'] = substr(Filesystem::normalizePath($path . '/' . $rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1474 | + $rootEntry['path'] = substr(Filesystem::normalizePath($path.'/'.$rootEntry['name']), strlen($user) + 2); // full path without /$user/ |
|
1475 | 1475 | |
1476 | 1476 | // if sharing was disabled for the user we remove the share permissions |
1477 | 1477 | if (\OCP\Util::isSharingDisabledForUser()) { |
@@ -1479,14 +1479,14 @@ discard block |
||
1479 | 1479 | } |
1480 | 1480 | |
1481 | 1481 | $owner = $this->getUserObjectForOwner($subStorage->getOwner('')); |
1482 | - $files[] = new FileInfo($path . '/' . $rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1482 | + $files[] = new FileInfo($path.'/'.$rootEntry['name'], $subStorage, '', $rootEntry, $mount, $owner); |
|
1483 | 1483 | } |
1484 | 1484 | } |
1485 | 1485 | } |
1486 | 1486 | } |
1487 | 1487 | |
1488 | 1488 | if ($mimetype_filter) { |
1489 | - $files = array_filter($files, function (FileInfo $file) use ($mimetype_filter) { |
|
1489 | + $files = array_filter($files, function(FileInfo $file) use ($mimetype_filter) { |
|
1490 | 1490 | if (strpos($mimetype_filter, '/')) { |
1491 | 1491 | return $file->getMimetype() === $mimetype_filter; |
1492 | 1492 | } else { |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | if ($data instanceof FileInfo) { |
1516 | 1516 | $data = $data->getData(); |
1517 | 1517 | } |
1518 | - $path = Filesystem::normalizePath($this->fakeRoot . '/' . $path); |
|
1518 | + $path = Filesystem::normalizePath($this->fakeRoot.'/'.$path); |
|
1519 | 1519 | /** |
1520 | 1520 | * @var \OC\Files\Storage\Storage $storage |
1521 | 1521 | * @var string $internalPath |
@@ -1542,7 +1542,7 @@ discard block |
||
1542 | 1542 | * @return FileInfo[] |
1543 | 1543 | */ |
1544 | 1544 | public function search($query) { |
1545 | - return $this->searchCommon('search', array('%' . $query . '%')); |
|
1545 | + return $this->searchCommon('search', array('%'.$query.'%')); |
|
1546 | 1546 | } |
1547 | 1547 | |
1548 | 1548 | /** |
@@ -1593,10 +1593,10 @@ discard block |
||
1593 | 1593 | |
1594 | 1594 | $results = call_user_func_array(array($cache, $method), $args); |
1595 | 1595 | foreach ($results as $result) { |
1596 | - if (substr($mountPoint . $result['path'], 0, $rootLength + 1) === $this->fakeRoot . '/') { |
|
1596 | + if (substr($mountPoint.$result['path'], 0, $rootLength + 1) === $this->fakeRoot.'/') { |
|
1597 | 1597 | $internalPath = $result['path']; |
1598 | - $path = $mountPoint . $result['path']; |
|
1599 | - $result['path'] = substr($mountPoint . $result['path'], $rootLength); |
|
1598 | + $path = $mountPoint.$result['path']; |
|
1599 | + $result['path'] = substr($mountPoint.$result['path'], $rootLength); |
|
1600 | 1600 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1601 | 1601 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1602 | 1602 | } |
@@ -1614,8 +1614,8 @@ discard block |
||
1614 | 1614 | if ($results) { |
1615 | 1615 | foreach ($results as $result) { |
1616 | 1616 | $internalPath = $result['path']; |
1617 | - $result['path'] = rtrim($relativeMountPoint . $result['path'], '/'); |
|
1618 | - $path = rtrim($mountPoint . $internalPath, '/'); |
|
1617 | + $result['path'] = rtrim($relativeMountPoint.$result['path'], '/'); |
|
1618 | + $path = rtrim($mountPoint.$internalPath, '/'); |
|
1619 | 1619 | $owner = \OC::$server->getUserManager()->get($storage->getOwner($internalPath)); |
1620 | 1620 | $files[] = new FileInfo($path, $storage, $internalPath, $result, $mount, $owner); |
1621 | 1621 | } |
@@ -1636,7 +1636,7 @@ discard block |
||
1636 | 1636 | public function getOwner($path) { |
1637 | 1637 | $info = $this->getFileInfo($path); |
1638 | 1638 | if (!$info) { |
1639 | - throw new NotFoundException($path . ' not found while trying to get owner'); |
|
1639 | + throw new NotFoundException($path.' not found while trying to get owner'); |
|
1640 | 1640 | } |
1641 | 1641 | return $info->getOwner()->getUID(); |
1642 | 1642 | } |
@@ -1670,7 +1670,7 @@ discard block |
||
1670 | 1670 | * @return string |
1671 | 1671 | */ |
1672 | 1672 | public function getPath($id) { |
1673 | - $id = (int)$id; |
|
1673 | + $id = (int) $id; |
|
1674 | 1674 | $manager = Filesystem::getMountManager(); |
1675 | 1675 | $mounts = $manager->findIn($this->fakeRoot); |
1676 | 1676 | $mounts[] = $manager->find($this->fakeRoot); |
@@ -1685,7 +1685,7 @@ discard block |
||
1685 | 1685 | $cache = $mount->getStorage()->getCache(); |
1686 | 1686 | $internalPath = $cache->getPathById($id); |
1687 | 1687 | if (is_string($internalPath)) { |
1688 | - $fullPath = $mount->getMountPoint() . $internalPath; |
|
1688 | + $fullPath = $mount->getMountPoint().$internalPath; |
|
1689 | 1689 | if (!is_null($path = $this->getRelativePath($fullPath))) { |
1690 | 1690 | return $path; |
1691 | 1691 | } |
@@ -1728,10 +1728,10 @@ discard block |
||
1728 | 1728 | } |
1729 | 1729 | |
1730 | 1730 | // note: cannot use the view because the target is already locked |
1731 | - $fileId = (int)$targetStorage->getCache()->getId($targetInternalPath); |
|
1731 | + $fileId = (int) $targetStorage->getCache()->getId($targetInternalPath); |
|
1732 | 1732 | if ($fileId === -1) { |
1733 | 1733 | // target might not exist, need to check parent instead |
1734 | - $fileId = (int)$targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1734 | + $fileId = (int) $targetStorage->getCache()->getId(dirname($targetInternalPath)); |
|
1735 | 1735 | } |
1736 | 1736 | |
1737 | 1737 | // check if any of the parents were shared by the current owner (include collections) |
@@ -1831,7 +1831,7 @@ discard block |
||
1831 | 1831 | $resultPath = ''; |
1832 | 1832 | foreach ($parts as $part) { |
1833 | 1833 | if ($part) { |
1834 | - $resultPath .= '/' . $part; |
|
1834 | + $resultPath .= '/'.$part; |
|
1835 | 1835 | $result[] = $resultPath; |
1836 | 1836 | } |
1837 | 1837 | } |
@@ -2081,16 +2081,16 @@ discard block |
||
2081 | 2081 | public function getUidAndFilename($filename) { |
2082 | 2082 | $info = $this->getFileInfo($filename); |
2083 | 2083 | if (!$info instanceof \OCP\Files\FileInfo) { |
2084 | - throw new NotFoundException($this->getAbsolutePath($filename) . ' not found'); |
|
2084 | + throw new NotFoundException($this->getAbsolutePath($filename).' not found'); |
|
2085 | 2085 | } |
2086 | 2086 | $uid = $info->getOwner()->getUID(); |
2087 | 2087 | if ($uid != \OCP\User::getUser()) { |
2088 | 2088 | Filesystem::initMountPoints($uid); |
2089 | - $ownerView = new View('/' . $uid . '/files'); |
|
2089 | + $ownerView = new View('/'.$uid.'/files'); |
|
2090 | 2090 | try { |
2091 | 2091 | $filename = $ownerView->getPath($info['fileid']); |
2092 | 2092 | } catch (NotFoundException $e) { |
2093 | - throw new NotFoundException('File with id ' . $info['fileid'] . ' not found for user ' . $uid); |
|
2093 | + throw new NotFoundException('File with id '.$info['fileid'].' not found for user '.$uid); |
|
2094 | 2094 | } |
2095 | 2095 | } |
2096 | 2096 | return [$uid, $filename]; |
@@ -2107,7 +2107,7 @@ discard block |
||
2107 | 2107 | $directoryParts = array_filter($directoryParts); |
2108 | 2108 | foreach ($directoryParts as $key => $part) { |
2109 | 2109 | $currentPathElements = array_slice($directoryParts, 0, $key); |
2110 | - $currentPath = '/' . implode('/', $currentPathElements); |
|
2110 | + $currentPath = '/'.implode('/', $currentPathElements); |
|
2111 | 2111 | if ($this->is_file($currentPath)) { |
2112 | 2112 | return false; |
2113 | 2113 | } |