From b7ddb19cfd4f130fe8e46cc05fc14a2ad9ecb47e Mon Sep 17 00:00:00 2001 From: Sebastian Meyer Date: Thu, 4 Jan 2024 05:25:21 +0100 Subject: [PATCH] Fix return values for CLI command --- src/Console/UpdateFormatsCommand.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Console/UpdateFormatsCommand.php b/src/Console/UpdateFormatsCommand.php index 37fb462..50e5332 100644 --- a/src/Console/UpdateFormatsCommand.php +++ b/src/Console/UpdateFormatsCommand.php @@ -51,6 +51,7 @@ class UpdateFormatsCommand extends Command $inDatabase = Database::getInstance()->getMetadataFormats()->getQueryResult(); $added = 0; $deleted = 0; + $failure = false; foreach ($formats as $prefix => $format) { if (in_array($prefix, array_keys($inDatabase), true)) { if ( @@ -70,6 +71,7 @@ class UpdateFormatsCommand extends Command ) ]); } catch (ValidationFailedException $exception) { + $failure = true; $output->writeln([ sprintf( ' [ERROR] Could not add or update metadata format "%s". ', @@ -90,6 +92,7 @@ class UpdateFormatsCommand extends Command ) ]); } else { + $failure = true; $output->writeln([ sprintf( ' [ERROR] Could not delete metadata format "%s". ', @@ -133,6 +136,10 @@ class UpdateFormatsCommand extends Command 1 | 16 ); } - return Command::SUCCESS; + if (!$failure) { + return Command::SUCCESS; + } else { + return Command::FAILURE; + } } }