@@ -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; |
@@ -73,13 +73,13 @@ discard block |
||
73 | 73 | */ |
74 | 74 | public function getMountsForUser(IUser $user) { |
75 | 75 | $loader = $this->loader; |
76 | - $mounts = array_map(function (IMountProvider $provider) use ($user, $loader) { |
|
76 | + $mounts = array_map(function(IMountProvider $provider) use ($user, $loader) { |
|
77 | 77 | return $provider->getMountsForUser($user, $loader); |
78 | 78 | }, $this->providers); |
79 | - $mounts = array_filter($mounts, function ($result) { |
|
79 | + $mounts = array_filter($mounts, function($result) { |
|
80 | 80 | return is_array($result); |
81 | 81 | }); |
82 | - return array_reduce($mounts, function (array $mounts, array $providerMounts) { |
|
82 | + return array_reduce($mounts, function(array $mounts, array $providerMounts) { |
|
83 | 83 | return array_merge($mounts, $providerMounts); |
84 | 84 | }, array()); |
85 | 85 | } |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | $providers = array_reverse($this->homeProviders); // call the latest registered provider first to give apps an opportunity to overwrite builtin |
97 | 97 | foreach ($providers as $homeProvider) { |
98 | 98 | if ($mount = $homeProvider->getHomeMountForUser($user, $this->loader)) { |
99 | - $mount->setMountPoint('/' . $user->getUID()); //make sure the mountpoint is what we expect |
|
99 | + $mount->setMountPoint('/'.$user->getUID()); //make sure the mountpoint is what we expect |
|
100 | 100 | return $mount; |
101 | 101 | } |
102 | 102 | } |
103 | - throw new \Exception('No home storage configured for user ' . $user); |
|
103 | + throw new \Exception('No home storage configured for user '.$user); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | |
90 | 90 | public function registerMounts(IUser $user, array $mounts) { |
91 | 91 | // filter out non-proper storages coming from unit tests |
92 | - $mounts = array_filter($mounts, function (IMountPoint $mount) { |
|
92 | + $mounts = array_filter($mounts, function(IMountPoint $mount) { |
|
93 | 93 | return $mount instanceof SharedMount || $mount->getStorage() && $mount->getStorage()->getCache(); |
94 | 94 | }); |
95 | 95 | /** @var ICachedMountInfo[] $newMounts */ |
96 | - $newMounts = array_map(function (IMountPoint $mount) use ($user) { |
|
96 | + $newMounts = array_map(function(IMountPoint $mount) use ($user) { |
|
97 | 97 | // filter out any storages which aren't scanned yet since we aren't interested in files from those storages (yet) |
98 | 98 | if ($mount->getStorageRootId() === -1) { |
99 | 99 | return null; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $newMounts = array_values(array_filter($newMounts)); |
105 | 105 | |
106 | 106 | $cachedMounts = $this->getMountsForUser($user); |
107 | - $mountDiff = function (ICachedMountInfo $mount1, ICachedMountInfo $mount2) { |
|
107 | + $mountDiff = function(ICachedMountInfo $mount1, ICachedMountInfo $mount2) { |
|
108 | 108 | // since we are only looking for mounts for a specific user comparing on root id is enough |
109 | 109 | return $mount1->getRootId() - $mount2->getRootId(); |
110 | 110 | }; |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | ], ['root_id', 'user_id']); |
166 | 166 | } else { |
167 | 167 | // in some cases this is legitimate, like orphaned shares |
168 | - $this->logger->debug('Could not get storage info for mount at ' . $mount->getMountPoint()); |
|
168 | + $this->logger->debug('Could not get storage info for mount at '.$mount->getMountPoint()); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if (is_null($user)) { |
197 | 197 | return null; |
198 | 198 | } |
199 | - return new CachedMountInfo($user, (int)$row['storage_id'], (int)$row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path'])? $row['path']:''); |
|
199 | + return new CachedMountInfo($user, (int) $row['storage_id'], (int) $row['root_id'], $row['mount_point'], $row['mount_id'], isset($row['path']) ? $row['path'] : ''); |
|
200 | 200 | } |
201 | 201 | |
202 | 202 | /** |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $builder = $this->connection->getQueryBuilder(); |
227 | 227 | $query = $builder->select('storage_id', 'root_id', 'user_id', 'mount_point', 'mount_id', 'f.path') |
228 | 228 | ->from('mounts', 'm') |
229 | - ->innerJoin('m', 'filecache', 'f' , $builder->expr()->eq('m.root_id', 'f.fileid')) |
|
229 | + ->innerJoin('m', 'filecache', 'f', $builder->expr()->eq('m.root_id', 'f.fileid')) |
|
230 | 230 | ->where($builder->expr()->eq('storage_id', $builder->createPositionalParameter($numericStorageId, IQueryBuilder::PARAM_INT))); |
231 | 231 | |
232 | 232 | $rows = $query->execute()->fetchAll(); |
@@ -265,12 +265,12 @@ discard block |
||
265 | 265 | $row = $query->execute()->fetch(); |
266 | 266 | if (is_array($row)) { |
267 | 267 | $this->cacheInfoCache[$fileId] = [ |
268 | - (int)$row['storage'], |
|
268 | + (int) $row['storage'], |
|
269 | 269 | $row['path'], |
270 | - (int)$row['mimetype'] |
|
270 | + (int) $row['mimetype'] |
|
271 | 271 | ]; |
272 | 272 | } else { |
273 | - throw new NotFoundException('File with id "' . $fileId . '" not found'); |
|
273 | + throw new NotFoundException('File with id "'.$fileId.'" not found'); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | return $this->cacheInfoCache[$fileId]; |
@@ -290,13 +290,13 @@ discard block |
||
290 | 290 | $mountsForStorage = $this->getMountsForStorageId($storageId); |
291 | 291 | |
292 | 292 | // filter mounts that are from the same storage but a different directory |
293 | - return array_filter($mountsForStorage, function (ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
293 | + return array_filter($mountsForStorage, function(ICachedMountInfo $mount) use ($internalPath, $fileId) { |
|
294 | 294 | if ($fileId === $mount->getRootId()) { |
295 | 295 | return true; |
296 | 296 | } |
297 | 297 | $internalMountPath = $mount->getRootInternalPath(); |
298 | 298 | |
299 | - return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath . '/'; |
|
299 | + return $internalMountPath === '' || substr($internalPath, 0, strlen($internalMountPath) + 1) === $internalMountPath.'/'; |
|
300 | 300 | }); |
301 | 301 | } |
302 | 302 |
@@ -99,17 +99,17 @@ discard block |
||
99 | 99 | protected function attachListener($mount) { |
100 | 100 | $scanner = $mount->getStorage()->getScanner(); |
101 | 101 | $emitter = $this; |
102 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function ($path) use ($mount, $emitter) { |
|
103 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint() . $path)); |
|
102 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFile', function($path) use ($mount, $emitter) { |
|
103 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFile', array($mount->getMountPoint().$path)); |
|
104 | 104 | }); |
105 | - $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function ($path) use ($mount, $emitter) { |
|
106 | - $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint() . $path)); |
|
105 | + $scanner->listen('\OC\Files\Cache\Scanner', 'scanFolder', function($path) use ($mount, $emitter) { |
|
106 | + $emitter->emit('\OC\Files\Utils\Scanner', 'scanFolder', array($mount->getMountPoint().$path)); |
|
107 | 107 | }); |
108 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function ($path) use ($mount, $emitter) { |
|
109 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint() . $path)); |
|
108 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFile', function($path) use ($mount, $emitter) { |
|
109 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFile', array($mount->getMountPoint().$path)); |
|
110 | 110 | }); |
111 | - $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function ($path) use ($mount, $emitter) { |
|
112 | - $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint() . $path)); |
|
111 | + $scanner->listen('\OC\Files\Cache\Scanner', 'postScanFolder', function($path) use ($mount, $emitter) { |
|
112 | + $emitter->emit('\OC\Files\Utils\Scanner', 'postScanFolder', array($mount->getMountPoint().$path)); |
|
113 | 113 | }); |
114 | 114 | } |
115 | 115 | |
@@ -135,13 +135,13 @@ discard block |
||
135 | 135 | $scanner = $storage->getScanner(); |
136 | 136 | $this->attachListener($mount); |
137 | 137 | |
138 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
138 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
139 | 139 | $this->triggerPropagator($storage, $path); |
140 | 140 | }); |
141 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
141 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
142 | 142 | $this->triggerPropagator($storage, $path); |
143 | 143 | }); |
144 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
144 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
145 | 145 | $this->triggerPropagator($storage, $path); |
146 | 146 | }); |
147 | 147 | |
@@ -188,13 +188,13 @@ discard block |
||
188 | 188 | $this->attachListener($mount); |
189 | 189 | $isDbLocking = \OC::$server->getLockingProvider() instanceof DBLockingProvider; |
190 | 190 | |
191 | - $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function ($path) use ($storage) { |
|
191 | + $scanner->listen('\OC\Files\Cache\Scanner', 'removeFromCache', function($path) use ($storage) { |
|
192 | 192 | $this->triggerPropagator($storage, $path); |
193 | 193 | }); |
194 | - $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function ($path) use ($storage) { |
|
194 | + $scanner->listen('\OC\Files\Cache\Scanner', 'updateCache', function($path) use ($storage) { |
|
195 | 195 | $this->triggerPropagator($storage, $path); |
196 | 196 | }); |
197 | - $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function ($path) use ($storage) { |
|
197 | + $scanner->listen('\OC\Files\Cache\Scanner', 'addToCache', function($path) use ($storage) { |
|
198 | 198 | $this->triggerPropagator($storage, $path); |
199 | 199 | }); |
200 | 200 | |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | } |
213 | 213 | $propagator->commitBatch(); |
214 | 214 | } catch (StorageNotAvailableException $e) { |
215 | - $this->logger->error('Storage ' . $storage->getId() . ' not available'); |
|
215 | + $this->logger->error('Storage '.$storage->getId().' not available'); |
|
216 | 216 | $this->logger->logException($e); |
217 | 217 | $this->emit('\OC\Files\Utils\Scanner', 'StorageNotAvailable', [$e]); |
218 | 218 | } |
@@ -24,8 +24,8 @@ |
||
24 | 24 | use OCP\Files\ObjectStore\IObjectStore; |
25 | 25 | |
26 | 26 | // TODO: proper composer |
27 | -set_include_path(get_include_path() . PATH_SEPARATOR . |
|
28 | - \OC_App::getAppPath('files_external') . '/3rdparty/aws-sdk-php'); |
|
27 | +set_include_path(get_include_path().PATH_SEPARATOR. |
|
28 | + \OC_App::getAppPath('files_external').'/3rdparty/aws-sdk-php'); |
|
29 | 29 | require_once 'aws-autoloader.php'; |
30 | 30 | |
31 | 31 | class S3 implements IObjectStore { |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | throw new \Exception('missing IObjectStore instance'); |
54 | 54 | } |
55 | 55 | if (isset($params['storageid'])) { |
56 | - $this->id = 'object::store:' . $params['storageid']; |
|
56 | + $this->id = 'object::store:'.$params['storageid']; |
|
57 | 57 | } else { |
58 | - $this->id = 'object::store:' . $this->objectStore->getStorageId(); |
|
58 | + $this->id = 'object::store:'.$this->objectStore->getStorageId(); |
|
59 | 59 | } |
60 | 60 | if (isset($params['objectPrefix'])) { |
61 | 61 | $this->objectPrefix = $params['objectPrefix']; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $this->objectStore->deleteObject($this->getURN($stat['fileid'])); |
186 | 186 | } catch (\Exception $ex) { |
187 | 187 | if ($ex->getCode() !== 404) { |
188 | - \OCP\Util::writeLog('objectstore', 'Could not delete object: ' . $ex->getMessage(), \OCP\Util::ERROR); |
|
188 | + \OCP\Util::writeLog('objectstore', 'Could not delete object: '.$ex->getMessage(), \OCP\Util::ERROR); |
|
189 | 189 | return false; |
190 | 190 | } else { |
191 | 191 | //removing from cache is ok as it does not exist in the objectstore anyway |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function getURN($fileId) { |
219 | 219 | if (is_numeric($fileId)) { |
220 | - return $this->objectPrefix . $fileId; |
|
220 | + return $this->objectPrefix.$fileId; |
|
221 | 221 | } |
222 | 222 | return null; |
223 | 223 | } |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | try { |
264 | 264 | return $this->objectStore->readObject($this->getURN($stat['fileid'])); |
265 | 265 | } catch (\Exception $ex) { |
266 | - \OCP\Util::writeLog('objectstore', 'Could not get object: ' . $ex->getMessage(), \OCP\Util::ERROR); |
|
266 | + \OCP\Util::writeLog('objectstore', 'Could not get object: '.$ex->getMessage(), \OCP\Util::ERROR); |
|
267 | 267 | return false; |
268 | 268 | } |
269 | 269 | } else { |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | file_put_contents($tmpFile, $source); |
293 | 293 | } |
294 | 294 | $handle = fopen($tmpFile, $mode); |
295 | - return CallbackWrapper::wrap($handle, null, null, function () use ($path, $tmpFile) { |
|
295 | + return CallbackWrapper::wrap($handle, null, null, function() use ($path, $tmpFile) { |
|
296 | 296 | $this->writeBack($tmpFile, $path); |
297 | 297 | }); |
298 | 298 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | |
302 | 302 | public function file_exists($path) { |
303 | 303 | $path = $this->normalizePath($path); |
304 | - return (bool)$this->stat($path); |
|
304 | + return (bool) $this->stat($path); |
|
305 | 305 | } |
306 | 306 | |
307 | 307 | public function rename($source, $target) { |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | $this->objectStore->writeObject($this->getURN($fileId), fopen('php://memory', 'r')); |
358 | 358 | } catch (\Exception $ex) { |
359 | 359 | $this->getCache()->remove($path); |
360 | - \OCP\Util::writeLog('objectstore', 'Could not create object: ' . $ex->getMessage(), \OCP\Util::ERROR); |
|
360 | + \OCP\Util::writeLog('objectstore', 'Could not create object: '.$ex->getMessage(), \OCP\Util::ERROR); |
|
361 | 361 | return false; |
362 | 362 | } |
363 | 363 | } |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | $this->objectStore->writeObject($this->getURN($fileId), fopen($tmpFile, 'r')); |
387 | 387 | } catch (\Exception $ex) { |
388 | 388 | $this->getCache()->remove($path); |
389 | - \OCP\Util::writeLog('objectstore', 'Could not create object: ' . $ex->getMessage(), \OCP\Util::ERROR); |
|
389 | + \OCP\Util::writeLog('objectstore', 'Could not create object: '.$ex->getMessage(), \OCP\Util::ERROR); |
|
390 | 390 | throw $ex; // make this bubble up |
391 | 391 | } |
392 | 392 | } |