summaryrefslogtreecommitdiffstats
path: root/core/Command
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2020-04-10 14:19:56 +0200
commitcaff1023ea72bb2ea94130e18a2a6e2ccf819e5f (patch)
tree186d494c2aea5dea7255d3584ef5d595fc6e6194 /core/Command
parentedf8ce32cffdb920e8171207b342abbd7f1fbe73 (diff)
downloadnextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.tar.gz
nextcloud-server-caff1023ea72bb2ea94130e18a2a6e2ccf819e5f.zip
Format control structures, classes, methods and function
To continue this formatting madness, here's a tiny patch that adds unified formatting for control structures like if and loops as well as classes, their methods and anonymous functions. This basically forces the constructs to start on the same line. This is not exactly what PSR2 wants, but I think we can have a few exceptions with "our" style. The starting of braces on the same line is pracrically standard for our code. This also removes and empty lines from method/function bodies at the beginning and end. Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/Command')
-rw-r--r--core/Command/App/CheckCode.php15
-rw-r--r--core/Command/App/Install.php5
-rw-r--r--core/Command/App/ListApps.php4
-rw-r--r--core/Command/App/Remove.php6
-rw-r--r--core/Command/App/Update.php5
-rw-r--r--core/Command/Background/Ajax.php1
-rw-r--r--core/Command/Background/Base.php2
-rw-r--r--core/Command/Background/Cron.php1
-rw-r--r--core/Command/Background/WebCron.php1
-rw-r--r--core/Command/Broadcast/Test.php1
-rw-r--r--core/Command/Config/Import.php2
-rw-r--r--core/Command/Config/System/DeleteConfig.php3
-rw-r--r--core/Command/Db/AddMissingColumns.php1
-rw-r--r--core/Command/Db/AddMissingIndices.php1
-rw-r--r--core/Command/Db/ConvertFilecacheBigInt.php1
-rw-r--r--core/Command/Db/ConvertType.php8
-rw-r--r--core/Command/Db/Migrations/ExecuteCommand.php1
-rw-r--r--core/Command/Db/Migrations/GenerateCommand.php1
-rw-r--r--core/Command/Db/Migrations/MigrateCommand.php1
-rw-r--r--core/Command/Db/Migrations/StatusCommand.php3
-rw-r--r--core/Command/Encryption/ChangeKeyStorageRoot.php10
-rw-r--r--core/Command/Encryption/DecryptAll.php1
-rw-r--r--core/Command/Encryption/EncryptAll.php1
-rw-r--r--core/Command/Encryption/ShowKeyStorageRoot.php3
-rw-r--r--core/Command/Integrity/CheckApp.php3
-rw-r--r--core/Command/Integrity/CheckCore.php2
-rw-r--r--core/Command/Integrity/SignApp.php8
-rw-r--r--core/Command/Integrity/SignCore.php8
-rw-r--r--core/Command/InterruptedException.php3
-rw-r--r--core/Command/L10n/CreateJs.php9
-rw-r--r--core/Command/Log/Manage.php1
-rw-r--r--core/Command/Maintenance/Install.php2
-rw-r--r--core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php10
-rw-r--r--core/Command/Maintenance/Mimetype/UpdateDB.php1
-rw-r--r--core/Command/Maintenance/UpdateHtaccess.php1
-rw-r--r--core/Command/TwoFactorAuth/Cleanup.php1
-rw-r--r--core/Command/TwoFactorAuth/Disable.php1
-rw-r--r--core/Command/TwoFactorAuth/Enable.php1
-rw-r--r--core/Command/TwoFactorAuth/Enforce.php1
-rw-r--r--core/Command/TwoFactorAuth/State.php1
-rw-r--r--core/Command/Upgrade.php12
-rw-r--r--core/Command/User/Add.php4
-rw-r--r--core/Command/User/LastSeen.php4
-rw-r--r--core/Command/User/Report.php4
-rw-r--r--core/Command/User/Setting.php2
45 files changed, 57 insertions, 100 deletions
diff --git a/core/Command/App/CheckCode.php b/core/Command/App/CheckCode.php
index d37211d3add..185ec0e64a3 100644
--- a/core/Command/App/CheckCode.php
+++ b/core/Command/App/CheckCode.php
@@ -42,8 +42,7 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
-class CheckCode extends Command implements CompletionAwareInterface {
-
+class CheckCode extends Command implements CompletionAwareInterface {
protected $checkers = [
'private' => PrivateCheck::class,
'deprecation' => DeprecationCheck::class,
@@ -95,7 +94,7 @@ class CheckCode extends Command implements CompletionAwareInterface {
$codeChecker = new CodeChecker($checkList, !$input->getOption('skip-validate-info'));
$codeChecker->listen('CodeChecker', 'analyseFileBegin', function ($params) use ($output) {
- if(OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
+ if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln("<info>Analysing {$params}</info>");
}
});
@@ -103,29 +102,29 @@ class CheckCode extends Command implements CompletionAwareInterface {
$count = count($errors);
// show filename if the verbosity is low, but there are errors in a file
- if($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
+ if ($count > 0 && OutputInterface::VERBOSITY_VERBOSE > $output->getVerbosity()) {
$output->writeln("<info>Analysing {$filename}</info>");
}
// show error count if there are errors present or the verbosity is high
- if($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
+ if ($count > 0 || OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
$output->writeln(" {$count} errors");
}
usort($errors, function ($a, $b) {
return $a['line'] >$b['line'];
});
- foreach($errors as $p) {
+ foreach ($errors as $p) {
$line = sprintf("%' 4d", $p['line']);
$output->writeln(" <error>line $line: {$p['disallowedToken']} - {$p['reason']}</error>");
}
});
$errors = [];
- if(!$input->getOption('skip-checkers')) {
+ if (!$input->getOption('skip-checkers')) {
$errors = $codeChecker->analyse($appId);
}
- if(!$input->getOption('skip-validate-info')) {
+ if (!$input->getOption('skip-validate-info')) {
$infoChecker = new InfoChecker();
$infoChecker->listen('InfoChecker', 'parseError', function ($error) use ($output) {
$output->writeln("<error>Invalid appinfo.xml file found: $error</error>");
diff --git a/core/Command/App/Install.php b/core/Command/App/Install.php
index 7248ec1e425..49f4f0b804e 100644
--- a/core/Command/App/Install.php
+++ b/core/Command/App/Install.php
@@ -32,7 +32,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Install extends Command {
-
protected function configure() {
$this
->setName('app:install')
@@ -64,12 +63,12 @@ class Install extends Command {
$installer = \OC::$server->query(Installer::class);
$installer->downloadApp($appId);
$result = $installer->installApp($appId);
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage());
return 1;
}
- if($result === false) {
+ if ($result === false) {
$output->writeln($appId . ' couldn\'t be installed');
return 1;
}
diff --git a/core/Command/App/ListApps.php b/core/Command/App/ListApps.php
index 84fdf7f8f41..0765ab39a24 100644
--- a/core/Command/App/ListApps.php
+++ b/core/Command/App/ListApps.php
@@ -62,7 +62,7 @@ class ListApps extends Base {
}
protected function execute(InputInterface $input, OutputInterface $output) {
- if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false'){
+ if ($input->getOption('shipped') === 'true' || $input->getOption('shipped') === 'false') {
$shippedFilter = $input->getOption('shipped') === 'true';
} else {
$shippedFilter = null;
@@ -74,7 +74,7 @@ class ListApps extends Base {
//sort enabled apps above disabled apps
foreach ($apps as $app) {
- if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter){
+ if ($shippedFilter !== null && $this->manager->isShipped($app) !== $shippedFilter) {
continue;
}
if ($this->manager->isInstalled($app)) {
diff --git a/core/Command/App/Remove.php b/core/Command/App/Remove.php
index bb264e77e5f..d3e91332d77 100644
--- a/core/Command/App/Remove.php
+++ b/core/Command/App/Remove.php
@@ -96,7 +96,7 @@ class Remove extends Command implements CompletionAwareInterface {
try {
$this->manager->disableApp($appId);
$output->writeln($appId . ' disabled');
- } catch(Throwable $e) {
+ } catch (Throwable $e) {
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
$this->logger->logException($e, [
'app' => 'CLI',
@@ -109,7 +109,7 @@ class Remove extends Command implements CompletionAwareInterface {
// Let's try to remove the app...
try {
$result = $this->installer->removeApp($appId);
- } catch(Throwable $e) {
+ } catch (Throwable $e) {
$output->writeln('<error>Error: ' . $e->getMessage() . '</error>');
$this->logger->logException($e, [
'app' => 'CLI',
@@ -118,7 +118,7 @@ class Remove extends Command implements CompletionAwareInterface {
return 1;
}
- if($result === false) {
+ if ($result === false) {
$output->writeln($appId . ' could not be removed');
return 1;
}
diff --git a/core/Command/App/Update.php b/core/Command/App/Update.php
index 4be2f4639ef..417d1915d05 100644
--- a/core/Command/App/Update.php
+++ b/core/Command/App/Update.php
@@ -91,7 +91,6 @@ class Update extends Command {
$output->writeln($singleAppId . ' not installed');
return 1;
}
-
} elseif ($input->getOption('all') || $input->getOption('showonly')) {
$apps = \OC_App::getAllApps();
} else {
@@ -108,7 +107,7 @@ class Update extends Command {
if (!$input->getOption('showonly')) {
try {
$result = $this->installer->updateAppstoreApp($appId);
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
$this->logger->logException($e, ['message' => 'Failure during update of app "' . $appId . '"','app' => 'app:update']);
$output->writeln('Error: ' . $e->getMessage());
$return = 1;
@@ -117,7 +116,7 @@ class Update extends Command {
if ($result === false) {
$output->writeln($appId . ' couldn\'t be updated');
$return = 1;
- } elseif($result === true) {
+ } elseif ($result === true) {
$output->writeln($appId . ' updated');
}
}
diff --git a/core/Command/Background/Ajax.php b/core/Command/Background/Ajax.php
index 3eb00655ead..5dc94d939d7 100644
--- a/core/Command/Background/Ajax.php
+++ b/core/Command/Background/Ajax.php
@@ -26,7 +26,6 @@
namespace OC\Core\Command\Background;
class Ajax extends Base {
-
protected function getMode() {
return 'ajax';
}
diff --git a/core/Command/Background/Base.php b/core/Command/Background/Base.php
index a00a8fe4c51..41466660000 100644
--- a/core/Command/Background/Base.php
+++ b/core/Command/Background/Base.php
@@ -37,8 +37,6 @@ use Symfony\Component\Console\Output\OutputInterface;
* Subclasses will override the getMode() function to specify the mode to configure.
*/
abstract class Base extends Command {
-
-
abstract protected function getMode();
/**
diff --git a/core/Command/Background/Cron.php b/core/Command/Background/Cron.php
index 27253a355b2..9dbb4f855e5 100644
--- a/core/Command/Background/Cron.php
+++ b/core/Command/Background/Cron.php
@@ -26,7 +26,6 @@
namespace OC\Core\Command\Background;
class Cron extends Base {
-
protected function getMode() {
return 'cron';
}
diff --git a/core/Command/Background/WebCron.php b/core/Command/Background/WebCron.php
index 76bcf83a304..7da379b6a53 100644
--- a/core/Command/Background/WebCron.php
+++ b/core/Command/Background/WebCron.php
@@ -26,7 +26,6 @@
namespace OC\Core\Command\Background;
class WebCron extends Base {
-
protected function getMode() {
return 'webcron';
}
diff --git a/core/Command/Broadcast/Test.php b/core/Command/Broadcast/Test.php
index 08fcd1f0d92..93734369ace 100644
--- a/core/Command/Broadcast/Test.php
+++ b/core/Command/Broadcast/Test.php
@@ -98,5 +98,4 @@ class Test extends Command {
return 0;
}
-
}
diff --git a/core/Command/Config/Import.php b/core/Command/Config/Import.php
index a6e57e92052..7918ef620ab 100644
--- a/core/Command/Config/Import.php
+++ b/core/Command/Config/Import.php
@@ -33,7 +33,7 @@ use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-class Import extends Command implements CompletionAwareInterface {
+class Import extends Command implements CompletionAwareInterface {
protected $validRootKeys = ['system', 'apps'];
/** @var IConfig */
diff --git a/core/Command/Config/System/DeleteConfig.php b/core/Command/Config/System/DeleteConfig.php
index 85531c4c4bf..9ddad641e38 100644
--- a/core/Command/Config/System/DeleteConfig.php
+++ b/core/Command/Config/System/DeleteConfig.php
@@ -75,8 +75,7 @@ class DeleteConfig extends Base {
try {
$value = $this->removeSubValue(array_slice($configNames, 1), $value, $input->hasParameterOption('--error-if-not-exists'));
- }
- catch (\UnexpectedValueException $e) {
+ } catch (\UnexpectedValueException $e) {
$output->writeln('<error>System config ' . implode(' => ', $configNames) . ' could not be deleted because it did not exist</error>');
return 1;
}
diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php
index 4672770c6af..5794b95b76f 100644
--- a/core/Command/Db/AddMissingColumns.php
+++ b/core/Command/Db/AddMissingColumns.php
@@ -78,7 +78,6 @@ class AddMissingColumns extends Command {
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
private function addCoreColumns(OutputInterface $output) {
-
$output->writeln('<info>Check columns of the comments table.</info>');
$schema = new SchemaWrapper($this->connection);
diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php
index 924c2af05c0..506fef94a63 100644
--- a/core/Command/Db/AddMissingIndices.php
+++ b/core/Command/Db/AddMissingIndices.php
@@ -83,7 +83,6 @@ class AddMissingIndices extends Command {
* @throws \Doctrine\DBAL\Schema\SchemaException
*/
private function addCoreIndexes(OutputInterface $output) {
-
$output->writeln('<info>Check indices of the share table.</info>');
$schema = new SchemaWrapper($this->connection);
diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php
index 16971e20b6c..4a833fbbede 100644
--- a/core/Command/Db/ConvertFilecacheBigInt.php
+++ b/core/Command/Db/ConvertFilecacheBigInt.php
@@ -72,7 +72,6 @@ class ConvertFilecacheBigInt extends Command {
}
protected function execute(InputInterface $input, OutputInterface $output) {
-
$schema = new SchemaWrapper($this->connection);
$isSqlite = $this->connection->getDatabasePlatform() instanceof SqlitePlatform;
$updates = [];
diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php
index c79ece79915..2929fea3764 100644
--- a/core/Command/Db/ConvertType.php
+++ b/core/Command/Db/ConvertType.php
@@ -239,7 +239,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
$schemaManager = new \OC\DB\MDB2SchemaManager($toDB);
$apps = $input->getOption('all-apps') ? \OC_App::getAllApps() : \OC_App::getEnabledApps();
- foreach($apps as $app) {
+ foreach ($apps as $app) {
if (file_exists(\OC_App::getAppPath($app).'/appinfo/database.xml')) {
$schemaManager->createDbFromStructure(\OC_App::getAppPath($app).'/appinfo/database.xml');
} else {
@@ -275,7 +275,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
if (!empty($toTables)) {
$output->writeln('<info>Clearing schema in new database</info>');
}
- foreach($toTables as $table) {
+ foreach ($toTables as $table) {
$db->getSchemaManager()->dropTable($table);
}
}
@@ -403,7 +403,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
try {
// copy table rows
- foreach($tables as $table) {
+ foreach ($tables as $table) {
$output->writeln($table);
$this->copyTable($fromDB, $toDB, $schema->getTable($table), $input, $output);
}
@@ -413,7 +413,7 @@ class ConvertType extends Command implements CompletionAwareInterface {
}
// save new database config
$this->saveDBInfo($input);
- } catch(\Exception $e) {
+ } catch (\Exception $e) {
$this->config->setSystemValue('maintenance', false);
throw $e;
}
diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php
index 0f2709646ba..149ca8904b7 100644
--- a/core/Command/Db/Migrations/ExecuteCommand.php
+++ b/core/Command/Db/Migrations/ExecuteCommand.php
@@ -127,5 +127,4 @@ class ExecuteCommand extends Command implements CompletionAwareInterface {
return [];
}
-
}
diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php
index a40cd800dff..6d554a57858 100644
--- a/core/Command/Db/Migrations/GenerateCommand.php
+++ b/core/Command/Db/Migrations/GenerateCommand.php
@@ -38,7 +38,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class GenerateCommand extends Command implements CompletionAwareInterface {
-
protected static $_templateSimple =
'<?php
diff --git a/core/Command/Db/Migrations/MigrateCommand.php b/core/Command/Db/Migrations/MigrateCommand.php
index c9ba604ae7e..2b0fe268369 100644
--- a/core/Command/Db/Migrations/MigrateCommand.php
+++ b/core/Command/Db/Migrations/MigrateCommand.php
@@ -95,5 +95,4 @@ class MigrateCommand extends Command implements CompletionAwareInterface {
return [];
}
-
}
diff --git a/core/Command/Db/Migrations/StatusCommand.php b/core/Command/Db/Migrations/StatusCommand.php
index 6f19ef03bd6..b9aa918ebbf 100644
--- a/core/Command/Db/Migrations/StatusCommand.php
+++ b/core/Command/Db/Migrations/StatusCommand.php
@@ -97,7 +97,6 @@ class StatusCommand extends Command implements CompletionAwareInterface {
* @return array associative array of human readable info name as key and the actual information as value
*/
public function getMigrationsInfos(MigrationService $ms) {
-
$executedMigrations = $ms->getMigratedVersions();
$availableMigrations = $ms->getAvailableVersions();
$executedUnavailableMigrations = array_diff($executedMigrations, array_keys($availableMigrations));
@@ -145,6 +144,4 @@ class StatusCommand extends Command implements CompletionAwareInterface {
return $migration;
}
-
-
}
diff --git a/core/Command/Encryption/ChangeKeyStorageRoot.php b/core/Command/Encryption/ChangeKeyStorageRoot.php
index 05626715781..bdc2857dd18 100644
--- a/core/Command/Encryption/ChangeKeyStorageRoot.php
+++ b/core/Command/Encryption/ChangeKeyStorageRoot.php
@@ -116,7 +116,6 @@ class ChangeKeyStorageRoot extends Command {
* @throws \Exception
*/
protected function moveAllKeys($oldRoot, $newRoot, OutputInterface $output) {
-
$output->writeln("Start to move keys:");
if ($this->rootView->is_dir($oldRoot) === false) {
@@ -150,7 +149,6 @@ class ChangeKeyStorageRoot extends Command {
if (!$result) {
throw new \Exception("Can't access the new root folder. Please check the permissions and make sure that the folder is in your data folder");
}
-
}
@@ -189,12 +187,11 @@ class ChangeKeyStorageRoot extends Command {
* @param OutputInterface $output
*/
protected function moveUserKeys($oldRoot, $newRoot, OutputInterface $output) {
-
$progress = new ProgressBar($output);
$progress->start();
- foreach($this->userManager->getBackends() as $backend) {
+ foreach ($this->userManager->getBackends() as $backend) {
$limit = 500;
$offset = 0;
do {
@@ -205,7 +202,7 @@ class ChangeKeyStorageRoot extends Command {
$this->moveUserEncryptionFolder($user, $oldRoot, $newRoot);
}
$offset += $limit;
- } while(count($users) >= $limit);
+ } while (count($users) >= $limit);
}
$progress->finish();
}
@@ -219,9 +216,7 @@ class ChangeKeyStorageRoot extends Command {
* @throws \Exception
*/
protected function moveUserEncryptionFolder($user, $oldRoot, $newRoot) {
-
if ($this->userManager->userExists($user)) {
-
$source = $oldRoot . '/' . $user . '/files_encryption';
$target = $newRoot . '/' . $user . '/files_encryption';
if (
@@ -268,5 +263,4 @@ class ChangeKeyStorageRoot extends Command {
return false;
}
-
}
diff --git a/core/Command/Encryption/DecryptAll.php b/core/Command/Encryption/DecryptAll.php
index af1aa4c792c..e631f97cdaa 100644
--- a/core/Command/Encryption/DecryptAll.php
+++ b/core/Command/Encryption/DecryptAll.php
@@ -192,6 +192,5 @@ class DecryptAll extends Command {
$this->resetMaintenanceAndTrashbin();
throw $e;
}
-
}
}
diff --git a/core/Command/Encryption/EncryptAll.php b/core/Command/Encryption/EncryptAll.php
index 77c2cb31204..7c6cad41a37 100644
--- a/core/Command/Encryption/EncryptAll.php
+++ b/core/Command/Encryption/EncryptAll.php
@@ -142,5 +142,4 @@ class EncryptAll extends Command {
$output->writeln('aborted');
}
}
-
}
diff --git a/core/Command/Encryption/ShowKeyStorageRoot.php b/core/Command/Encryption/ShowKeyStorageRoot.php
index a1ab9c2915c..c877d1fcdd3 100644
--- a/core/Command/Encryption/ShowKeyStorageRoot.php
+++ b/core/Command/Encryption/ShowKeyStorageRoot.php
@@ -27,7 +27,7 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
-class ShowKeyStorageRoot extends Command{
+class ShowKeyStorageRoot extends Command {
/** @var Util */
protected $util;
@@ -54,5 +54,4 @@ class ShowKeyStorageRoot extends Command{
$output->writeln("Current key storage root: <info>$rootDescription</info>");
}
-
}
diff --git a/core/Command/Integrity/CheckApp.php b/core/Command/Integrity/CheckApp.php
index d62c13deffb..affe137c67d 100644
--- a/core/Command/Integrity/CheckApp.php
+++ b/core/Command/Integrity/CheckApp.php
@@ -70,9 +70,8 @@ class CheckApp extends Base {
$path = (string)$input->getOption('path');
$result = $this->checker->verifyAppSignature($appid, $path);
$this->writeArrayInOutputFormat($input, $output, $result);
- if (count($result)>0){
+ if (count($result)>0) {
return 1;
}
}
-
}
diff --git a/core/Command/Integrity/CheckCore.php b/core/Command/Integrity/CheckCore.php
index bebfbea560e..665e0079b44 100644
--- a/core/Command/Integrity/CheckCore.php
+++ b/core/Command/Integrity/CheckCore.php
@@ -61,7 +61,7 @@ class CheckCore extends Base {
protected function execute(InputInterface $input, OutputInterface $output) {
$result = $this->checker->verifyCoreSignature();
$this->writeArrayInOutputFormat($input, $output, $result);
- if (count($result)>0){
+ if (count($result)>0) {
return 1;
}
}
diff --git a/core/Command/Integrity/SignApp.php b/core/Command/Integrity/SignApp.php
index 6e750d4af10..7657c2975af 100644
--- a/core/Command/Integrity/SignApp.php
+++ b/core/Command/Integrity/SignApp.php
@@ -76,7 +76,7 @@ class SignApp extends Command {
$path = $input->getOption('path');
$privateKeyPath = $input->getOption('privateKey');
$keyBundlePath = $input->getOption('certificate');
- if(is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
+ if (is_null($path) || is_null($privateKeyPath) || is_null($keyBundlePath)) {
$documentationUrl = $this->urlGenerator->linkToDocs('developer-code-integrity');
$output->writeln('This command requires the --path, --privateKey and --certificate.');
$output->writeln('Example: ./occ integrity:sign-app --path="/Users/lukasreschke/Programming/myapp/" --privateKey="/Users/lukasreschke/private/myapp.key" --certificate="/Users/lukasreschke/public/mycert.crt"');
@@ -87,12 +87,12 @@ class SignApp extends Command {
$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
$keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
- if($privateKey === false) {
+ if ($privateKey === false) {
$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
return null;
}
- if($keyBundle === false) {
+ if ($keyBundle === false) {
$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
return null;
}
@@ -105,7 +105,7 @@ class SignApp extends Command {
try {
$this->checker->writeAppSignature($path, $x509, $rsa);
$output->writeln('Successfully signed "'.$path.'"');
- } catch (\Exception $e){
+ } catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage());
return 1;
}
diff --git a/core/Command/Integrity/SignCore.php b/core/Command/Integrity/SignCore.php
index b825a942d80..7f871b08298 100644
--- a/core/Command/Integrity/SignCore.php
+++ b/core/Command/Integrity/SignCore.php
@@ -70,7 +70,7 @@ class SignCore extends Command {
$privateKeyPath = $input->getOption('privateKey');
$keyBundlePath = $input->getOption('certificate');
$path = $input->getOption('path');
- if(is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
+ if (is_null($privateKeyPath) || is_null($keyBundlePath) || is_null($path)) {
$output->writeln('--privateKey, --certificate and --path are required.');
return null;
}
@@ -78,12 +78,12 @@ class SignCore extends Command {
$privateKey = $this->fileAccessHelper->file_get_contents($privateKeyPath);
$keyBundle = $this->fileAccessHelper->file_get_contents($keyBundlePath);
- if($privateKey === false) {
+ if ($privateKey === false) {
$output->writeln(sprintf('Private key "%s" does not exists.', $privateKeyPath));
return null;
}
- if($keyBundle === false) {
+ if ($keyBundle === false) {
$output->writeln(sprintf('Certificate "%s" does not exists.', $keyBundlePath));
return null;
}
@@ -97,7 +97,7 @@ class SignCore extends Command {
try {
$this->checker->writeCoreSignature($x509, $rsa, $path);
$output->writeln('Successfully signed "core"');
- } catch (\Exception $e){
+ } catch (\Exception $e) {
$output->writeln('Error: ' . $e->getMessage());
return 1;
}
diff --git a/core/Command/InterruptedException.php b/core/Command/InterruptedException.php
index 3ca2f1572a0..509656f2dae 100644
--- a/core/Command/InterruptedException.php
+++ b/core/Command/InterruptedException.php
@@ -26,4 +26,5 @@ namespace OC\Core\Command;
/**
* Exception for when the user hit ctrl-c
*/
-class InterruptedException extends \Exception {}
+class InterruptedException extends \Exception {
+}
diff --git a/core/Command/L10n/CreateJs.php b/core/Command/L10n/CreateJs.php
index fd337994e86..05d58ec231d 100644
--- a/core/Command/L10n/CreateJs.php
+++ b/core/Command/L10n/CreateJs.php
@@ -36,7 +36,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use UnexpectedValueException;
class CreateJs extends Command implements CompletionAwareInterface {
-
protected function configure() {
$this
->setName('l10n:createjs')
@@ -67,7 +66,7 @@ class CreateJs extends Command implements CompletionAwareInterface {
$languages= $this->getAllLanguages($path);
}
- foreach($languages as $lang) {
+ foreach ($languages as $lang) {
$this->writeFiles($app, $path, $lang, $output);
}
}
@@ -75,13 +74,13 @@ class CreateJs extends Command implements CompletionAwareInterface {
private function getAllLanguages($path) {
$result = [];
foreach (new DirectoryIterator("$path/l10n") as $fileInfo) {
- if($fileInfo->isDot()) {
+ if ($fileInfo->isDot()) {
continue;
}
- if($fileInfo->isDir()) {
+ if ($fileInfo->isDir()) {
continue;
}
- if($fileInfo->getExtension() !== 'php') {
+ if ($fileInfo->getExtension() !== 'php') {
continue;
}
$result[]= substr($fileInfo->getBasename(), 0, -4);
diff --git a/core/Command/Log/Manage.php b/core/Command/Log/Manage.php
index 062bc866cc9..2d7eaf9e2e6 100644
--- a/core/Command/Log/Manage.php
+++ b/core/Command/Log/Manage.php
@@ -36,7 +36,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class Manage extends Command implements CompletionAwareInterface {
-
const DEFAULT_BACKEND = 'file';
const DEFAULT_LOG_LEVEL = 2;
const DEFAULT_TIMEZONE = 'UTC';
diff --git a/core/Command/Maintenance/Install.php b/core/Command/Maintenance/Install.php
index fa18ef721b2..b7557b55e81 100644
--- a/core/Command/Maintenance/Install.php
+++ b/core/Command/Maintenance/Install.php
@@ -92,7 +92,7 @@ class Install extends Command {
$this->printErrors($output, $errors);
// ignore the OS X setup warning
- if(count($errors) !== 1 ||
+ if (count($errors) !== 1 ||
(string)$errors[0]['error'] !== 'Mac OS X is not supported and Nextcloud will not work properly on this platform. Use it at your own risk! ') {
return 1;
}
diff --git a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php
index 249b899173e..01bac261cd4 100644
--- a/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php
+++ b/core/Command/Maintenance/Mimetype/GenerateMimetypeFileBuilder.php
@@ -27,8 +27,7 @@ declare(strict_types=1);
namespace OC\Core\Command\Maintenance\Mimetype;
-class GenerateMimetypeFileBuilder
-{
+class GenerateMimetypeFileBuilder {
/**
* Generate mime type list file
* @param $aliases
@@ -39,7 +38,7 @@ class GenerateMimetypeFileBuilder
$keys = array_filter(array_keys($aliases), function ($k) {
return $k[0] === '_';
});
- foreach($keys as $key) {
+ foreach ($keys as $key) {
unset($aliases[$key]);
}
@@ -47,7 +46,7 @@ class GenerateMimetypeFileBuilder
$dir = new \DirectoryIterator(\OC::$SERVERROOT.'/core/img/filetypes');
$files = [];
- foreach($dir as $fileInfo) {
+ foreach ($dir as $fileInfo) {
if ($fileInfo->isFile()) {
$file = preg_replace('/.[^.]*$/', '', $fileInfo->getFilename());
$files[] = $file;
@@ -61,7 +60,7 @@ class GenerateMimetypeFileBuilder
// Fetch all themes!
$themes = [];
$dirs = new \DirectoryIterator(\OC::$SERVERROOT.'/themes/');
- foreach($dirs as $dir) {
+ foreach ($dirs as $dir) {
//Valid theme dir
if ($dir->isFile() || $dir->isDot()) {
continue;
@@ -105,5 +104,4 @@ OC.MimeTypeList={
};
';
}
-
}
diff --git a/core/Command/Maintenance/Mimetype/UpdateDB.php b/core/Command/Maintenance/Mimetype/UpdateDB.php
index 5bb78d9a3f3..47b0b600777 100644
--- a/core/Command/Maintenance/Mimetype/UpdateDB.php
+++ b/core/Command/Maintenance/Mimetype/UpdateDB.php
@@ -32,7 +32,6 @@ use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class UpdateDB extends Command {
-
const DEFAULT_MIMETYPE = 'application/octet-stream';
/** @var IMimeTypeDetector */
diff --git a/core/Command/Maintenance/UpdateHtaccess.php b/core/Command/Maintenance/UpdateHtaccess.php
index 6397ed7aec4..7f143536bfa 100644
--- a/core/Command/Maintenance/UpdateHtaccess.php
+++ b/core/Command/Maintenance/UpdateHtaccess.php
@@ -30,7 +30,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class UpdateHtaccess extends Command {
-
protected function configure() {
$this
->setName('maintenance:update:htaccess')
diff --git a/core/Command/TwoFactorAuth/Cleanup.php b/core/Command/TwoFactorAuth/Cleanup.php
index a8576b15384..ac9dceef343 100644
--- a/core/Command/TwoFactorAuth/Cleanup.php
+++ b/core/Command/TwoFactorAuth/Cleanup.php
@@ -57,5 +57,4 @@ class Cleanup extends Base {
$output->writeln("<info>All user-provider associations for provider <options=bold>$providerId</> have been removed.</info>");
}
-
}
diff --git a/core/Command/TwoFactorAuth/Disable.php b/core/Command/TwoFactorAuth/Disable.php
index 1dd3a2cf64d..128699a3970 100644
--- a/core/Command/TwoFactorAuth/Disable.php
+++ b/core/Command/TwoFactorAuth/Disable.php
@@ -68,5 +68,4 @@ class Disable extends Base {
return 2;
}
}
-
}
diff --git a/core/Command/TwoFactorAuth/Enable.php b/core/Command/TwoFactorAuth/Enable.php
index 0c2aef540e9..d979768f182 100644
--- a/core/Command/TwoFactorAuth/Enable.php
+++ b/core/Command/TwoFactorAuth/Enable.php
@@ -68,5 +68,4 @@ class Enable extends Base {
return 2;
}
}
-
}
diff --git a/core/Command/TwoFactorAuth/Enforce.php b/core/Command/TwoFactorAuth/Enforce.php
index e99c584384c..7f3ceb9694c 100644
--- a/core/Command/TwoFactorAuth/Enforce.php
+++ b/core/Command/TwoFactorAuth/Enforce.php
@@ -112,5 +112,4 @@ class Enforce extends Command {
protected function writeNotEnforced(OutputInterface $output) {
$output->writeln('Two-factor authentication is not enforced');
}
-
}
diff --git a/core/Command/TwoFactorAuth/State.php b/core/Command/TwoFactorAuth/State.php
index 3ae1884d343..438a272223f 100644
--- a/core/Command/TwoFactorAuth/State.php
+++ b/core/Command/TwoFactorAuth/State.php
@@ -104,5 +104,4 @@ class State extends Base {
$output->writeln("- " . $provider);
}
}
-
}
diff --git a/core/Command/Upgrade.php b/core/Command/Upgrade.php
index 761a6fb55c0..461884fabe4 100644
--- a/core/Command/Upgrade.php
+++ b/core/Command/Upgrade.php
@@ -47,7 +47,6 @@ use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\EventDispatcher\GenericEvent;
class Upgrade extends Command {
-
const ERROR_SUCCESS = 0;
const ERROR_NOT_INSTALLED = 1;
const ERROR_MAINTENANCE_MODE = 2;
@@ -86,8 +85,7 @@ class Upgrade extends Command {
* @param OutputInterface $output output interface
*/
protected function execute(InputInterface $input, OutputInterface $output) {
-
- if(Util::needUpgrade()) {
+ if (Util::needUpgrade()) {
if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
// Prepend each line with a little timestamp
$timestampFormatter = new TimestampFormatter($this->config, $output->getFormatter());
@@ -153,12 +151,12 @@ class Upgrade extends Command {
$output->writeln('');
break;
case '\OC\Repair::step':
- if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
+ if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
$output->writeln('<info>Repair step: ' . $event->getArgument(0) . '</info>');
}
break;
case '\OC\Repair::info':
- if(OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
+ if (OutputInterface::VERBOSITY_NORMAL < $output->getVerbosity()) {
$output->writeln('<info>Repair info: ' . $event->getArgument(0) . '</info>');
}
break;
@@ -259,12 +257,12 @@ class Upgrade extends Command {
$this->postUpgradeCheck($input, $output);
- if(!$success) {
+ if (!$success) {
return self::ERROR_FAILURE;
}
return self::ERROR_SUCCESS;
- } elseif($this->config->getSystemValueBool('maintenance')) {
+ } elseif ($this->config->getSystemValueBool('maintenance')) {
//Possible scenario: Nextcloud core is updated but an app failed
$output->writeln('<warning>Nextcloud is in maintenance mode</warning>');
$output->write('<comment>Maybe an upgrade is already in process. Please check the '
diff --git a/core/Command/User/Add.php b/core/Command/User/Add.php
index 208fb1dceb5..2fe4de83f60 100644
--- a/core/Command/User/Add.php
+++ b/core/Command/User/Add.php
@@ -154,11 +154,11 @@ class Add extends Command {
if (!$group) {
$this->groupManager->createGroup($groupName);
$group = $this->groupManager->get($groupName);
- if($group instanceof IGroup) {
+ if ($group instanceof IGroup) {
$output->writeln('Created group "' . $group->getGID() . '"');
}
}
- if($group instanceof IGroup) {
+ if ($group instanceof IGroup) {
$group->addUser($user);
$output->writeln('User "' . $user->getUID() . '" added to group "' . $group->getGID() . '"');
}
diff --git a/core/Command/User/LastSeen.php b/core/Command/User/LastSeen.php
index 37cad457015..5a1e5f3b4e5 100644
--- a/core/Command/User/LastSeen.php
+++ b/core/Command/User/LastSeen.php
@@ -57,13 +57,13 @@ class LastSeen extends Command {
protected function execute(InputInterface $input, OutputInterface $output) {
$user = $this->userManager->get($input->getArgument('uid'));
- if(is_null($user)) {
+ if (is_null($user)) {
$output->writeln('<error>User does not exist</error>');
return;
}
$lastLogin = $user->getLastLogin();
- if($lastLogin === 0) {
+ if ($lastLogin === 0) {
$output->writeln('User ' . $user->getUID() .
' has never logged in, yet.');
} else {
diff --git a/core/Command/User/Report.php b/core/Command/User/Report.php
index 7f4562fc426..fff3924d324 100644
--- a/core/Command/User/Report.php
+++ b/core/Command/User/Report.php
@@ -55,10 +55,10 @@ class Report extends Command {
$table = new Table($output);
$table->setHeaders(['User Report', '']);
$userCountArray = $this->countUsers();
- if(!empty($userCountArray)) {
+ if (!empty($userCountArray)) {
$total = 0;
$rows = [];
- foreach($userCountArray as $classname => $users) {
+ foreach ($userCountArray as $classname => $users) {
$total += $users;
$rows[] = [$classname, $users];
}
diff --git a/core/Command/User/Setting.php b/core/Command/User/Setting.php
index e084b94cc8a..71509d4eb6e 100644
--- a/core/Command/User/Setting.php
+++ b/core/Command/User/Setting.php
@@ -187,7 +187,6 @@ class Setting extends Base {
$this->config->setUserValue($uid, $app, $key, $input->getArgument('value'));
return 0;
-
} elseif ($input->hasParameterOption('--delete')) {
if ($input->hasParameterOption('--error-if-not-exists') && $value === null) {
$output->writeln('<error>The setting does not exist for user "' . $uid . '".</error>');
@@ -204,7 +203,6 @@ class Setting extends Base {
$this->config->deleteUserValue($uid, $app, $key);
return 0;
-
} elseif ($value !== null) {
$output->writeln($value);
return 0;