diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 11:35:09 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-04-10 11:35:09 +0300 |
commit | 14c996d98256de958da367297c3313e0fa7ef9a8 (patch) | |
tree | 27074d5403b67cbaf59d7b7181481ebe70af5d9e /lib/private/Files | |
parent | d6e17fb01777866674129a5883c03642f4bfd4a5 (diff) |
Use elseif instead of else if
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib/private/Files')
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Cache/QuerySearchHelper.php | 14 | ||||
-rw-r--r-- | lib/private/Files/Cache/Scanner.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Cache/Wrapper/CacheJail.php | 2 | ||||
-rw-r--r-- | lib/private/Files/FileInfo.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Filesystem.php | 2 | ||||
-rw-r--r-- | lib/private/Files/Node/Folder.php | 4 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/ObjectStoreStorage.php | 2 | ||||
-rw-r--r-- | lib/private/Files/ObjectStore/SwiftFactory.php | 6 | ||||
-rw-r--r-- | lib/private/Files/Storage/Common.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Storage/DAV.php | 22 | ||||
-rw-r--r-- | lib/private/Files/Storage/Local.php | 8 | ||||
-rw-r--r-- | lib/private/Files/Storage/Wrapper/Encryption.php | 4 | ||||
-rw-r--r-- | lib/private/Files/Stream/Quota.php | 2 | ||||
-rw-r--r-- | lib/private/Files/View.php | 8 |
15 files changed, 50 insertions, 50 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php index a6daec2a8f3..bce9a1d88e0 100644 --- a/lib/private/Files/Cache/Cache.php +++ b/lib/private/Files/Cache/Cache.php @@ -155,7 +155,7 @@ class Cache implements ICache { //merge partial data if (!$data and is_string($file) and isset($this->partial[$file])) { return $this->partial[$file]; - } else if (!$data) { + } elseif (!$data) { return $data; } else { return self::cacheEntryFromData($data, $this->mimetypeLoader); @@ -425,14 +425,14 @@ class Cache implements ICache { if (array_search($name, $fields) !== false) { if ($name === 'path') { $params['path_hash'] = md5($value); - } else if ($name === 'mimetype') { + } elseif ($name === 'mimetype') { $params['mimepart'] = $this->mimetypeLoader->getId(substr($value, 0, strpos($value, '/'))); $value = $this->mimetypeLoader->getId($value); - } else if ($name === 'storage_mtime') { + } elseif ($name === 'storage_mtime') { if (!$doNotCopyStorageMTime && !isset($data['mtime'])) { $params['mtime'] = $value; } - } else if ($name === 'encrypted') { + } elseif ($name === 'encrypted') { if (isset($data['encryptedVersion'])) { $value = $data['encryptedVersion']; } else { diff --git a/lib/private/Files/Cache/QuerySearchHelper.php b/lib/private/Files/Cache/QuerySearchHelper.php index 7a0b9f3a24a..9f2d7aadd7e 100644 --- a/lib/private/Files/Cache/QuerySearchHelper.php +++ b/lib/private/Files/Cache/QuerySearchHelper.php @@ -79,7 +79,7 @@ class QuerySearchHelper { return array_reduce($operator->getArguments(), function ($shouldJoin, ISearchOperator $operator) { return $shouldJoin || $this->shouldJoinTags($operator); }, false); - } else if ($operator instanceof ISearchComparison) { + } elseif ($operator instanceof ISearchComparison) { return $operator->getField() === 'tagname' || $operator->getField() === 'favorite'; } return false; @@ -117,7 +117,7 @@ class QuerySearchHelper { default: throw new \InvalidArgumentException('Invalid operator type: ' . $operator->getType()); } - } else if ($operator instanceof ISearchComparison) { + } elseif ($operator instanceof ISearchComparison) { return $this->searchComparisonToDBExpr($builder, $operator, self::$searchOperatorMap); } else { throw new \InvalidArgumentException('Invalid operator type: ' . get_class($operator)); @@ -143,13 +143,13 @@ class QuerySearchHelper { if ($field === 'mimetype') { if ($operator->getType() === ISearchComparison::COMPARE_EQUAL) { $value = (int)$this->mimetypeLoader->getId($value); - } else if ($operator->getType() === ISearchComparison::COMPARE_LIKE) { + } elseif ($operator->getType() === ISearchComparison::COMPARE_LIKE) { // transform "mimetype='foo/%'" to "mimepart='foo'" if (preg_match('|(.+)/%|', $value, $matches)) { $field = 'mimepart'; $value = (int)$this->mimetypeLoader->getId($matches[1]); $type = ISearchComparison::COMPARE_EQUAL; - } else if (strpos($value, '%') !== false) { + } elseif (strpos($value, '%') !== false) { throw new \InvalidArgumentException('Unsupported query value for mimetype: ' . $value . ', only values in the format "mime/type" or "mime/%" are supported'); } else { $field = 'mimetype'; @@ -157,12 +157,12 @@ class QuerySearchHelper { $type = ISearchComparison::COMPARE_EQUAL; } } - } else if ($field === 'favorite') { + } elseif ($field === 'favorite') { $field = 'tag.category'; $value = self::TAG_FAVORITE; - } else if ($field === 'tagname') { + } elseif ($field === 'tagname') { $field = 'tag.category'; - } else if ($field === 'fileid') { + } elseif ($field === 'fileid') { $field = 'file.fileid'; } return [$field, $value, $type]; diff --git a/lib/private/Files/Cache/Scanner.php b/lib/private/Files/Cache/Scanner.php index f2c998eeeed..87f32538ec7 100644 --- a/lib/private/Files/Cache/Scanner.php +++ b/lib/private/Files/Cache/Scanner.php @@ -412,7 +412,7 @@ class Scanner extends BasicEmitter implements IScanner { $childSize = $this->scanChildren($child, $recursive, $reuse, $childId, $lock); if ($childSize === -1) { $size = -1; - } else if ($size !== -1) { + } elseif ($size !== -1) { $size += $childSize; } } @@ -442,12 +442,12 @@ class Scanner extends BasicEmitter implements IScanner { if ($data) { if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE) { $childQueue[$child] = $data['fileid']; - } else if ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE_INCOMPLETE and $data['size'] === -1) { + } elseif ($data['mimetype'] === 'httpd/unix-directory' and $recursive === self::SCAN_RECURSIVE_INCOMPLETE and $data['size'] === -1) { // only recurse into folders which aren't fully scanned $childQueue[$child] = $data['fileid']; - } else if ($data['size'] === -1) { + } elseif ($data['size'] === -1) { $size = -1; - } else if ($size !== -1) { + } elseif ($size !== -1) { $size += $data['size']; } } diff --git a/lib/private/Files/Cache/Wrapper/CacheJail.php b/lib/private/Files/Cache/Wrapper/CacheJail.php index a77270329ad..8c30eeda2cf 100644 --- a/lib/private/Files/Cache/Wrapper/CacheJail.php +++ b/lib/private/Files/Cache/Wrapper/CacheJail.php @@ -75,7 +75,7 @@ class CacheJail extends CacheWrapper { $rootLength = strlen($this->getRoot()) + 1; if ($path === $this->getRoot()) { return ''; - } else if (substr($path, 0, $rootLength) === $this->getRoot() . '/') { + } elseif (substr($path, 0, $rootLength) === $this->getRoot() . '/') { return substr($path, $rootLength); } else { return null; diff --git a/lib/private/Files/FileInfo.php b/lib/private/Files/FileInfo.php index cfc03ffd4e0..b73e11f84b8 100644 --- a/lib/private/Files/FileInfo.php +++ b/lib/private/Files/FileInfo.php @@ -119,11 +119,11 @@ class FileInfo implements \OCP\Files\FileInfo, \ArrayAccess { public function offsetGet($offset) { if ($offset === 'type') { return $this->getType(); - } else if ($offset === 'etag') { + } elseif ($offset === 'etag') { return $this->getEtag(); - } else if ($offset === 'size') { + } elseif ($offset === 'size') { return $this->getSize(); - } else if ($offset === 'mtime') { + } elseif ($offset === 'mtime') { return $this->getMTime(); } elseif ($offset === 'permissions') { return $this->getPermissions(); diff --git a/lib/private/Files/Filesystem.php b/lib/private/Files/Filesystem.php index 44da2e6f20f..1999edf67fd 100644 --- a/lib/private/Files/Filesystem.php +++ b/lib/private/Files/Filesystem.php @@ -601,7 +601,7 @@ class Filesystem { static public function isBlacklisted($data) { if (isset($data['path'])) { $path = $data['path']; - } else if (isset($data['newpath'])) { + } elseif (isset($data['newpath'])) { $path = $data['newpath']; } if (isset($path)) { diff --git a/lib/private/Files/Node/Folder.php b/lib/private/Files/Node/Folder.php index c005e4f7770..b24abf34f33 100644 --- a/lib/private/Files/Node/Folder.php +++ b/lib/private/Files/Node/Folder.php @@ -73,7 +73,7 @@ class Folder extends Node implements \OCP\Files\Folder { } if ($path === $this->path) { return '/'; - } else if (strpos($path, $this->path . '/') !== 0) { + } elseif (strpos($path, $this->path . '/') !== 0) { return null; } else { $path = substr($path, strlen($this->path)); @@ -521,7 +521,7 @@ class Folder extends Node implements \OCP\Files\Folder { $rootLength = strlen($jailRoot) + 1; if ($path === $jailRoot) { return $mount->getMountPoint(); - } else if (substr($path, 0, $rootLength) === $jailRoot . '/') { + } elseif (substr($path, 0, $rootLength) === $jailRoot . '/') { return $mount->getMountPoint() . substr($path, $rootLength); } else { return null; diff --git a/lib/private/Files/ObjectStore/ObjectStoreStorage.php b/lib/private/Files/ObjectStore/ObjectStoreStorage.php index 5dfd835fb94..7224f075d82 100644 --- a/lib/private/Files/ObjectStore/ObjectStoreStorage.php +++ b/lib/private/Files/ObjectStore/ObjectStoreStorage.php @@ -105,7 +105,7 @@ class ObjectStoreStorage extends \OC\Files\Storage\Common { // something went wrong return false; } - } else if ($parentType === 'file') { + } elseif ($parentType === 'file') { // parent is a file return false; } diff --git a/lib/private/Files/ObjectStore/SwiftFactory.php b/lib/private/Files/ObjectStore/SwiftFactory.php index 93ff02f1f8b..c7d2e691bbd 100644 --- a/lib/private/Files/ObjectStore/SwiftFactory.php +++ b/lib/private/Files/ObjectStore/SwiftFactory.php @@ -158,7 +158,7 @@ class SwiftFactory { $token = $authService->generateTokenFromCache($cachedToken); if (\is_null($token->catalog)) { $this->logger->warning('Invalid cached token for swift, no catalog set: ' . json_encode($cachedToken)); - } else if ($token->hasExpired()) { + } elseif ($token->hasExpired()) { $this->logger->debug('Cached token for swift expired'); } else { $hasValidCachedToken = true; @@ -192,9 +192,9 @@ class SwiftFactory { $statusCode = $e->getResponse()->getStatusCode(); if ($statusCode === 404) { throw new StorageAuthException('Keystone not found, verify the keystone url', $e); - } else if ($statusCode === 412) { + } elseif ($statusCode === 412) { throw new StorageAuthException('Precondition failed, verify the keystone url', $e); - } else if ($statusCode === 401) { + } elseif ($statusCode === 401) { throw new StorageAuthException('Authentication failed, verify the username, password and possibly tenant', $e); } else { throw new StorageAuthException('Unknown error', $e); diff --git a/lib/private/Files/Storage/Common.php b/lib/private/Files/Storage/Common.php index f2d427227c9..456980db538 100644 --- a/lib/private/Files/Storage/Common.php +++ b/lib/private/Files/Storage/Common.php @@ -104,7 +104,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { protected function remove($path) { if ($this->is_dir($path)) { return $this->rmdir($path); - } else if ($this->is_file($path)) { + } elseif ($this->is_file($path)) { return $this->unlink($path); } else { return false; @@ -439,7 +439,7 @@ abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { foreach (explode('/', $path) as $chunk) { if ($chunk == '..') { array_pop($output); - } else if ($chunk == '.') { + } elseif ($chunk == '.') { } else { $output[] = $chunk; } diff --git a/lib/private/Files/Storage/DAV.php b/lib/private/Files/Storage/DAV.php index 3654ef1285c..3100a14a570 100644 --- a/lib/private/Files/Storage/DAV.php +++ b/lib/private/Files/Storage/DAV.php @@ -99,7 +99,7 @@ class DAV extends Common { $host = $params['host']; //remove leading http[s], will be generated in createBaseUri() if (substr($host, 0, 8) == "https://") $host = substr($host, 8); - else if (substr($host, 0, 7) == "http://") $host = substr($host, 7); + elseif (substr($host, 0, 7) == "http://") $host = substr($host, 7); $this->host = $host; $this->user = $params['user']; $this->password = $params['password']; @@ -320,7 +320,7 @@ class DAV extends Common { if ($cachedState === false) { // we know the file doesn't exist return false; - } else if (!is_null($cachedState)) { + } elseif (!is_null($cachedState)) { return true; } // need to get from server @@ -718,9 +718,9 @@ class DAV extends Common { } if (isset($response['{http://owncloud.org/ns}permissions'])) { return $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); - } else if ($this->is_dir($path)) { + } elseif ($this->is_dir($path)) { return Constants::PERMISSION_ALL; - } else if ($this->file_exists($path)) { + } elseif ($this->file_exists($path)) { return Constants::PERMISSION_ALL - Constants::PERMISSION_CREATE; } else { return 0; @@ -797,10 +797,10 @@ class DAV extends Common { } if (!empty($etag) && $cachedData['etag'] !== $etag) { return true; - } else if (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { + } elseif (isset($response['{http://open-collaboration-services.org/ns}share-permissions'])) { $sharePermissions = (int)$response['{http://open-collaboration-services.org/ns}share-permissions']; return $sharePermissions !== $cachedData['permissions']; - } else if (isset($response['{http://owncloud.org/ns}permissions'])) { + } elseif (isset($response['{http://owncloud.org/ns}permissions'])) { $permissions = $this->parsePermissions($response['{http://owncloud.org/ns}permissions']); return $permissions !== $cachedData['permissions']; } else { @@ -850,22 +850,22 @@ class DAV extends Common { if ($e->getHttpStatus() === Http::STATUS_UNAUTHORIZED) { // either password was changed or was invalid all along throw new StorageInvalidException(get_class($e) . ': ' . $e->getMessage()); - } else if ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { + } elseif ($e->getHttpStatus() === Http::STATUS_METHOD_NOT_ALLOWED) { // ignore exception for MethodNotAllowed, false will be returned return; - } else if ($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()); } throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); - } else if ($e instanceof ClientException) { + } elseif ($e instanceof ClientException) { // connection timeout or refused, server could be temporarily down throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); - } else if ($e instanceof \InvalidArgumentException) { + } elseif ($e instanceof \InvalidArgumentException) { // parse error because the server returned HTML instead of XML, // possibly temporarily down throw new StorageNotAvailableException(get_class($e) . ': ' . $e->getMessage()); - } else if (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { + } elseif (($e instanceof StorageNotAvailableException) || ($e instanceof StorageInvalidException)) { // rethrow throw $e; } diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index fbb84418e2e..05dd8c4d68f 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -112,9 +112,9 @@ class Local extends \OC\Files\Storage\Common { if (in_array($file->getBasename(), ['.', '..'])) { $it->next(); continue; - } else if ($file->isDir()) { + } elseif ($file->isDir()) { rmdir($file->getPathname()); - } else if ($file->isFile() || $file->isLink()) { + } elseif ($file->isFile() || $file->isLink()) { unlink($file->getPathname()); } $it->next(); @@ -275,7 +275,7 @@ class Local extends \OC\Files\Storage\Common { public function unlink($path) { if ($this->is_dir($path)) { return $this->rmdir($path); - } else if ($this->is_file($path)) { + } elseif ($this->is_file($path)) { return unlink($this->getSourcePath($path)); } else { return false; @@ -316,7 +316,7 @@ class Local extends \OC\Files\Storage\Common { if ($this->is_dir($path2)) { $this->rmdir($path2); - } else if ($this->is_file($path2)) { + } elseif ($this->is_file($path2)) { $this->unlink($path2); } diff --git a/lib/private/Files/Storage/Wrapper/Encryption.php b/lib/private/Files/Storage/Wrapper/Encryption.php index eb92f07d973..850b6205412 100644 --- a/lib/private/Files/Storage/Wrapper/Encryption.php +++ b/lib/private/Files/Storage/Wrapper/Encryption.php @@ -437,7 +437,7 @@ class Encryption extends Wrapper { if (!empty($encryptionModuleId)) { $encryptionModule = $this->encryptionManager->getEncryptionModule($encryptionModuleId); $shouldEncrypt = true; - } else if (empty($encryptionModuleId) && $info['encrypted'] === true) { + } elseif (empty($encryptionModuleId) && $info['encrypted'] === true) { // we come from a old installation. No header and/or no module defined // but the file is encrypted. In this case we need to use the // OC_DEFAULT_MODULE to read the file @@ -935,7 +935,7 @@ class Encryption extends Wrapper { if (!isset($result[Util::HEADER_ENCRYPTION_MODULE_KEY])) { if (!empty($result)) { $result[Util::HEADER_ENCRYPTION_MODULE_KEY] = 'OC_DEFAULT_MODULE'; - } else if ($exists) { + } elseif ($exists) { // if the header was empty we have to check first if it is a encrypted file at all // We would do query to filecache only if we know that entry in filecache exists $info = $this->getCache()->get($path); diff --git a/lib/private/Files/Stream/Quota.php b/lib/private/Files/Stream/Quota.php index 7d5337d3a7d..877a05e6aa9 100644 --- a/lib/private/Files/Stream/Quota.php +++ b/lib/private/Files/Stream/Quota.php @@ -77,7 +77,7 @@ class Quota extends Wrapper { $offset = $this->stream_tell() + $offset; $this->limit += $oldOffset - $offset; } - else if ($whence === SEEK_SET) { + elseif ($whence === SEEK_SET) { $this->limit += $this->stream_tell() - $offset; } else { $this->limit -= $offset; diff --git a/lib/private/Files/View.php b/lib/private/Files/View.php index 881bf1a2126..da67fc461b5 100644 --- a/lib/private/Files/View.php +++ b/lib/private/Files/View.php @@ -824,7 +824,7 @@ class View { if ((Cache\Scanner::isPartialFile($path1) && !Cache\Scanner::isPartialFile($path2)) && $result !== false) { // if it was a rename from a part file to a regular file it was a write and not a rename operation $this->writeUpdate($storage2, $internalPath2); - } else if ($result) { + } elseif ($result) { if ($internalPath1 !== '') { // don't do a cache update for moved mounts $this->renameUpdate($storage1, $storage2, $internalPath1, $internalPath2); } @@ -1165,7 +1165,7 @@ class View { } catch (\Exception $e) { if (in_array('write', $hooks) || in_array('delete', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); - } else if (in_array('read', $hooks)) { + } elseif (in_array('read', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_SHARED); } throw $e; @@ -1193,7 +1193,7 @@ class View { $result = CallbackWrapper::wrap($result, null, null, function () use ($hooks, $path) { if (in_array('write', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_EXCLUSIVE); - } else if (in_array('read', $hooks)) { + } elseif (in_array('read', $hooks)) { $this->unlockFile($path, ILockingProvider::LOCK_SHARED); } }); @@ -1340,7 +1340,7 @@ class View { $scanner = $storage->getScanner($internalPath); $scanner->scan($internalPath, Cache\Scanner::SCAN_SHALLOW); $data = $cache->get($internalPath); - } else if (!Cache\Scanner::isPartialFile($internalPath) && $watcher->needsUpdate($internalPath, $data)) { + } elseif (!Cache\Scanner::isPartialFile($internalPath) && $watcher->needsUpdate($internalPath, $data)) { $this->lockFile($relativePath, ILockingProvider::LOCK_SHARED); $watcher->update($internalPath, $data); $storage->getPropagator()->propagateChange($internalPath, time()); |