diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 14:19:56 +0200 |
commit | caff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch) | |
tree | 186d494c2aea5dea7255d3584ef5d595fc6e6194 /lib/private/Files | |
parent | edf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff) | |
download | nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip |
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds
unified formatting for control structures like if and loops as well as
classes, their methods and anonymous functions. This basically forces
the constructs to start on the same line. This is not exactly what PSR2
wants, but I think we can have a few exceptions with "our" style. The
starting of braces on the same line is pracrically standard for our
code.
This also removes and empty lines from method/function bodies at the
beginning and end.
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Files')
33 files changed, 37 insertions, 87 deletions
diff --git a/lib/private/Files/AppData/AppData.php b/lib/private/Files/AppData/AppData.php index 32f97034050..5f917afe207 100644 --- a/lib/private/Files/AppData/AppData.php +++ b/lib/private/Files/AppData/AppData.php @@ -65,7 +65,6 @@ class AppData implements IAppData { public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig, string $appId) { - $this->rootFolder = $rootFolder; $this->config = $systemConfig; $this->appId = $appId; diff --git a/lib/private/Files/AppData/Factory.php b/lib/private/Files/AppData/Factory.php index 085c17f3589..4801b241c0b 100644 --- a/lib/private/Files/AppData/Factory.php +++ b/lib/private/Files/AppData/Factory.php @@ -42,7 +42,6 @@ class Factory { public function __construct(IRootFolder $rootFolder, SystemConfig $systemConfig) { - $this->rootFolder = $rootFolder; $this->config = $systemConfig; } diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index bce9a1d88e0..2dfefeff662 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -331,7 +331,6 @@ class Cache implements ICache { * @param array $data [$key => $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged */ public function update($id, array $data) { - if (isset($data['path'])) { // normalize path $data['path'] = $this->normalize($data['path']); @@ -990,7 +989,6 @@ class Cache implements ICache { * @return string */ public function normalize($path) { - return trim(\OC_Util::normalizeUnicode($path), '/'); } } diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index 7a1eae3498a..92fa6436548 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -200,6 +200,4 @@ class Propagator implements IPropagator { $this->connection->commit(); } - - } diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index 87f32538ec7..2a5a6536697 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -238,7 +238,6 @@ class Scanner extends BasicEmitter implements IScanner { $this->emit('\OC\Files\Cache\Scanner', 'postScanFile', [$file, $this->storageId]); \OC_Hook::emit('\OC\Files\Cache\Scanner', 'post_scan_file', ['path' => $file, 'storage' => $this->storageId]); } - } else { $this->removeFromCache($file); } diff --git a/lib/private/Files/Cache/Storage.php b/lib/private/Files/Cache/Storage.php index ca573be798a..62228e16290 100644 --- a/lib/private/Files/Cache/Storage.php +++ b/lib/private/Files/Cache/Storage.php @@ -126,7 +126,6 @@ class Storage { * @return string|null either the storage id string or null if the numeric id is not known */ public static function getStorageId($numericId) { - $sql = 'SELECT `id` FROM `*PREFIX*storages` WHERE `numeric_id` = ?'; $result = \OC_DB::executeAudited($sql, [$numericId]); if ($row = $result->fetchRow()) { diff --git a/lib/private/Files/Cache/Updater.php b/lib/private/Files/Cache/Updater.php index 378cadfcace..60534a153dd 100644 --- a/lib/private/Files/Cache/Updater.php +++ b/lib/private/Files/Cache/Updater.php @@ -167,7 +167,6 @@ class Updater implements IUpdater { $this->cache->correctFolderSize($parent); } } - } /** diff --git a/lib/private/Files/Cache/Watcher.php b/lib/private/Files/Cache/Watcher.php index 6270f03ca92..d6291ca71e9 100644 --- a/lib/private/Files/Cache/Watcher.php +++ b/lib/private/Files/Cache/Watcher.php @@ -34,7 +34,6 @@ use OCP\Files\Cache\IWatcher; * check the storage backends for updates and change the cache accordingly */ class Watcher implements IWatcher { - protected $watchPolicy = self::CHECK_ONCE; protected $checkedPaths = []; diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index 8c30eeda2cf..8d4f412868e 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -273,7 +273,6 @@ class CacheJail extends CacheWrapper { } else { return 0; } - } /** diff --git a/lib/private/Files/Mount/ObjectHomeMountProvider.php b/lib/private/Files/Mount/ObjectHomeMountProvider.php index e49b704fe96..9b243d7f8f2 100644 --- a/lib/private/Files/Mount/ObjectHomeMountProvider.php +++ b/lib/private/Files/Mount/ObjectHomeMountProvider.php @@ -57,7 +57,6 @@ class ObjectHomeMountProvider implements IHomeMountProvider { * @return \OCP\Files\Mount\IMountPoint */ public function getHomeMountForUser(IUser $user, IStorageFactory $loader) { - $config = $this->getMultiBucketObjectStoreConfig($user); if ($config === null) { $config = $this->getSingleBucketObjectStoreConfig($user); diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index b24abf34f33..d9639e9f1ab 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -161,7 +161,7 @@ class Folder extends Node implements \OCP\Files\Folder { $fullPath = $this->getFullPath($path); $nonExisting = new NonExistingFolder($this->root, $this->view, $fullPath); $this->sendHooks(['preWrite', 'preCreate'], [$nonExisting]); - if(!$this->view->mkdir($fullPath)) { + if (!$this->view->mkdir($fullPath)) { throw new NotPermittedException('Could not create folder'); } $node = new Folder($this->root, $this->view, $fullPath); diff --git a/lib/private/Files/Node/HookConnector.php b/lib/private/Files/Node/HookConnector.php index 67fadf19863..1f7f194c5f7 100644 --- a/lib/private/Files/Node/HookConnector.php +++ b/lib/private/Files/Node/HookConnector.php @@ -170,7 +170,6 @@ class HookConnector { private function getNodeForPath($path) { $info = Filesystem::getView()->getFileInfo($path); if (!$info) { - $fullPath = Filesystem::getView()->getAbsolutePath($path); if (isset($this->deleteMetaCache[$fullPath])) { $info = $this->deleteMetaCache[$fullPath]; diff --git a/lib/private/Files/Node/Node.php b/lib/private/Files/Node/Node.php index f8591080840..70821e685f8 100644 --- a/lib/private/Files/Node/Node.php +++ b/lib/private/Files/Node/Node.php @@ -465,5 +465,4 @@ class Node implements \OCP\Files\Node { public function getUploadTime(): int { return $this->getFileInfo()->getUploadTime(); } - } diff --git a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php index 98b99efcb5a..efe3f7c12d0 100644 --- a/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/HomeObjectStoreStorage.php @@ -65,6 +65,4 @@ class HomeObjectStoreStorage extends ObjectStoreStorage implements \OCP\Files\IH public function getUser($path = null) { return $this->user; } - - } diff --git a/lib/private/Files/ObjectStore/NoopScanner.php b/lib/private/Files/ObjectStore/NoopScanner.php index 7a253c82c5b..57a94aba294 100644 --- a/lib/private/Files/ObjectStore/NoopScanner.php +++ b/lib/private/Files/ObjectStore/NoopScanner.php @@ -31,7 +31,6 @@ use OC\Files\Cache\Scanner; use OC\Files\Storage\Storage; class NoopScanner extends Scanner { - public function __construct(Storage $storage) { //we don't need the storage, so do nothing here } diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 7224f075d82..1faa44ad888 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -182,7 +182,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { return false; } } else { - if(!$this->unlink($child['path'])) { + if (!$this->unlink($child['path'])) { return false; } } diff --git a/lib/private/Files/ObjectStore/S3Signature.php b/lib/private/Files/ObjectStore/S3Signature.php index 6216992ad7a..f9ea2e22aad 100644 --- a/lib/private/Files/ObjectStore/S3Signature.php +++ b/lib/private/Files/ObjectStore/S3Signature.php @@ -33,8 +33,7 @@ use Psr\Http\Message\RequestInterface; /** * Legacy Amazon S3 signature implementation */ -class S3Signature implements SignatureInterface -{ +class S3Signature implements SignatureInterface { /** @var array Query string values that must be signed */ private $signableQueryString = [ 'acl', 'cors', 'delete', 'lifecycle', 'location', 'logging', @@ -52,8 +51,7 @@ class S3Signature implements SignatureInterface /** @var \Aws\S3\S3UriParser S3 URI parser */ private $parser; - public function __construct() - { + public function __construct() { $this->parser = new S3UriParser(); // Ensure that the signable query string parameters are sorted sort($this->signableQueryString); @@ -140,8 +138,7 @@ class S3Signature implements SignatureInterface return Psr7\modify_request($request, $modify); } - private function signString($string, CredentialsInterface $credentials) - { + private function signString($string, CredentialsInterface $credentials) { return base64_encode( hash_hmac('sha1', $string, $credentials->getSecretKey(), true) ); @@ -166,8 +163,7 @@ class S3Signature implements SignatureInterface return $buffer; } - private function createCanonicalizedAmzHeaders(RequestInterface $request) - { + private function createCanonicalizedAmzHeaders(RequestInterface $request) { $headers = []; foreach ($request->getHeaders() as $name => $header) { $name = strtolower($name); @@ -188,8 +184,7 @@ class S3Signature implements SignatureInterface return implode("\n", $headers) . "\n"; } - private function createCanonicalizedResource(RequestInterface $request) - { + private function createCanonicalizedResource(RequestInterface $request) { $data = $this->parser->parse($request->getUri()); $buffer = '/'; diff --git a/lib/private/Files/SimpleFS/SimpleFile.php b/lib/private/Files/SimpleFS/SimpleFile.php index dbc5f06f22b..e3a581b25d7 100644 --- a/lib/private/Files/SimpleFS/SimpleFile.php +++ b/lib/private/Files/SimpleFS/SimpleFile.php @@ -29,7 +29,7 @@ use OCP\Files\NotFoundException; use OCP\Files\NotPermittedException; use OCP\Files\SimpleFS\ISimpleFile; -class SimpleFile implements ISimpleFile { +class SimpleFile implements ISimpleFile { /** @var File $file */ private $file; @@ -179,5 +179,4 @@ class SimpleFile implements ISimpleFile { public function write() { return $this->file->fopen('w'); } - } diff --git a/lib/private/Files/SimpleFS/SimpleFolder.php b/lib/private/Files/SimpleFS/SimpleFolder.php index 7196b55ea12..aa5c200f5bd 100644 --- a/lib/private/Files/SimpleFS/SimpleFolder.php +++ b/lib/private/Files/SimpleFS/SimpleFolder.php @@ -30,7 +30,7 @@ use OCP\Files\Node; use OCP\Files\NotFoundException; use OCP\Files\SimpleFS\ISimpleFolder; -class SimpleFolder implements ISimpleFolder { +class SimpleFolder implements ISimpleFolder { /** @var Folder */ private $folder; diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index 456980db538..edad9cc874c 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -76,7 +76,6 @@ use OCP\Lock\LockedException; * in classes which extend it, e.g. $this->stat() . */ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { - use LocalTempFileTrait; protected $cache; @@ -301,7 +300,9 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { $dh = $this->opendir($dir); if (is_resource($dh)) { while (($item = readdir($dh)) !== false) { - if (\OC\Files\Filesystem::isIgnoredDir($item)) continue; + if (\OC\Files\Filesystem::isIgnoredDir($item)) { + continue; + } if (strstr(strtolower($item), strtolower($query)) !== false) { $files[] = $dir . '/' . $item; } diff --git a/lib/private/Files/Storage/CommonTest.php b/lib/private/Files/Storage/CommonTest.php index 164738d9478..f3a127b635a 100644 --- a/lib/private/Files/Storage/CommonTest.php +++ b/lib/private/Files/Storage/CommonTest.php @@ -32,7 +32,7 @@ namespace OC\Files\Storage; -class CommonTest extends \OC\Files\Storage\Common{ +class CommonTest extends \OC\Files\Storage\Common { /** * underlying local storage used for missing functions * @var \OC\Files\Storage\Local diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 3100a14a570..2974064f3a5 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -98,8 +98,11 @@ class DAV extends Common { if (isset($params['host']) && isset($params['user']) && isset($params['password'])) { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() - if (substr($host, 0, 8) == "https://") $host = substr($host, 8); - elseif (substr($host, 0, 7) == "http://") $host = substr($host, 7); + if (substr($host, 0, 8) == "https://") { + $host = substr($host, 8); + } elseif (substr($host, 0, 7) == "http://") { + $host = substr($host, 7); + } $this->host = $host; $this->user = $params['user']; $this->password = $params['password']; @@ -153,7 +156,7 @@ class DAV extends Common { $this->client = new Client($settings); $this->client->setThrowExceptions(true); - if($this->secure === true) { + if ($this->secure === true) { $certPath = $this->certManager->getAbsoluteBundlePath(); if (file_exists($certPath)) { $this->certPath = $certPath; @@ -853,7 +856,7 @@ class DAV extends Common { } elseif ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { // ignore exception for MethodNotAllowed, false will be returned return; - } elseif ($e->getHttpStatus() === Http::STATUS_FORBIDDEN){ + } elseif ($e->getHttpStatus() === Http::STATUS_FORBIDDEN) { // The operation is forbidden. Fail somewhat gracefully throw new ForbiddenException(get_class($e) . ':' . $e->getMessage()); } diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 05dd8c4d68f..89b318b4770 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -280,7 +280,6 @@ class Local extends \OC\Files\Storage\Common { } else { return false; } - } private function treeContainsBlacklistedFile(string $path): bool { @@ -393,8 +392,9 @@ class Local extends \OC\Files\Storage\Common { $files = []; $physicalDir = $this->getSourcePath($dir); foreach (scandir($physicalDir) as $item) { - if (\OC\Files\Filesystem::isIgnoredDir($item)) + if (\OC\Files\Filesystem::isIgnoredDir($item)) { continue; + } $physicalItem = $physicalDir . '/' . $item; if (strstr(strtolower($item), strtolower($query)) !== false) { diff --git a/lib/private/Files/Storage/Temporary.php b/lib/private/Files/Storage/Temporary.php index 5e4f834990b..5e4024286c5 100644 --- a/lib/private/Files/Storage/Temporary.php +++ b/lib/private/Files/Storage/Temporary.php @@ -29,7 +29,7 @@ namespace OC\Files\Storage; /** * local storage backend in temporary folder for testing purpose */ -class Temporary extends Local{ +class Temporary extends Local { public function __construct($arguments = null) { parent::__construct(['datadir' => \OC::$server->getTempManager()->getTemporaryFolder()]); } diff --git a/lib/private/Files/Storage/Wrapper/Availability.php b/lib/private/Files/Storage/Wrapper/Availability.php index 1540ac98a4b..b949c9103a7 100644 --- a/lib/private/Files/Storage/Wrapper/Availability.php +++ b/lib/private/Files/Storage/Wrapper/Availability.php @@ -451,7 +451,7 @@ class Availability extends Wrapper { */ protected function setUnavailable(StorageNotAvailableException $e) { $delay = self::RECHECK_TTL_SEC; - if($e instanceof StorageAuthException) { + if ($e instanceof StorageAuthException) { $delay = max( // 30min $this->config->getSystemValueInt('external_storage.auth_availability_delay', 1800), diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index 850b6205412..1ea2664877b 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -51,7 +51,6 @@ use OCP\Files\Storage; use OCP\ILogger; class Encryption extends Wrapper { - use LocalTempFileTrait; /** @var string */ @@ -117,7 +116,6 @@ class Encryption extends Wrapper { Manager $mountManager = null, ArrayCache $arrayCache = null ) { - $this->mountPoint = $parameters['mountPoint']; $this->mount = $parameters['mount']; $this->encryptionManager = $encryptionManager; @@ -207,7 +205,6 @@ class Encryption extends Wrapper { * @return string */ public function file_get_contents($path) { - $encryptionModule = $this->getEncryptionModule($path); if ($encryptionModule) { @@ -269,7 +266,6 @@ class Encryption extends Wrapper { * @return bool */ public function rename($path1, $path2) { - $result = $this->storage->rename($path1, $path2); if ($result && @@ -320,7 +316,6 @@ class Encryption extends Wrapper { * @return bool */ public function isReadable($path) { - $isReadable = true; $metaData = $this->getMetaData($path); @@ -345,7 +340,6 @@ class Encryption extends Wrapper { * @return bool */ public function copy($path1, $path2) { - $source = $this->getFullPath($path1); if ($this->util->isExcluded($source)) { @@ -386,7 +380,6 @@ class Encryption extends Wrapper { $encryptionModuleId = $this->util->getEncryptionModuleId($header); if ($this->util->isExcluded($fullPath) === false) { - $size = $unencryptedSize = 0; $realFile = $this->util->stripPartialFileExtension($path); $targetExists = $this->file_exists($realFile) || $this->file_exists($path); @@ -409,7 +402,6 @@ class Encryption extends Wrapper { } try { - if ( $mode === 'w' || $mode === 'w+' @@ -472,7 +464,6 @@ class Encryption extends Wrapper { $size, $unencryptedSize, $headerSize, $signed); return $handle; } - } return $this->storage->fopen($path, $mode); @@ -489,7 +480,6 @@ class Encryption extends Wrapper { * @return int unencrypted size */ protected function verifyUnencryptedSize($path, $unencryptedSize) { - $size = $this->storage->filesize($path); $result = $unencryptedSize; @@ -523,7 +513,6 @@ class Encryption extends Wrapper { * @return int calculated unencrypted size */ protected function fixUnencryptedSize($path, $size, $unencryptedSize) { - $headerSize = $this->getHeaderSize($path); $header = $this->getHeader($path); $encryptionModule = $this->getEncryptionModule($path); @@ -572,7 +561,7 @@ class Encryption extends Wrapper { $data=fread($stream, $blockSize); $count=strlen($data); $lastChunkContentEncrypted .= $data; - if(strlen($lastChunkContentEncrypted) > $blockSize) { + if (strlen($lastChunkContentEncrypted) > $blockSize) { $newUnencryptedSize += $unencryptedBlockSize; $lastChunkContentEncrypted=substr($lastChunkContentEncrypted, $blockSize); } @@ -667,7 +656,7 @@ class Encryption extends Wrapper { $cacheInformation = [ 'encrypted' => $isEncrypted, ]; - if($isEncrypted) { + if ($isEncrypted) { $encryptedVersion = $sourceStorage->getCache()->get($sourceInternalPath)['encryptedVersion']; // In case of a move operation from an unencrypted to an encrypted @@ -675,7 +664,7 @@ class Encryption extends Wrapper { // correct value would be "1". Thus we manually set the value to "1" // for those cases. // See also https://github.com/owncloud/core/issues/23078 - if($encryptedVersion === 0 || !$keepEncryptionVersion) { + if ($encryptedVersion === 0 || !$keepEncryptionVersion) { $encryptedVersion = 1; } @@ -762,7 +751,7 @@ class Encryption extends Wrapper { fclose($target); throw $e; } - if($result) { + if ($result) { if ($preserveMtime) { $this->touch($targetInternalPath, $sourceStorage->filemtime($sourceInternalPath)); } @@ -775,7 +764,6 @@ class Encryption extends Wrapper { } } return (bool)$result; - } /** @@ -1030,7 +1018,6 @@ class Encryption extends Wrapper { } return $encryptionModule->shouldEncrypt($fullPath); - } public function writeStream(string $path, $stream, int $size = null): int { @@ -1040,5 +1027,4 @@ class Encryption extends Wrapper { fclose($target); return $count; } - } diff --git a/lib/private/Files/Storage/Wrapper/Quota.php b/lib/private/Files/Storage/Wrapper/Quota.php index d4e4be41f71..62d3335987c 100644 --- a/lib/private/Files/Storage/Wrapper/Quota.php +++ b/lib/private/Files/Storage/Wrapper/Quota.php @@ -229,5 +229,4 @@ class Quota extends Wrapper { return parent::touch($path, $mtime); } - } diff --git a/lib/private/Files/Stream/Encryption.php b/lib/private/Files/Stream/Encryption.php index 527453c32e9..1fc14daacbd 100644 --- a/lib/private/Files/Stream/Encryption.php +++ b/lib/private/Files/Stream/Encryption.php @@ -165,7 +165,6 @@ class Encryption extends Wrapper { $headerSize, $signed, $wrapper = Encryption::class) { - $context = stream_context_create([ 'ocencryption' => [ 'source' => $source, @@ -233,7 +232,6 @@ class Encryption extends Wrapper { } } return $context; - } public function stream_open($path, $mode, $options, &$opened_path) { @@ -285,7 +283,6 @@ class Encryption extends Wrapper { } return true; - } public function stream_eof() { @@ -293,7 +290,6 @@ class Encryption extends Wrapper { } public function stream_read($count) { - $result = ''; $count = min($count, $this->unencryptedSize - $this->position); @@ -308,7 +304,7 @@ class Encryption extends Wrapper { $result .= substr($this->cache, $blockPosition, $remainingLength); $this->position += $remainingLength; $count = 0; - // otherwise remainder of current block is fetched, the block is flushed and the position updated + // otherwise remainder of current block is fetched, the block is flushed and the position updated } else { $result .= substr($this->cache, $blockPosition); $this->flush(); @@ -317,7 +313,6 @@ class Encryption extends Wrapper { } } return $result; - } /** @@ -378,7 +373,7 @@ class Encryption extends Wrapper { $this->position += $remainingLength; $length += $remainingLength; $data = ''; - // if $data doesn't fit the current block, the fill the current block and reiterate + // if $data doesn't fit the current block, the fill the current block and reiterate // after the block is filled, it is flushed and $data is updatedxxx } else { $this->cache = substr($this->cache, 0, $blockPosition) . @@ -401,7 +396,6 @@ class Encryption extends Wrapper { } public function stream_seek($offset, $whence = SEEK_SET) { - $return = false; switch ($whence) { @@ -434,7 +428,6 @@ class Encryption extends Wrapper { $return = true; } return $return; - } public function stream_close() { @@ -442,7 +435,7 @@ class Encryption extends Wrapper { $position = (int)floor($this->position/$this->unencryptedBlockSize); $remainingData = $this->encryptionModule->end($this->fullPath, $position . 'end'); if ($this->readOnly === false) { - if(!empty($remainingData)) { + if (!empty($remainingData)) { parent::stream_write($remainingData); } $this->encryptionStorage->updateUnencryptedSize($this->fullPath, $this->unencryptedSize); @@ -502,7 +495,7 @@ class Encryption extends Wrapper { $data = $this->stream_read_block($this->util->getBlockSize()); $position = (int)floor($this->position/$this->unencryptedBlockSize); $numberOfChunks = (int)($this->unencryptedSize / $this->unencryptedBlockSize); - if($numberOfChunks === $position) { + if ($numberOfChunks === $position) { $position .= 'end'; } $this->cache = $this->encryptionModule->decrypt($data, $position); @@ -545,5 +538,4 @@ class Encryption extends Wrapper { public function dir_opendir($path, $options) { return false; } - } diff --git a/lib/private/Files/Stream/Quota.php b/lib/private/Files/Stream/Quota.php index 877a05e6aa9..d0609d7e459 100644 --- a/lib/private/Files/Stream/Quota.php +++ b/lib/private/Files/Stream/Quota.php @@ -67,17 +67,16 @@ class Quota extends Wrapper { } public function stream_seek($offset, $whence = SEEK_SET) { - if ($whence === SEEK_END){ + if ($whence === SEEK_END) { // go to the end to find out last position's offset $oldOffset = $this->stream_tell(); - if (fseek($this->source, 0, $whence) !== 0){ + if (fseek($this->source, 0, $whence) !== 0) { return false; } $whence = SEEK_SET; $offset = $this->stream_tell() + $offset; $this->limit += $oldOffset - $offset; - } - elseif ($whence === SEEK_SET) { + } elseif ($whence === SEEK_SET) { $this->limit += $this->stream_tell() - $offset; } else { $this->limit -= $offset; diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index b36f8a70b99..e8825037666 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -51,7 +51,6 @@ use OCP\IURLGenerator; * @package OC\Files\Type */ class Detection implements IMimeTypeDetector { - private const CUSTOM_MIMETYPEMAPPING = 'mimetypemapping.json'; private const CUSTOM_MIMETYPEALIASES = 'mimetypealiases.json'; @@ -279,7 +278,6 @@ class Detection implements IMimeTypeDetector { return $mimeType; } } - } return 'application/octet-stream'; } diff --git a/lib/private/Files/Type/Loader.php b/lib/private/Files/Type/Loader.php index fded04b5466..d128bc724b6 100644 --- a/lib/private/Files/Type/Loader.php +++ b/lib/private/Files/Type/Loader.php @@ -173,5 +173,4 @@ class Loader implements IMimeTypeLoader { )); return $update->execute(); } - } diff --git a/lib/private/Files/Utils/Scanner.php b/lib/private/Files/Utils/Scanner.php index 49f8177834a..a729da89fb0 100644 --- a/lib/private/Files/Utils/Scanner.php +++ b/lib/private/Files/Utils/Scanner.php @@ -223,7 +223,6 @@ class Scanner extends PublicEmitter { } else {// if the root exists in neither the cache nor the storage the user isn't setup yet break; } - } // don't scan received local shares, these can be scanned when scanning the owner's storage diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index da67fc461b5..20c0fd3ed1b 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -829,7 +829,7 @@ class View { $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); } } - } catch(\Exception $e) { + } catch (\Exception $e) { throw $e; } finally { $this->changeLock($path1, ILockingProvider::LOCK_SHARED, true); @@ -853,7 +853,7 @@ class View { } } } - } catch(\Exception $e) { + } catch (\Exception $e) { throw $e; } finally { $this->unlockFile($path1, ILockingProvider::LOCK_SHARED, true); @@ -895,7 +895,6 @@ class View { $lockTypePath2 = ILockingProvider::LOCK_SHARED; try { - $exists = $this->file_exists($path2); if ($this->shouldEmitHooks()) { \OC_Hook::emit( @@ -946,7 +945,6 @@ class View { ); $this->emit_file_hooks_post($exists, $path2); } - } } catch (\Exception $e) { $this->unlockFile($path2, $lockTypePath2); @@ -956,7 +954,6 @@ class View { $this->unlockFile($path2, $lockTypePath2); $this->unlockFile($path1, $lockTypePath1); - } return $result; } |