diff options
Diffstat (limited to 'lib/private')
80 files changed, 215 insertions, 215 deletions
diff --git a/lib/private/Activity/EventMerger.php b/lib/private/Activity/EventMerger.php index 35c798afe49..4855c0e8447 100644 --- a/lib/private/Activity/EventMerger.php +++ b/lib/private/Activity/EventMerger.php @@ -248,7 +248,7 @@ class EventMerger implements IEventMerger { $placeholders[] = '{' . $placeholder . '}'; if ($parameter['type'] === 'file') { $replacements[] = trim($parameter['path'], '/'); - } else if (isset($parameter['name'])) { + } elseif (isset($parameter['name'])) { $replacements[] = $parameter['name']; } else { $replacements[] = $parameter['id']; diff --git a/lib/private/AllConfig.php b/lib/private/AllConfig.php index e62b000938b..e1517440b46 100644 --- a/lib/private/AllConfig.php +++ b/lib/private/AllConfig.php @@ -265,7 +265,7 @@ class AllConfig implements \OCP\IConfig { if ($prevValue !== null) { if ($prevValue === (string)$value) { return; - } else if ($preCondition !== null && $prevValue !== (string)$preCondition) { + } elseif ($preCondition !== null && $prevValue !== (string)$preCondition) { throw new PreConditionNotMetException(); } else { $qb = $this->connection->getQueryBuilder(); diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php index eaa203417b2..bf1e8492aa3 100644 --- a/lib/private/App/AppManager.php +++ b/lib/private/App/AppManager.php @@ -546,7 +546,7 @@ class AppManager implements IAppManager { $info = $this->getAppInfo($appId); if ($info === null) { $incompatibleApps[] = ['id' => $appId]; - } else if (!\OC_App::isAppCompatible($version, $info)) { + } elseif (!\OC_App::isAppCompatible($version, $info)) { $incompatibleApps[] = $info; } } diff --git a/lib/private/App/CodeChecker/MigrationSchemaChecker.php b/lib/private/App/CodeChecker/MigrationSchemaChecker.php index 8434dd72078..63e35e0647c 100644 --- a/lib/private/App/CodeChecker/MigrationSchemaChecker.php +++ b/lib/private/App/CodeChecker/MigrationSchemaChecker.php @@ -66,12 +66,12 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; } } - } else if ($node->expr->name === 'getTable') { + } elseif ($node->expr->name === 'getTable') { if (isset($node->expr->args[0]) && $node->expr->args[0]->value instanceof Node\Scalar\String_) { $this->tableVariableNames[$node->var->name] = $node->expr->args[0]->value->value; } } - } else if ($this->schemaVariableName !== null && + } elseif ($this->schemaVariableName !== null && $node instanceof Node\Expr\MethodCall && $node->var instanceof Node\Expr\Variable && $node->var->name === $this->schemaVariableName) { @@ -90,7 +90,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { /** * Check columns and Indexes */ - } else if (!empty($this->tableVariableNames) && + } elseif (!empty($this->tableVariableNames) && $node instanceof Node\Expr\MethodCall && $node->var instanceof Node\Expr\Variable && isset($this->tableVariableNames[$node->var->name])) { @@ -123,7 +123,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { } } } - } else if ($node->name === 'addIndex' || + } elseif ($node->name === 'addIndex' || $node->name === 'addUniqueIndex' || $node->name === 'renameIndex' || $node->name === 'setPrimaryKey') { @@ -139,7 +139,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { ]; } } - } else if ($node->name === 'addForeignKeyConstraint') { + } elseif ($node->name === 'addForeignKeyConstraint') { if (isset($node->args[4]) && $node->args[4]->value instanceof Node\Scalar\String_) { if (!$this->checkNameLength($node->args[4]->value->value)) { $this->errors[] = [ @@ -152,7 +152,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { ]; } } - } else if ($node->name === 'renameColumn') { + } elseif ($node->name === 'renameColumn') { $this->errors[] = [ 'line' => $node->getLine(), 'disallowedToken' => 'Deprecated method', @@ -166,7 +166,7 @@ class MigrationSchemaChecker extends NodeVisitorAbstract { /** * Find the schema */ - } else if ($node instanceof Node\Expr\Assign && + } elseif ($node instanceof Node\Expr\Assign && $node->expr instanceof Node\Expr\FuncCall && $node->var instanceof Node\Expr\Variable && $node->expr->name instanceof Node\Expr\Variable && diff --git a/lib/private/App/CompareVersion.php b/lib/private/App/CompareVersion.php index bf528e3f1b8..314db1eadd6 100644 --- a/lib/private/App/CompareVersion.php +++ b/lib/private/App/CompareVersion.php @@ -53,9 +53,9 @@ class CompareVersion { if (preg_match(self::REGEX_MAJOR, $required) === 1) { return $this->compareMajor($actual, $required, $comparator); - } else if (preg_match(self::REGEX_MAJOR_MINOR, $required) === 1) { + } elseif (preg_match(self::REGEX_MAJOR_MINOR, $required) === 1) { return $this->compareMajorMinor($actual, $required, $comparator); - } else if (preg_match(self::REGEX_MAJOR_MINOR_PATCH, $required) === 1) { + } elseif (preg_match(self::REGEX_MAJOR_MINOR_PATCH, $required) === 1) { return $this->compareMajorMinorPatch($actual, $required, $comparator); } else { throw new InvalidArgumentException('required version is invalid'); diff --git a/lib/private/AppFramework/App.php b/lib/private/AppFramework/App.php index f7defda487e..382425ad046 100644 --- a/lib/private/AppFramework/App.php +++ b/lib/private/AppFramework/App.php @@ -99,7 +99,7 @@ class App { public static function main(string $controllerName, string $methodName, DIContainer $container, array $urlParams = null) { if (!is_null($urlParams)) { $container->query(IRequest::class)->setUrlParameters($urlParams); - } else if (isset($container['urlParams']) && !is_null($container['urlParams'])) { + } elseif (isset($container['urlParams']) && !is_null($container['urlParams'])) { $container->query(IRequest::class)->setUrlParameters($container['urlParams']); } $appName = $container['AppName']; @@ -178,7 +178,7 @@ class App { if (!$emptyResponse) { if ($response instanceof ICallbackResponse) { $response->callback($io); - } else if (!is_null($output)) { + } elseif (!is_null($output)) { $io->setHeader('Content-Length: ' . strlen($output)); $io->setOutput($output); } diff --git a/lib/private/AppFramework/DependencyInjection/DIContainer.php b/lib/private/AppFramework/DependencyInjection/DIContainer.php index 14898fadf95..2ce504304dc 100644 --- a/lib/private/AppFramework/DependencyInjection/DIContainer.php +++ b/lib/private/AppFramework/DependencyInjection/DIContainer.php @@ -409,9 +409,9 @@ class DIContainer extends SimpleContainer implements IAppContainer { } else { if ($this['AppName'] === 'settings' && strpos($name, 'OC\\Settings\\') === 0) { return parent::query($name); - } else if ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { + } elseif ($this['AppName'] === 'core' && strpos($name, 'OC\\Core\\') === 0) { return parent::query($name); - } else if (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { + } elseif (strpos($name, \OC\AppFramework\App::buildAppNamespace($this['AppName']) . '\\') === 0) { return parent::query($name); } } diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index 9b8c0690ba6..5430d1ae922 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -874,7 +874,7 @@ class Request implements \ArrayAccess, \Countable, IRequest { } else { if (isset($this->server['HTTP_HOST'])) { $host = $this->server['HTTP_HOST']; - } else if (isset($this->server['SERVER_NAME'])) { + } elseif (isset($this->server['SERVER_NAME'])) { $host = $this->server['SERVER_NAME']; } } diff --git a/lib/private/AppFramework/OCS/V2Response.php b/lib/private/AppFramework/OCS/V2Response.php index 0859fecb1d9..693d58a4d43 100644 --- a/lib/private/AppFramework/OCS/V2Response.php +++ b/lib/private/AppFramework/OCS/V2Response.php @@ -39,11 +39,11 @@ class V2Response extends BaseResponse { $status = parent::getStatus(); if ($status === API::RESPOND_UNAUTHORISED) { return Http::STATUS_UNAUTHORIZED; - } else if ($status === API::RESPOND_NOT_FOUND) { + } elseif ($status === API::RESPOND_NOT_FOUND) { return Http::STATUS_NOT_FOUND; - } else if ($status === API::RESPOND_SERVER_ERROR || $status === API::RESPOND_UNKNOWN_ERROR) { + } elseif ($status === API::RESPOND_SERVER_ERROR || $status === API::RESPOND_UNKNOWN_ERROR) { return Http::STATUS_INTERNAL_SERVER_ERROR; - } else if ($status < 200 || $status > 600) { + } elseif ($status < 200 || $status > 600) { return Http::STATUS_BAD_REQUEST; } diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index ec6c3971552..999412979b0 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -167,7 +167,7 @@ class RouteConfig { $controllerName = str_replace('controllerController', 'Controller', $controllerName); if ($controllerName === 'PublicpreviewController') { $controllerName = 'PublicPreviewController'; - } else if ($controllerName === 'RequesthandlerController') { + } elseif ($controllerName === 'RequesthandlerController') { $controllerName = 'RequestHandlerController'; } $controllerName = App::buildAppNamespace($appName) . '\\Controller\\' . $controllerName; diff --git a/lib/private/AppFramework/Utility/SimpleContainer.php b/lib/private/AppFramework/Utility/SimpleContainer.php index f2ac4f2d6f2..1703df3ea73 100644 --- a/lib/private/AppFramework/Utility/SimpleContainer.php +++ b/lib/private/AppFramework/Utility/SimpleContainer.php @@ -72,7 +72,7 @@ class SimpleContainer extends Container implements IContainer { // Service not found, use the default value when available if ($parameter->isDefaultValueAvailable()) { $parameters[] = $parameter->getDefaultValue(); - } else if ($parameterClass !== null) { + } elseif ($parameterClass !== null) { $resolveName = $parameter->getName(); $parameters[] = $this->query($resolveName); } else { @@ -111,7 +111,7 @@ class SimpleContainer extends Container implements IContainer { $name = $this->sanitizeName($name); if ($this->offsetExists($name)) { return $this->offsetGet($name); - } else if ($autoload) { + } elseif ($autoload) { $object = $this->resolve($name); $this->registerService($name, function () use ($object) { return $object; diff --git a/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php b/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php index f7d3693acc9..5acd228b133 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeActivityListener.php @@ -52,7 +52,7 @@ class RemoteWipeActivityListener implements IEventListener { public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->publishActivity('remote_wipe_start', $event->getToken()); - } else if ($event instanceof RemoteWipeFinished) { + } elseif ($event instanceof RemoteWipeFinished) { $this->publishActivity('remote_wipe_finish', $event->getToken()); } } diff --git a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php index 0632d2e6af0..6c0ca16859b 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeEmailListener.php @@ -90,7 +90,7 @@ class RemoteWipeEmailListener implements IEventListener { 'level' => ILogger::ERROR, ]); } - } else if ($event instanceof RemoteWipeFinished) { + } elseif ($event instanceof RemoteWipeFinished) { $uid = $event->getToken()->getUID(); $user = $this->userManager->get($uid); if ($user === null) { diff --git a/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php b/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php index 9eab3e74e9c..4b021d67c75 100644 --- a/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php +++ b/lib/private/Authentication/Listeners/RemoteWipeNotificationsListener.php @@ -52,7 +52,7 @@ class RemoteWipeNotificationsListener implements IEventListener { public function handle(Event $event): void { if ($event instanceof RemoteWipeStarted) { $this->sendNotification('remote_wipe_start', $event->getToken()); - } else if ($event instanceof RemoteWipeFinished) { + } elseif ($event instanceof RemoteWipeFinished) { $this->sendNotification('remote_wipe_finish', $event->getToken()); } } diff --git a/lib/private/Authentication/Login/TwoFactorCommand.php b/lib/private/Authentication/Login/TwoFactorCommand.php index 2d889ef8c70..2c3d2fbf2c4 100644 --- a/lib/private/Authentication/Login/TwoFactorCommand.php +++ b/lib/private/Authentication/Login/TwoFactorCommand.php @@ -69,7 +69,7 @@ class TwoFactorCommand extends ALoginCommand { // No providers set up, but 2FA is enforced and setup providers are available $url = 'core.TwoFactorChallenge.setupProviders'; $urlParams = []; - } else if (!$providerSet->isProviderMissing() && count($providers) === 1) { + } elseif (!$providerSet->isProviderMissing() && count($providers) === 1) { // Single provider (and no missing ones), hence we can redirect to that provider's challenge page directly /* @var $provider IProvider */ $provider = array_pop($providers); diff --git a/lib/private/Command/CronBus.php b/lib/private/Command/CronBus.php index 94235925096..86fa919d5f3 100644 --- a/lib/private/Command/CronBus.php +++ b/lib/private/Command/CronBus.php @@ -52,9 +52,9 @@ class CronBus extends AsyncBus { private function getJobClass($command) { if ($command instanceof \Closure) { return ClosureJob::class; - } else if (is_callable($command)) { + } elseif (is_callable($command)) { return CallableJob::class; - } else if ($command instanceof ICommand) { + } elseif ($command instanceof ICommand) { return CommandJob::class; } else { throw new \InvalidArgumentException('Invalid command'); @@ -69,7 +69,7 @@ class CronBus extends AsyncBus { if ($command instanceof \Closure) { $serializer = new Serializer(); return $serializer->serialize($command); - } else if (is_callable($command) or $command instanceof ICommand) { + } elseif (is_callable($command) or $command instanceof ICommand) { return serialize($command); } else { throw new \InvalidArgumentException('Invalid command'); diff --git a/lib/private/Console/Application.php b/lib/private/Console/Application.php index 0688a193693..00ab67f93be 100644 --- a/lib/private/Console/Application.php +++ b/lib/private/Console/Application.php @@ -146,7 +146,7 @@ class Application { } } } - } else if ($input->getArgument('command') !== '_completion' && $input->getArgument('command') !== 'maintenance:install') { + } elseif ($input->getArgument('command') !== '_completion' && $input->getArgument('command') !== 'maintenance:install') { $output->writeln("Nextcloud is not installed - only a limited number of commands are available"); } } catch(NeedsUpdateException $e) { diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index a0c0ac18481..15c0272915a 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -265,7 +265,7 @@ class Connection extends ReconnectWrapper implements IDBConnection { private function getType($value) { if (is_bool($value)) { return IQueryBuilder::PARAM_BOOL; - } else if (is_int($value)) { + } elseif (is_int($value)) { return IQueryBuilder::PARAM_INT; } else { return IQueryBuilder::PARAM_STR; diff --git a/lib/private/DB/MDB2SchemaManager.php b/lib/private/DB/MDB2SchemaManager.php index bc05bd354f2..36184b51252 100644 --- a/lib/private/DB/MDB2SchemaManager.php +++ b/lib/private/DB/MDB2SchemaManager.php @@ -83,11 +83,11 @@ class MDB2SchemaManager { $dispatcher = \OC::$server->getEventDispatcher(); if ($platform instanceof SqlitePlatform) { return new SQLiteMigrator($this->conn, $random, $config, $dispatcher); - } else if ($platform instanceof OraclePlatform) { + } elseif ($platform instanceof OraclePlatform) { return new OracleMigrator($this->conn, $random, $config, $dispatcher); - } else if ($platform instanceof MySqlPlatform) { + } elseif ($platform instanceof MySqlPlatform) { return new MySQLMigrator($this->conn, $random, $config, $dispatcher); - } else if ($platform instanceof PostgreSqlPlatform) { + } elseif ($platform instanceof PostgreSqlPlatform) { return new PostgreSqlMigrator($this->conn, $random, $config, $dispatcher); } else { return new Migrator($this->conn, $random, $config, $dispatcher); diff --git a/lib/private/DB/MDB2SchemaReader.php b/lib/private/DB/MDB2SchemaReader.php index 7265c978616..66a45fb5fc5 100644 --- a/lib/private/DB/MDB2SchemaReader.php +++ b/lib/private/DB/MDB2SchemaReader.php @@ -247,7 +247,7 @@ class MDB2SchemaReader { $length = $options['length']; if ($length < 4) { $type = 'smallint'; - } else if ($length > 4) { + } elseif ($length > 4) { $type = 'bigint'; } } diff --git a/lib/private/DB/MigrationService.php b/lib/private/DB/MigrationService.php index dd719ef0a5b..0104c1be367 100644 --- a/lib/private/DB/MigrationService.php +++ b/lib/private/DB/MigrationService.php @@ -97,7 +97,7 @@ class MigrationService { foreach ($info['dependencies']['database'] as $database) { if (\is_string($database) && $database === 'oci') { $this->checkOracle = true; - } else if (\is_array($database) && isset($database['@value']) && $database['@value'] === 'oci') { + } elseif (\is_array($database) && isset($database['@value']) && $database['@value'] === 'oci') { $this->checkOracle = true; } } @@ -542,7 +542,7 @@ class MigrationService { return $sequence->getName() !== $sequenceName; }); } - } else if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof OraclePlatform) { $defaultName = $table->getName() . '_seq'; $isUsingDefaultName = strtolower($defaultName) === $indexName; } diff --git a/lib/private/DB/QueryBuilder/QueryBuilder.php b/lib/private/DB/QueryBuilder/QueryBuilder.php index bd0869673aa..4845b8b1aa4 100644 --- a/lib/private/DB/QueryBuilder/QueryBuilder.php +++ b/lib/private/DB/QueryBuilder/QueryBuilder.php @@ -115,11 +115,11 @@ class QueryBuilder implements IQueryBuilder { public function expr() { if ($this->connection instanceof OracleConnection) { return new OCIExpressionBuilder($this->connection, $this); - } else if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { return new PgSqlExpressionBuilder($this->connection, $this); - } else if ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof MySqlPlatform) { return new MySqlExpressionBuilder($this->connection, $this); - } else if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { return new SqliteExpressionBuilder($this->connection, $this); } else { return new ExpressionBuilder($this->connection, $this); @@ -145,9 +145,9 @@ class QueryBuilder implements IQueryBuilder { public function func() { if ($this->connection instanceof OracleConnection) { return new OCIFunctionBuilder($this->helper); - } else if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) { return new SqliteFunctionBuilder($this->helper); - } else if ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { + } elseif ($this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) { return new PgSqlFunctionBuilder($this->helper); } else { return new FunctionBuilder($this->helper); diff --git a/lib/private/DateTimeFormatter.php b/lib/private/DateTimeFormatter.php index bb9e018b584..45a1cbdb8f2 100644 --- a/lib/private/DateTimeFormatter.php +++ b/lib/private/DateTimeFormatter.php @@ -81,7 +81,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { protected function getDateTime($timestamp, \DateTimeZone $timeZone = null) { if ($timestamp === null) { return new \DateTime('now', $timeZone); - } else if (!$timestamp instanceof \DateTime) { + } elseif (!$timestamp instanceof \DateTime) { $dateTime = new \DateTime('now', $timeZone); $dateTime->setTimestamp($timestamp); return $dateTime; @@ -160,31 +160,31 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { if ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 0) { return $l->t('today'); - } else if ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 1) { + } elseif ($dateInterval->y == 0 && $dateInterval->m == 0 && $dateInterval->d == 1) { if ($timestamp > $baseTimestamp) { return $l->t('tomorrow'); } else { return $l->t('yesterday'); } - } else if ($dateInterval->y == 0 && $dateInterval->m == 0) { + } elseif ($dateInterval->y == 0 && $dateInterval->m == 0) { if ($timestamp > $baseTimestamp) { return $l->n('in %n day', 'in %n days', $dateInterval->d); } else { return $l->n('%n day ago', '%n days ago', $dateInterval->d); } - } else if ($dateInterval->y == 0 && $dateInterval->m == 1) { + } elseif ($dateInterval->y == 0 && $dateInterval->m == 1) { if ($timestamp > $baseTimestamp) { return $l->t('next month'); } else { return $l->t('last month'); } - } else if ($dateInterval->y == 0) { + } elseif ($dateInterval->y == 0) { if ($timestamp > $baseTimestamp) { return $l->n('in %n month', 'in %n months', $dateInterval->m); } else { return $l->n('%n month ago', '%n months ago', $dateInterval->m); } - } else if ($dateInterval->y == 1) { + } elseif ($dateInterval->y == 1) { if ($timestamp > $baseTimestamp) { return $l->t('next year'); } else { @@ -250,7 +250,7 @@ class DateTimeFormatter implements \OCP\IDateTimeFormatter { } else { return $l->n('%n hour ago', '%n hours ago', $diff->h); } - } else if ($diff->i > 0) { + } elseif ($diff->i > 0) { if ($timestamp > $baseTimestamp) { return $l->n('in %n minute', 'in %n minutes', $diff->i); } else { diff --git a/lib/private/Federation/CloudIdManager.php b/lib/private/Federation/CloudIdManager.php index 9c877c5efc7..6d4df7a66c5 100644 --- a/lib/private/Federation/CloudIdManager.php +++ b/lib/private/Federation/CloudIdManager.php @@ -51,9 +51,9 @@ class CloudIdManager implements ICloudIdManager { if ($posSlash === false && $posColon === false) { $invalidPos = \strlen($id); - } else if ($posSlash === false) { + } elseif ($posSlash === false) { $invalidPos = $posColon; - } else if ($posColon === false) { + } elseif ($posColon === false) { $invalidPos = $posSlash; } else { $invalidPos = min($posSlash, $posColon); 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()); diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php index f0acacdd0c5..73c07a6197f 100644 --- a/lib/private/Group/Manager.php +++ b/lib/private/Group/Manager.php @@ -192,7 +192,7 @@ class Manager extends PublicEmitter implements IGroupManager { } $backends[] = $backend; } - } else if ($backend->groupExists($gid)) { + } elseif ($backend->groupExists($gid)) { $backends[] = $backend; } } @@ -218,7 +218,7 @@ class Manager extends PublicEmitter implements IGroupManager { public function createGroup($gid) { if ($gid === '' || $gid === null) { return null; - } else if ($group = $this->get($gid)) { + } elseif ($group = $this->get($gid)) { return $group; } else { $this->emit('\OC\Group', 'preCreate', [$gid]); diff --git a/lib/private/Group/MetaData.php b/lib/private/Group/MetaData.php index 3a2c08b0878..335bf43c16b 100644 --- a/lib/private/Group/MetaData.php +++ b/lib/private/Group/MetaData.php @@ -151,7 +151,7 @@ class MetaData { if ($this->sorting === self::SORT_USERCOUNT) { $sortKeys[$sortIndex] = $data['usercount']; $sortIndex++; - } else if ($this->sorting === self::SORT_GROUPNAME) { + } elseif ($this->sorting === self::SORT_GROUPNAME) { $sortKeys[$sortIndex] = $data['name']; $sortIndex++; } @@ -183,7 +183,7 @@ class MetaData { private function sort(&$entries, $sortKeys) { if ($this->sorting === self::SORT_USERCOUNT) { array_multisort($sortKeys, SORT_DESC, $entries); - } else if ($this->sorting === self::SORT_GROUPNAME) { + } elseif ($this->sorting === self::SORT_GROUPNAME) { array_multisort($sortKeys, SORT_ASC, $entries); } } diff --git a/lib/private/Http/CookieHelper.php b/lib/private/Http/CookieHelper.php index e895b8531cf..7d2acc7a193 100644 --- a/lib/private/Http/CookieHelper.php +++ b/lib/private/Http/CookieHelper.php @@ -68,7 +68,7 @@ class CookieHelper { if ($samesite === self::SAMESITE_LAX) { $header .= '; SameSite=Lax'; - } else if ($samesite === self::SAMESITE_STRICT) { + } elseif ($samesite === self::SAMESITE_STRICT) { $header .= '; SameSite=Strict'; } diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 5624155dadd..a5b208cfb3c 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -505,7 +505,7 @@ class Factory implements IFactory { if (file_exists($this->serverRoot . '/' . $app . '/l10n/')) { return $this->serverRoot . '/' . $app . '/l10n/'; } - } else if ($app && \OC_App::getAppPath($app) !== false) { + } elseif ($app && \OC_App::getAppPath($app) !== false) { // Check if the app is in the app folder return \OC_App::getAppPath($app) . '/l10n/'; } @@ -603,7 +603,7 @@ class Factory implements IFactory { 'code' => $lang, 'name' => $potentialName ]; - } else if ($lang === 'en') { + } elseif ($lang === 'en') { $ln = [ 'code' => $lang, 'name' => 'English (US)' diff --git a/lib/private/L10N/L10N.php b/lib/private/L10N/L10N.php index ee339ba8840..fc50e7a8b43 100644 --- a/lib/private/L10N/L10N.php +++ b/lib/private/L10N/L10N.php @@ -178,10 +178,10 @@ class L10N implements IL10N { $value = new \DateTime(); if ($data instanceof \DateTime) { $value = $data; - } else if (\is_string($data) && !is_numeric($data)) { + } elseif (\is_string($data) && !is_numeric($data)) { $data = strtotime($data); $value->setTimestamp($data); - } else if ($data !== null) { + } elseif ($data !== null) { $data = (int)$data; $value->setTimestamp($data); } diff --git a/lib/private/LargeFileHelper.php b/lib/private/LargeFileHelper.php index fb4ef1ce4f7..603fe7e461f 100755 --- a/lib/private/LargeFileHelper.php +++ b/lib/private/LargeFileHelper.php @@ -75,9 +75,9 @@ class LargeFileHelper { if (is_float($number)) { // Undo the effect of the php.ini setting 'precision'. return number_format($number, 0, '', ''); - } else if (is_string($number) && ctype_digit($number)) { + } elseif (is_string($number) && ctype_digit($number)) { return $number; - } else if (is_int($number)) { + } elseif (is_int($number)) { // Interpret signed integer as unsigned integer. return sprintf('%u', $number); } else { @@ -151,7 +151,7 @@ class LargeFileHelper { $result = null; if (strpos($os, 'linux') !== false) { $result = $this->exec("stat -c %s $arg"); - } else if (strpos($os, 'bsd') !== false || strpos($os, 'darwin') !== false) { + } elseif (strpos($os, 'bsd') !== false || strpos($os, 'darwin') !== false) { $result = $this->exec("stat -f %z $arg"); } return $result; diff --git a/lib/private/Lock/AbstractLockingProvider.php b/lib/private/Lock/AbstractLockingProvider.php index 91870325fe2..81d949d2a06 100644 --- a/lib/private/Lock/AbstractLockingProvider.php +++ b/lib/private/Lock/AbstractLockingProvider.php @@ -87,7 +87,7 @@ abstract class AbstractLockingProvider implements ILockingProvider { unset($this->acquiredLocks['shared'][$path]); } } - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { unset($this->acquiredLocks['exclusive'][$path]); } } @@ -105,7 +105,7 @@ abstract class AbstractLockingProvider implements ILockingProvider { $this->acquiredLocks['shared'][$path] = 0; } $this->acquiredLocks['shared'][$path]++; - } else if ($targetType === self::LOCK_EXCLUSIVE) { + } elseif ($targetType === self::LOCK_EXCLUSIVE) { $this->acquiredLocks['exclusive'][$path] = true; $this->acquiredLocks['shared'][$path]--; } diff --git a/lib/private/Lock/DBLockingProvider.php b/lib/private/Lock/DBLockingProvider.php index a8c22b59cb1..d68535e3e9b 100644 --- a/lib/private/Lock/DBLockingProvider.php +++ b/lib/private/Lock/DBLockingProvider.php @@ -98,7 +98,7 @@ class DBLockingProvider extends AbstractLockingProvider { if ($this->cacheSharedLocks) { if ($targetType === self::LOCK_SHARED) { $this->sharedLocks[$path] = true; - } else if ($targetType === self::LOCK_EXCLUSIVE) { + } elseif ($targetType === self::LOCK_EXCLUSIVE) { $this->sharedLocks[$path] = false; } } @@ -167,7 +167,7 @@ class DBLockingProvider extends AbstractLockingProvider { } else { return $lockValue > 0; } - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { return $lockValue === -1; } else { return false; @@ -227,7 +227,7 @@ class DBLockingProvider extends AbstractLockingProvider { 'UPDATE `*PREFIX*file_locks` SET `lock` = 0 WHERE `key` = ? AND `lock` = -1', [$path] ); - } else if (!$this->cacheSharedLocks) { + } elseif (!$this->cacheSharedLocks) { $query = $this->connection->getQueryBuilder(); $query->update('file_locks') ->set('lock', $query->func()->subtract('lock', $query->createNamedParameter(1))) diff --git a/lib/private/Lock/MemcacheLockingProvider.php b/lib/private/Lock/MemcacheLockingProvider.php index 6cab64b3a02..2c2d8a95938 100644 --- a/lib/private/Lock/MemcacheLockingProvider.php +++ b/lib/private/Lock/MemcacheLockingProvider.php @@ -60,7 +60,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { $lockValue = $this->memcache->get($path); if ($type === self::LOCK_SHARED) { return $lockValue > 0; - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { return $lockValue === 'exclusive'; } else { return false; @@ -108,7 +108,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { if ($newValue < 0) { $this->memcache->cad($path, $newValue); } - } else if ($type === self::LOCK_EXCLUSIVE) { + } elseif ($type === self::LOCK_EXCLUSIVE) { $this->memcache->cad($path, 'exclusive'); } $this->markRelease($path, $type); @@ -126,7 +126,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { if (!$this->memcache->cas($path, 'exclusive', 1)) { throw new LockedException($path, null, $this->getExistingLockForException($path)); } - } else if ($targetType === self::LOCK_EXCLUSIVE) { + } elseif ($targetType === self::LOCK_EXCLUSIVE) { // we can only change a shared lock to an exclusive if there's only a single owner of the shared lock if (!$this->memcache->cas($path, 1, 'exclusive')) { throw new LockedException($path, null, $this->getExistingLockForException($path)); @@ -140,7 +140,7 @@ class MemcacheLockingProvider extends AbstractLockingProvider { $existing = $this->memcache->get($path); if (!$existing) { return 'none'; - } else if ($existing === 'exclusive') { + } elseif ($existing === 'exclusive') { return $existing; } else { return $existing . ' shared locks'; diff --git a/lib/private/Log/ExceptionSerializer.php b/lib/private/Log/ExceptionSerializer.php index 4ec35b95673..50544d7149c 100644 --- a/lib/private/Log/ExceptionSerializer.php +++ b/lib/private/Log/ExceptionSerializer.php @@ -132,7 +132,7 @@ class ExceptionSerializer { foreach ($args as &$arg) { if (in_array($arg, $values, true)) { $arg = '*** sensitive parameter replaced ***'; - } else if (is_array($arg)) { + } elseif (is_array($arg)) { $arg = $this->removeValuesFromArgs($arg, $values); } } @@ -154,7 +154,7 @@ class ExceptionSerializer { $data = get_object_vars($arg); $data['__class__'] = get_class($arg); return array_map([$this, 'encodeArg'], $data); - } else if (is_array($arg)) { + } elseif (is_array($arg)) { return array_map([$this, 'encodeArg'], $arg); } else { return $arg; diff --git a/lib/private/MemoryInfo.php b/lib/private/MemoryInfo.php index 26f0d6a2869..37bf98fef59 100644 --- a/lib/private/MemoryInfo.php +++ b/lib/private/MemoryInfo.php @@ -52,7 +52,7 @@ class MemoryInfo { $iniValue = trim(ini_get('memory_limit')); if ($iniValue === '-1') { return -1; - } else if (is_numeric($iniValue) === true) { + } elseif (is_numeric($iniValue) === true) { return (int)$iniValue; } else { return $this->memoryLimitToBytes($iniValue); diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 8d72040af9a..b71e194398f 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -138,7 +138,7 @@ class NavigationManager implements INavigationManager { uasort($list, function ($a, $b) { if (isset($a['order']) && isset($b['order'])) { return ($a['order'] < $b['order']) ? -1 : 1; - } else if (isset($a['order']) || isset($b['order'])) { + } elseif (isset($a['order']) || isset($b['order'])) { return isset($a['order']) ? -1 : 1; } else { return ($a['name'] < $b['name']) ? -1 : 1; diff --git a/lib/private/Preview/Generator.php b/lib/private/Preview/Generator.php index 4ee8518981c..f945849c276 100644 --- a/lib/private/Preview/Generator.php +++ b/lib/private/Preview/Generator.php @@ -297,7 +297,7 @@ class Generator { } else { $width = $height / $ratio; } - } else if ($mode === IPreview::MODE_COVER) { + } elseif ($mode === IPreview::MODE_COVER) { if ($ratioH > $ratioW) { $width = $height / $ratio; } else { diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php index 3144a006d8b..9aa822c40c8 100644 --- a/lib/private/RedisFactory.php +++ b/lib/private/RedisFactory.php @@ -78,7 +78,7 @@ class RedisFactory { } if (isset($config['port'])) { $port = $config['port']; - } else if ($host[0] !== '/') { + } elseif ($host[0] !== '/') { $port = 6379; } else { $port = null; diff --git a/lib/private/Remote/Api/OCS.php b/lib/private/Remote/Api/OCS.php index 6a32c83e086..1ebf1e4a0df 100644 --- a/lib/private/Remote/Api/OCS.php +++ b/lib/private/Remote/Api/OCS.php @@ -48,7 +48,7 @@ class OCS extends ApiBase implements ICapabilitiesApi, IUserApi { } catch (ClientException $e) { if ($e->getResponse()->getStatusCode() === 404) { throw new NotFoundException(); - } else if ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) { + } elseif ($e->getResponse()->getStatusCode() === 403 || $e->getResponse()->getStatusCode() === 401) { throw new ForbiddenException(); } else { throw $e; diff --git a/lib/private/Repair/Owncloud/SaveAccountsTableData.php b/lib/private/Repair/Owncloud/SaveAccountsTableData.php index 171683e8f9b..12515f2e882 100644 --- a/lib/private/Repair/Owncloud/SaveAccountsTableData.php +++ b/lib/private/Repair/Owncloud/SaveAccountsTableData.php @@ -177,7 +177,7 @@ class SaveAccountsTableData implements IRepairStep { } if ($state === 1) { $this->config->setUserValue($userdata['user_id'], 'core', 'enabled', 'true'); - } else if ($state === 2) { + } elseif ($state === 2) { $this->config->setUserValue($userdata['user_id'], 'core', 'enabled', 'false'); } diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 5b73a1f697e..b125fd60164 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -251,16 +251,16 @@ class Router implements IRouter { $app = \OC_App::cleanAppId($app); \OC::$REQUESTEDAPP = $app; $this->loadRoutes($app); - } else if (substr($url, 0, 13) === '/ocsapp/apps/') { + } elseif (substr($url, 0, 13) === '/ocsapp/apps/') { // empty string / 'ocsapp' / 'apps' / $app / rest of the route list(, , , $app,) = explode('/', $url, 5); $app = \OC_App::cleanAppId($app); \OC::$REQUESTEDAPP = $app; $this->loadRoutes($app); - } else if (substr($url, 0, 10) === '/settings/') { + } elseif (substr($url, 0, 10) === '/settings/') { $this->loadRoutes('settings'); - } else if (substr($url, 0, 6) === '/core/') { + } elseif (substr($url, 0, 6) === '/core/') { \OC::$REQUESTEDAPP = $url; if (!\OC::$server->getConfig()->getSystemValueBool('maintenance') && !Util::needUpgrade()) { \OC_App::loadApps(); diff --git a/lib/private/Search.php b/lib/private/Search.php index 42a925f90d9..f58822d68f6 100644 --- a/lib/private/Search.php +++ b/lib/private/Search.php @@ -58,7 +58,7 @@ class Search implements ISearch { } if ($provider instanceof PagedProvider) { $results = array_merge($results, $provider->searchPaged($query, $page, $size)); - } else if ($provider instanceof Provider) { + } elseif ($provider instanceof Provider) { $providerResults = $provider->search($query); if ($size > 0) { $slicedResults = array_slice($providerResults, ($page - 1) * $size, $size); diff --git a/lib/private/Security/Bruteforce/Throttler.php b/lib/private/Security/Bruteforce/Throttler.php index 8e58e9bde9a..d8e06032ef1 100644 --- a/lib/private/Security/Bruteforce/Throttler.php +++ b/lib/private/Security/Bruteforce/Throttler.php @@ -151,7 +151,7 @@ class Throttler { if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { $type = 4; - } else if (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { + } elseif (filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { $type = 6; } else { return false; diff --git a/lib/private/ServerContainer.php b/lib/private/ServerContainer.php index 13fb70ddd44..effa57a3abf 100644 --- a/lib/private/ServerContainer.php +++ b/lib/private/ServerContainer.php @@ -135,7 +135,7 @@ class ServerContainer extends SimpleContainer { // Didn't find the service or the respective app container, // ignore it and fall back to the core container. } - } else if (strpos($name, 'OC\\Settings\\') === 0 && substr_count($name, '\\') >= 3) { + } elseif (strpos($name, 'OC\\Settings\\') === 0 && substr_count($name, '\\') >= 3) { $segments = explode('\\', $name); try { $appContainer = $this->getAppContainer(strtolower($segments[1]), $segments[1]); diff --git a/lib/private/Setup/AbstractDatabase.php b/lib/private/Setup/AbstractDatabase.php index db6b182be63..d509a6b8722 100644 --- a/lib/private/Setup/AbstractDatabase.php +++ b/lib/private/Setup/AbstractDatabase.php @@ -71,9 +71,9 @@ abstract class AbstractDatabase { $errors = []; if(empty($config['dbuser']) && empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); - } else if(empty($config['dbuser'])) { + } elseif(empty($config['dbuser'])) { $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); - } else if(empty($config['dbname'])) { + } elseif(empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); } if(substr_count($config['dbname'], '.') >= 1) { @@ -125,7 +125,7 @@ abstract class AbstractDatabase { } else { $connectionParams['unix_socket'] = $this->dbPort; } - } else if (strpos($this->dbHost, ':')) { + } elseif (strpos($this->dbHost, ':')) { // Host variable may carry a port or socket. list($host, $portOrSocket) = explode(':', $this->dbHost, 2); if (ctype_digit($portOrSocket)) { diff --git a/lib/private/Setup/OCI.php b/lib/private/Setup/OCI.php index ab00c8a47b2..1d7fe27e8b8 100644 --- a/lib/private/Setup/OCI.php +++ b/lib/private/Setup/OCI.php @@ -55,9 +55,9 @@ class OCI extends AbstractDatabase { $errors = []; if (empty($config['dbuser']) && empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database username and name.", [$this->dbprettyname]); - } else if (empty($config['dbuser'])) { + } elseif (empty($config['dbuser'])) { $errors[] = $this->trans->t("%s enter the database username.", [$this->dbprettyname]); - } else if (empty($config['dbname'])) { + } elseif (empty($config['dbname'])) { $errors[] = $this->trans->t("%s enter the database name.", [$this->dbprettyname]); } return $errors; diff --git a/lib/private/Share/Helper.php b/lib/private/Share/Helper.php index 1574bd726cf..a3b8da44c4c 100644 --- a/lib/private/Share/Helper.php +++ b/lib/private/Share/Helper.php @@ -213,7 +213,7 @@ class Helper extends \OC\Share\Constants { } else { $expires = $userExpireDate; } - } else if ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) { + } elseif ($defaultExpires && !empty($defaultExpireSettings['enforceExpireDate'])) { $expires = $defaultExpires; } diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php index 9b74239d69d..319bd5bec38 100644 --- a/lib/private/Share/Share.php +++ b/lib/private/Share/Share.php @@ -356,7 +356,7 @@ class Share extends Constants { // if there is more then one result we don't have to delete the children // but update their parent. For group shares the new parent should always be // the original group share and not the db entry with the unique name - } else if ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { + } elseif ((int)$item['share_type'] === self::$shareTypeGroupUserUnique) { $newParent = $item['parent']; } else { $newParent = $item['id']; @@ -457,7 +457,7 @@ class Share extends Constants { $l = \OC::$server->getL10N('lib'); if (isset(self::$backends[$itemType])) { return self::$backends[$itemType]; - } else if (isset(self::$backendTypes[$itemType]['class'])) { + } elseif (isset(self::$backendTypes[$itemType]['class'])) { $class = self::$backendTypes[$itemType]['class']; if (class_exists($class)) { self::$backends[$itemType] = new $class; @@ -778,7 +778,7 @@ class Share extends Constants { if ($row['permissions'] == 0) { continue; } - } else if (!isset($uidOwner)) { + } elseif (!isset($uidOwner)) { // Check if the same target already exists if (isset($targets[$row['id']])) { // Check if the same owner shared with the user twice @@ -858,7 +858,7 @@ class Share extends Constants { $row['share_type'] === self::SHARE_TYPE_USER) { $shareWithUser = \OC::$server->getUserManager()->get($row['share_with']); $row['share_with_displayname'] = $shareWithUser === null ? $row['share_with'] : $shareWithUser->getDisplayName(); - } else if(isset($row['share_with']) && $row['share_with'] != '' && + } elseif(isset($row['share_with']) && $row['share_with'] != '' && $row['share_type'] === self::SHARE_TYPE_REMOTE) { $addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); foreach ($addressBookEntries as $entry) { @@ -1417,7 +1417,7 @@ class Share extends Constants { private static function formatResult($items, $column, $backend, $format = self::FORMAT_NONE , $parameters = null) { if ($format === self::FORMAT_NONE) { return $items; - } else if ($format === self::FORMAT_STATUSES) { + } elseif ($format === self::FORMAT_STATUSES) { $statuses = []; foreach ($items as $item) { if ($item['share_type'] === self::SHARE_TYPE_LINK) { @@ -1425,7 +1425,7 @@ class Share extends Constants { continue; } $statuses[$item[$column]]['link'] = true; - } else if (!isset($statuses[$item[$column]])) { + } elseif (!isset($statuses[$item[$column]])) { $statuses[$item[$column]]['link'] = false; } if (!empty($item['file_target'])) { @@ -1447,7 +1447,7 @@ class Share extends Constants { public static function removeProtocolFromUrl($url) { if (strpos($url, 'https://') === 0) { return substr($url, strlen('https://')); - } else if (strpos($url, 'http://') === 0) { + } elseif (strpos($url, 'http://') === 0) { return substr($url, strlen('http://')); } diff --git a/lib/private/Share20/DefaultShareProvider.php b/lib/private/Share20/DefaultShareProvider.php index 1c0ec194528..ad002a1fc96 100644 --- a/lib/private/Share20/DefaultShareProvider.php +++ b/lib/private/Share20/DefaultShareProvider.php @@ -152,7 +152,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getExpirationDate() !== null) { $qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime')); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { //Set the GID of the group we share with $qb->setValue('share_with', $qb->createNamedParameter($share->getSharedWith())); @@ -160,7 +160,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getExpirationDate() !== null) { $qb->setValue('expiration', $qb->createNamedParameter($share->getExpirationDate(), 'datetime')); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { //set label for public link $qb->setValue('label', $qb->createNamedParameter($share->getLabel())); //Set the token of the share @@ -269,7 +269,7 @@ class DefaultShareProvider implements IShareProvider { ->set('note', $qb->createNamedParameter($share->getNote())) ->set('accepted', $qb->createNamedParameter($share->getStatus())) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) @@ -307,7 +307,7 @@ class DefaultShareProvider implements IShareProvider { ->set('permissions', $qb->createNamedParameter($share->getPermissions())) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $qb = $this->dbConn->getQueryBuilder(); $qb->update('share') ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) @@ -381,7 +381,7 @@ class DefaultShareProvider implements IShareProvider { $id = $data['id']; } - } else if ($share->getShareType() === IShare::TYPE_USER) { + } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { throw new ProviderException('Recipient does not match'); } @@ -519,7 +519,7 @@ class DefaultShareProvider implements IShareProvider { ->execute(); } - } else if ($share->getShareType() === IShare::TYPE_USER) { + } elseif ($share->getShareType() === IShare::TYPE_USER) { if ($share->getSharedWith() !== $recipient) { throw new ProviderException('Recipient does not match'); @@ -601,7 +601,7 @@ class DefaultShareProvider implements IShareProvider { ->where($qb->expr()->eq('id', $qb->createNamedParameter($share->getId()))) ->execute(); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { // Check if there is a usergroup share $qb = $this->dbConn->getQueryBuilder(); @@ -894,7 +894,7 @@ class DefaultShareProvider implements IShareProvider { } $cursor->closeCursor(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { $user = $this->userManager->get($userId); $allGroups = $this->groupManager->getUserGroups($user); @@ -1035,9 +1035,9 @@ class DefaultShareProvider implements IShareProvider { if ($user !== null) { $share->setSharedWithDisplayName($user->getDisplayName()); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $share->setSharedWith($data['share_with']); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $share->setPassword($data['password']); $share->setSendPasswordByTalk((bool)$data['password_by_talk']); $share->setToken($data['token']); @@ -1152,7 +1152,7 @@ class DefaultShareProvider implements IShareProvider { $qb->expr()->eq('share_with', $qb->createNamedParameter($uid)) ) ); - } else if ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { /* * Delete all group shares that are owned by this user * Or special user group shares that are received by this user @@ -1173,7 +1173,7 @@ class DefaultShareProvider implements IShareProvider { $qb->expr()->eq('share_with', $qb->createNamedParameter($uid)) ) ); - } else if ($shareType === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_LINK) { /* * Delete all link shares owned by this user. * And all link shares initiated by this user (until #22327 is in) @@ -1316,7 +1316,7 @@ class DefaultShareProvider implements IShareProvider { $uid = $row['share_with']; $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; - } else if ($type === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($type === \OCP\Share::SHARE_TYPE_GROUP) { $gid = $row['share_with']; $group = $this->groupManager->get($gid); @@ -1330,9 +1330,9 @@ class DefaultShareProvider implements IShareProvider { $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; } - } else if ($type === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($type === \OCP\Share::SHARE_TYPE_LINK) { $link = true; - } else if ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) { + } elseif ($type === self::SHARE_TYPE_USERGROUP && $currentAccess === true) { $uid = $row['share_with']; $users[$uid] = isset($users[$uid]) ? $users[$uid] : []; $users[$uid][$row['id']] = $row; @@ -1396,7 +1396,7 @@ class DefaultShareProvider implements IShareProvider { if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER) { $user = $this->userManager->get($share->getSharedWith()); $this->sendNote([$user], $share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $group = $this->groupManager->get($share->getSharedWith()); $groupMembers = $group->getUsers(); $this->sendNote($groupMembers, $share); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index c56db22c883..7ec678b07fb 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -221,33 +221,33 @@ class Manager implements IManager { if (!$this->userManager->userExists($share->getSharedWith())) { throw new \InvalidArgumentException('SharedWith is not a valid user'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { // We expect a valid group as sharedWith for group shares if (!$this->groupManager->groupExists($share->getSharedWith())) { throw new \InvalidArgumentException('SharedWith is not a valid group'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { if ($share->getSharedWith() !== null) { throw new \InvalidArgumentException('SharedWith should be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { if ($share->getSharedWith() === null) { throw new \InvalidArgumentException('SharedWith should not be empty'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_CIRCLE) { $circle = \OCA\Circles\Api\v1\Circles::detailsCircle($share->getSharedWith()); if ($circle === null) { throw new \InvalidArgumentException('SharedWith is not a valid circle'); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_ROOM) { } else { // We can't handle other types yet throw new \InvalidArgumentException('unknown share type'); @@ -721,13 +721,13 @@ class Manager implements IManager { //Verify the expiration date $share = $this->validateExpirationDateInternal($share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $this->groupCreateChecks($share); //Verify the expiration date $share = $this->validateExpirationDateInternal($share); - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $this->linkCreateChecks($share); $this->setLinkParent($share); @@ -751,7 +751,7 @@ class Manager implements IManager { if ($share->getPassword() !== null) { $share->setPassword($this->hasher->hash($share->getPassword())); } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { $share->setToken( $this->secureRandom->generate( \OC\Share\Constants::TOKEN_LENGTH, @@ -952,7 +952,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_GROUP) { $this->groupCreateChecks($share); if ($share->getExpirationDate() != $originalShare->getExpirationDate()) { @@ -960,7 +960,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_LINK) { $this->linkCreateChecks($share); $this->updateSharePasswordIfNeeded($share, $originalShare); @@ -970,7 +970,7 @@ class Manager implements IManager { $this->validateExpirationDate($share); $expirationDateUpdated = true; } - } else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) { // The new password is not set again if it is the same as the old // one, unless when switching from sending by Talk to sending by // mail. diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index cdfd40c8703..cf23779a8b9 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -257,13 +257,13 @@ class ProviderFactory implements IProviderFactory { $provider = null; if ($id === 'ocinternal') { $provider = $this->defaultShareProvider(); - } else if ($id === 'ocFederatedSharing') { + } elseif ($id === 'ocFederatedSharing') { $provider = $this->federatedShareProvider(); - } else if ($id === 'ocMailShare') { + } elseif ($id === 'ocMailShare') { $provider = $this->getShareByMailProvider(); - } else if ($id === 'ocCircleShare') { + } elseif ($id === 'ocCircleShare') { $provider = $this->getShareByCircleProvider(); - } else if ($id === 'ocRoomShare') { + } elseif ($id === 'ocRoomShare') { $provider = $this->getRoomShareProvider(); } @@ -285,13 +285,13 @@ class ProviderFactory implements IProviderFactory { $shareType === \OCP\Share::SHARE_TYPE_LINK ) { $provider = $this->defaultShareProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_REMOTE || $shareType === \OCP\Share::SHARE_TYPE_REMOTE_GROUP) { $provider = $this->federatedShareProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_EMAIL) { $provider = $this->getShareByMailProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_CIRCLE) { $provider = $this->getShareByCircleProvider(); - } else if ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { + } elseif ($shareType === \OCP\Share::SHARE_TYPE_ROOM) { $provider = $this->getRoomShareProvider(); } diff --git a/lib/private/Streamer.php b/lib/private/Streamer.php index 47348447e6d..7ae03532a83 100644 --- a/lib/private/Streamer.php +++ b/lib/private/Streamer.php @@ -78,7 +78,7 @@ class Streamer { */ if ($size < 4 * 1000 * 1000 * 1000 && $numberOfFiles < 65536) { $this->streamerInstance = new ZipStreamer(['zip64' => false]); - } else if ($request->isUserAgent($this->preferTarFor)) { + } elseif ($request->isUserAgent($this->preferTarFor)) { $this->streamerInstance = new TarStreamer(); } else { $this->streamerInstance = new ZipStreamer(['zip64' => PHP_INT_SIZE !== 4]); diff --git a/lib/private/SystemTag/SystemTagObjectMapper.php b/lib/private/SystemTag/SystemTagObjectMapper.php index 179e16f8e17..e9df865ee96 100644 --- a/lib/private/SystemTag/SystemTagObjectMapper.php +++ b/lib/private/SystemTag/SystemTagObjectMapper.php @@ -69,7 +69,7 @@ class SystemTagObjectMapper implements ISystemTagObjectMapper { public function getTagIdsForObjects($objIds, string $objectType): array { if (!\is_array($objIds)) { $objIds = [$objIds]; - } else if (empty($objIds)) { + } elseif (empty($objIds)) { return []; } diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 781cb0d7794..24573d71fe0 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -121,7 +121,7 @@ class JSConfigHelper { $backend = $this->currentUser->getBackend(); if ($backend instanceof IPasswordConfirmationBackend) { $userBackendAllowsPasswordConfirmation = $backend->canConfirmPassword($uid); - } else if (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { + } elseif (isset($this->excludedUserBackEnds[$this->currentUser->getBackendClassName()])) { $userBackendAllowsPasswordConfirmation = false; } } else { diff --git a/lib/private/Template/JSResourceLocator.php b/lib/private/Template/JSResourceLocator.php index 93fbbf7d55d..0b6cf4e306e 100644 --- a/lib/private/Template/JSResourceLocator.php +++ b/lib/private/Template/JSResourceLocator.php @@ -62,7 +62,7 @@ class JSResourceLocator extends ResourceLocator { if ($found) { return; } - } else if ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js') + } elseif ($this->appendIfExist($this->serverroot, $theme_dir.'apps/'.$script.'.js') || $this->appendIfExist($this->serverroot, $theme_dir.$script.'.js') || $this->appendIfExist($this->serverroot, $script.'.js') || $this->cacheAndAppendCombineJsonIfExist($this->serverroot, $script.'.json') diff --git a/lib/private/TemplateLayout.php b/lib/private/TemplateLayout.php index 968ae7fceb8..cdab4c25693 100644 --- a/lib/private/TemplateLayout.php +++ b/lib/private/TemplateLayout.php @@ -124,12 +124,12 @@ class TemplateLayout extends \OC_Template { $this->assign('themingInvertMenu', false); } - } else if ($renderAs === 'error') { + } elseif ($renderAs === 'error') { parent::__construct('core', 'layout.guest', '', false); $this->assign('bodyid', 'body-login'); $this->assign('user_displayname', ''); $this->assign('user_uid', ''); - } else if ($renderAs === 'guest') { + } elseif ($renderAs === 'guest') { parent::__construct('core', 'layout.guest'); \OC_Util::addStyle('guest'); $this->assign('bodyid', 'body-login'); @@ -137,7 +137,7 @@ class TemplateLayout extends \OC_Template { $userDisplayName = \OC_User::getDisplayName(); $this->assign('user_displayname', $userDisplayName); $this->assign('user_uid', \OC_User::getUser()); - } else if ($renderAs === 'public') { + } elseif ($renderAs === 'public') { parent::__construct('core', 'layout.public'); $this->assign('appid', $appId); $this->assign('bodyid', 'body-public'); diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php index 138e3bed9c3..2dd18467cd9 100644 --- a/lib/private/Updater/ChangesCheck.php +++ b/lib/private/Updater/ChangesCheck.php @@ -98,9 +98,9 @@ class ChangesCheck { protected function evaluateResponse(IResponse $response): int { if($response->getStatusCode() === 304) { return self::RESPONSE_USE_CACHE; - } else if($response->getStatusCode() === 404) { + } elseif($response->getStatusCode() === 404) { return self::RESPONSE_NO_CONTENT; - } else if($response->getStatusCode() === 200) { + } elseif($response->getStatusCode() === 200) { return self::RESPONSE_HAS_CONTENT; } $this->logger->debug('Unexpected return code {code} from changelog server', [ diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index 7b129a393e3..d908a3d78b2 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -480,7 +480,7 @@ class Session implements IUserSession, Emitter { if ($isTokenPassword) { $this->session->set('app_password', $password); - } else if($this->supportsCookies($request)) { + } elseif($this->supportsCookies($request)) { // Password login, but cookies supported -> create (browser) session token $this->createSessionToken($request, $this->getUser()->getUID(), $user, $password); } diff --git a/lib/private/User/User.php b/lib/private/User/User.php index bc492a6df29..6bd86bbc516 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -460,7 +460,7 @@ class User implements IUser { private function removeProtocolFromUrl($url) { if (strpos($url, 'https://') === 0) { return substr($url, strlen('https://')); - } else if (strpos($url, 'http://') === 0) { + } elseif (strpos($url, 'http://') === 0) { return substr($url, strlen('http://')); } diff --git a/lib/private/legacy/OC_API.php b/lib/private/legacy/OC_API.php index 47590a00910..b9960c70777 100644 --- a/lib/private/legacy/OC_API.php +++ b/lib/private/legacy/OC_API.php @@ -85,7 +85,7 @@ class OC_API { if ($k[0] === '@') { $writer->writeAttribute(substr($k, 1), $v); continue; - } else if (is_numeric($k)) { + } elseif (is_numeric($k)) { $k = 'element'; } if(is_array($v)) { diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php index 996b7a885c6..3cc194cc03d 100644 --- a/lib/private/legacy/OC_App.php +++ b/lib/private/legacy/OC_App.php @@ -216,7 +216,7 @@ class OC_App { 'class' => $plugin['@value'], ]; \OC::$server->getCollaboratorSearch()->registerPlugin($pluginInfo); - } else if ($plugin['@attributes']['type'] === 'autocomplete-sort') { + } elseif ($plugin['@attributes']['type'] === 'autocomplete-sort') { \OC::$server->getAutoCompleteManager()->registerSorter($plugin['@value']); } } @@ -733,7 +733,7 @@ class OC_App { $info['groups'] = null; if ($enabled === 'yes') { $active = true; - } else if ($enabled === 'no') { + } elseif ($enabled === 'no') { $active = false; } else { $active = true; @@ -847,9 +847,9 @@ class OC_App { $requireMin = $appInfo['dependencies']['nextcloud']['@attributes']['min-version']; } elseif (isset($appInfo['dependencies']['owncloud']['@attributes']['min-version'])) { $requireMin = $appInfo['dependencies']['owncloud']['@attributes']['min-version']; - } else if (isset($appInfo['requiremin'])) { + } elseif (isset($appInfo['requiremin'])) { $requireMin = $appInfo['requiremin']; - } else if (isset($appInfo['require'])) { + } elseif (isset($appInfo['require'])) { $requireMin = $appInfo['require']; } @@ -857,7 +857,7 @@ class OC_App { $requireMax = $appInfo['dependencies']['nextcloud']['@attributes']['max-version']; } elseif (isset($appInfo['dependencies']['owncloud']['@attributes']['max-version'])) { $requireMax = $appInfo['dependencies']['owncloud']['@attributes']['max-version']; - } else if (isset($appInfo['requiremax'])) { + } elseif (isset($appInfo['requiremax'])) { $requireMax = $appInfo['requiremax']; } @@ -1055,7 +1055,7 @@ class OC_App { if ($attributeLang === $similarLang) { $similarLangFallback = $option['@value']; - } else if (strpos($attributeLang, $similarLang . '_') === 0) { + } elseif (strpos($attributeLang, $similarLang . '_') === 0) { if ($similarLangFallback === false) { $similarLangFallback = $option['@value']; } @@ -1067,7 +1067,7 @@ class OC_App { if ($similarLangFallback !== false) { return $similarLangFallback; - } else if ($englishFallback !== false) { + } elseif ($englishFallback !== false) { return $englishFallback; } return (string) $fallback; @@ -1090,7 +1090,7 @@ class OC_App { } if ($lang && isset($data['description']) && is_array($data['description'])) { $data['description'] = trim(self::findBestL10NOption($data['description'], $lang)); - } else if (isset($data['description']) && is_string($data['description'])) { + } elseif (isset($data['description']) && is_string($data['description'])) { $data['description'] = trim($data['description']); } else { $data['description'] = ''; diff --git a/lib/private/legacy/OC_Helper.php b/lib/private/legacy/OC_Helper.php index 73154909a4a..1c4ce50f4ef 100644 --- a/lib/private/legacy/OC_Helper.php +++ b/lib/private/legacy/OC_Helper.php @@ -168,7 +168,7 @@ class OC_Helper { /** @var SplFileInfo $fileInfo */ if ($fileInfo->isLink()) { unlink($fileInfo->getPathname()); - } else if ($fileInfo->isDir()) { + } elseif ($fileInfo->isDir()) { rmdir($fileInfo->getRealPath()); } else { unlink($fileInfo->getRealPath()); diff --git a/lib/private/legacy/OC_Image.php b/lib/private/legacy/OC_Image.php index 7d23ece7ffa..829a9b81652 100644 --- a/lib/private/legacy/OC_Image.php +++ b/lib/private/legacy/OC_Image.php @@ -1078,7 +1078,7 @@ if (!function_exists('imagebmp')) { function imagebmp($im, $fileName = '', $bit = 24, $compression = 0) { if (!in_array($bit, [1, 4, 8, 16, 24, 32])) { $bit = 24; - } else if ($bit == 32) { + } elseif ($bit == 32) { $bit = 24; } $bits = pow(2, $bit); @@ -1115,7 +1115,7 @@ if (!function_exists('imagebmp')) { $bmpData .= $extra; } } // RLE8 - else if ($compression == 1 && $bit == 8) { + elseif ($compression == 1 && $bit == 8) { for ($j = $height - 1; $j >= 0; $j--) { $lastIndex = "\0"; $sameNum = 0; diff --git a/lib/private/legacy/OC_Util.php b/lib/private/legacy/OC_Util.php index 4d7d00f5dc2..9322ef07a79 100644 --- a/lib/private/legacy/OC_Util.php +++ b/lib/private/legacy/OC_Util.php @@ -189,7 +189,7 @@ class OC_Util { // If we are not forced to load a specific user we load the one that is logged in if ($user === null) { $user = ''; - } else if ($user == "" && \OC::$server->getUserSession()->isLoggedIn()) { + } elseif ($user == "" && \OC::$server->getUserSession()->isLoggedIn()) { $user = OC_User::getUser(); } @@ -788,7 +788,7 @@ class OC_Util { [$urlGenerator->linkToDocs('admin-dir_permissions')]) ]; } - } else if (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { + } elseif (!is_writable($CONFIG_DATADIRECTORY) or !is_readable($CONFIG_DATADIRECTORY)) { // is_writable doesn't work for NFS mounts, so try to write a file and check if it exists. $testFile = sprintf('%s/%s.tmp', $CONFIG_DATADIRECTORY, uniqid('data_dir_writability_test_')); $handle = fopen($testFile, 'w'); @@ -1421,7 +1421,7 @@ class OC_Util { $versionDiff = version_compare($currentVersion, $installedVersion); if ($versionDiff > 0) { return true; - } else if ($config->getValue('debug', false) && $versionDiff < 0) { + } elseif ($config->getValue('debug', false) && $versionDiff < 0) { // downgrade with debug $installedMajor = explode('.', $installedVersion); $installedMajor = $installedMajor[0] . '.' . $installedMajor[1]; @@ -1434,7 +1434,7 @@ class OC_Util { // downgrade attempt, throw exception throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); } - } else if ($versionDiff < 0) { + } elseif ($versionDiff < 0) { // downgrade attempt, throw exception throw new \OC\HintException('Downgrading is not supported and is likely to cause unpredictable issues (from ' . $installedVersion . ' to ' . $currentVersion . ')'); } diff --git a/lib/private/legacy/template/functions.php b/lib/private/legacy/template/functions.php index e42ef796f0f..83751db1e31 100644 --- a/lib/private/legacy/template/functions.php +++ b/lib/private/legacy/template/functions.php @@ -81,7 +81,7 @@ function emit_script_tag($src, $script_content='') { if (!empty($src)) { // emit script tag for deferred loading from $src $s.=$defer_str.' src="' . $src .'">'; - } else if (!empty($script_content)) { + } elseif (!empty($script_content)) { // emit script tag for inline script from $script_content without defer (see MDN) $s.=">\n".$script_content."\n"; } else { |