diff options
author | Joas Schilling <coding@schilljs.com> | 2020-06-26 14:54:51 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-06-26 14:54:51 +0200 |
commit | ab21d69903c4360cbce59741624b6e765e3bd35f (patch) | |
tree | 8bed2d6af0d4bfef3766e356acc570b93eb9feb3 /core/Command/Db | |
parent | ed4afa55c1ccaef140ac310258ad837bf6af9557 (diff) | |
download | nextcloud-server-ab21d69903c4360cbce59741624b6e765e3bd35f.tar.gz nextcloud-server-ab21d69903c4360cbce59741624b6e765e3bd35f.zip |
Add return value to all commands
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Command/Db')
-rw-r--r-- | core/Command/Db/AddMissingColumns.php | 3 | ||||
-rw-r--r-- | core/Command/Db/AddMissingIndices.php | 3 | ||||
-rw-r--r-- | core/Command/Db/ConvertFilecacheBigInt.php | 2 | ||||
-rw-r--r-- | core/Command/Db/ConvertMysqlToMB4.php | 2 | ||||
-rw-r--r-- | core/Command/Db/ConvertType.php | 5 | ||||
-rw-r--r-- | core/Command/Db/Migrations/ExecuteCommand.php | 2 | ||||
-rw-r--r-- | core/Command/Db/Migrations/GenerateCommand.php | 2 | ||||
-rw-r--r-- | core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php | 2 | ||||
-rw-r--r-- | core/Command/Db/Migrations/MigrateCommand.php | 3 | ||||
-rw-r--r-- | core/Command/Db/Migrations/StatusCommand.php | 3 |
10 files changed, 16 insertions, 11 deletions
diff --git a/core/Command/Db/AddMissingColumns.php b/core/Command/Db/AddMissingColumns.php index 5794b95b76f..3ace75b4eef 100644 --- a/core/Command/Db/AddMissingColumns.php +++ b/core/Command/Db/AddMissingColumns.php @@ -63,12 +63,13 @@ class AddMissingColumns extends Command { ->setDescription('Add missing optional columns to the database tables'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->addCoreColumns($output); // Dispatch event so apps can also update columns if needed $event = new GenericEvent($output); $this->dispatcher->dispatch(IDBConnection::ADD_MISSING_COLUMNS_EVENT, $event); + return 0; } /** diff --git a/core/Command/Db/AddMissingIndices.php b/core/Command/Db/AddMissingIndices.php index 2784721f55f..6f41d9dce23 100644 --- a/core/Command/Db/AddMissingIndices.php +++ b/core/Command/Db/AddMissingIndices.php @@ -69,12 +69,13 @@ class AddMissingIndices extends Command { ->setDescription('Add missing indices to the database tables'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->addCoreIndexes($output); // Dispatch event so apps can also update indexes if needed $event = new GenericEvent($output); $this->dispatcher->dispatch(IDBConnection::ADD_MISSING_INDEXES_EVENT, $event); + return 0; } /** diff --git a/core/Command/Db/ConvertFilecacheBigInt.php b/core/Command/Db/ConvertFilecacheBigInt.php index 4a833fbbede..f65e76ddfc3 100644 --- a/core/Command/Db/ConvertFilecacheBigInt.php +++ b/core/Command/Db/ConvertFilecacheBigInt.php @@ -71,7 +71,7 @@ class ConvertFilecacheBigInt extends Command { ]; } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $schema = new SchemaWrapper($this->connection); $isSqlite = $this->connection->getDatabasePlatform() instanceof SqlitePlatform; $updates = []; diff --git a/core/Command/Db/ConvertMysqlToMB4.php b/core/Command/Db/ConvertMysqlToMB4.php index fd16dd09439..369badf0dfe 100644 --- a/core/Command/Db/ConvertMysqlToMB4.php +++ b/core/Command/Db/ConvertMysqlToMB4.php @@ -68,7 +68,7 @@ class ConvertMysqlToMB4 extends Command { ->setDescription('Convert charset of MySQL/MariaDB to use utf8mb4'); } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { if (!$this->connection->getDatabasePlatform() instanceof MySqlPlatform) { $output->writeln("This command is only valid for MySQL/MariaDB databases."); return 1; diff --git a/core/Command/Db/ConvertType.php b/core/Command/Db/ConvertType.php index c6d4c9e10f2..2c4b7d14de3 100644 --- a/core/Command/Db/ConvertType.php +++ b/core/Command/Db/ConvertType.php @@ -188,7 +188,7 @@ class ConvertType extends Command implements CompletionAwareInterface { } } - protected function execute(InputInterface $input, OutputInterface $output) { + protected function execute(InputInterface $input, OutputInterface $output): int { $this->validateInput($input, $output); $this->readPassword($input, $output); @@ -221,11 +221,12 @@ class ConvertType extends Command implements CompletionAwareInterface { $helper = $this->getHelper('question'); if (!$helper->ask($input, $output, $question)) { - return; + return 1; } } $intersectingTables = array_intersect($toTables, $fromTables); $this->convertDB($fromDB, $toDB, $intersectingTables, $input, $output); + return 0; } protected function createSchema(Connection $fromDB, Connection $toDB, InputInterface $input, OutputInterface $output) { diff --git a/core/Command/Db/Migrations/ExecuteCommand.php b/core/Command/Db/Migrations/ExecuteCommand.php index 149ca8904b7..95f1acd14fe 100644 --- a/core/Command/Db/Migrations/ExecuteCommand.php +++ b/core/Command/Db/Migrations/ExecuteCommand.php @@ -75,7 +75,7 @@ class ExecuteCommand extends Command implements CompletionAwareInterface { * @param OutputInterface $output * @return int */ - public function execute(InputInterface $input, OutputInterface $output) { + public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); $version = $input->getArgument('version'); diff --git a/core/Command/Db/Migrations/GenerateCommand.php b/core/Command/Db/Migrations/GenerateCommand.php index 6d554a57858..754d1f48401 100644 --- a/core/Command/Db/Migrations/GenerateCommand.php +++ b/core/Command/Db/Migrations/GenerateCommand.php @@ -110,7 +110,7 @@ class {{classname}} extends SimpleMigrationStep { parent::configure(); } - public function execute(InputInterface $input, OutputInterface $output) { + public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $version = $input->getArgument('version'); diff --git a/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php b/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php index 4f93b59fe32..71349c0fa51 100644 --- a/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php +++ b/core/Command/Db/Migrations/GenerateFromSchemaFileCommand.php @@ -52,7 +52,7 @@ class GenerateFromSchemaFileCommand extends GenerateCommand { $this->setName('migrations:generate-from-schema'); } - public function execute(InputInterface $input, OutputInterface $output) { + public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $version = $input->getArgument('version'); diff --git a/core/Command/Db/Migrations/MigrateCommand.php b/core/Command/Db/Migrations/MigrateCommand.php index 2b0fe268369..229288c794a 100644 --- a/core/Command/Db/Migrations/MigrateCommand.php +++ b/core/Command/Db/Migrations/MigrateCommand.php @@ -55,12 +55,13 @@ class MigrateCommand extends Command implements CompletionAwareInterface { parent::configure(); } - public function execute(InputInterface $input, OutputInterface $output) { + public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); $version = $input->getArgument('version'); $ms->migrate($version); + return 0; } /** diff --git a/core/Command/Db/Migrations/StatusCommand.php b/core/Command/Db/Migrations/StatusCommand.php index b9aa918ebbf..dc92dfb1f50 100644 --- a/core/Command/Db/Migrations/StatusCommand.php +++ b/core/Command/Db/Migrations/StatusCommand.php @@ -53,7 +53,7 @@ class StatusCommand extends Command implements CompletionAwareInterface { ->addArgument('app', InputArgument::REQUIRED, 'Name of the app this migration command shall work on'); } - public function execute(InputInterface $input, OutputInterface $output) { + public function execute(InputInterface $input, OutputInterface $output): int { $appName = $input->getArgument('app'); $ms = new MigrationService($appName, $this->connection, new ConsoleOutput($output)); @@ -68,6 +68,7 @@ class StatusCommand extends Command implements CompletionAwareInterface { $output->writeln(" <comment>>></comment> $key: " . str_repeat(' ', 50 - strlen($key)) . $value); } } + return 0; } /** |