mirror of
https://github.com/opencultureconsulting/oai-pmh2.git
synced 2025-04-13 00:00:57 +02:00
Fix return values for CLI command
This commit is contained in:
parent
8a6692513f
commit
b7ddb19cfd
@ -51,6 +51,7 @@ class UpdateFormatsCommand extends Command
|
|||||||
$inDatabase = Database::getInstance()->getMetadataFormats()->getQueryResult();
|
$inDatabase = Database::getInstance()->getMetadataFormats()->getQueryResult();
|
||||||
$added = 0;
|
$added = 0;
|
||||||
$deleted = 0;
|
$deleted = 0;
|
||||||
|
$failure = false;
|
||||||
foreach ($formats as $prefix => $format) {
|
foreach ($formats as $prefix => $format) {
|
||||||
if (in_array($prefix, array_keys($inDatabase), true)) {
|
if (in_array($prefix, array_keys($inDatabase), true)) {
|
||||||
if (
|
if (
|
||||||
@ -70,6 +71,7 @@ class UpdateFormatsCommand extends Command
|
|||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
} catch (ValidationFailedException $exception) {
|
} catch (ValidationFailedException $exception) {
|
||||||
|
$failure = true;
|
||||||
$output->writeln([
|
$output->writeln([
|
||||||
sprintf(
|
sprintf(
|
||||||
' [ERROR] Could not add or update metadata format "%s". ',
|
' [ERROR] Could not add or update metadata format "%s". ',
|
||||||
@ -90,6 +92,7 @@ class UpdateFormatsCommand extends Command
|
|||||||
)
|
)
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
|
$failure = true;
|
||||||
$output->writeln([
|
$output->writeln([
|
||||||
sprintf(
|
sprintf(
|
||||||
' [ERROR] Could not delete metadata format "%s". ',
|
' [ERROR] Could not delete metadata format "%s". ',
|
||||||
@ -133,6 +136,10 @@ class UpdateFormatsCommand extends Command
|
|||||||
1 | 16
|
1 | 16
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (!$failure) {
|
||||||
return Command::SUCCESS;
|
return Command::SUCCESS;
|
||||||
|
} else {
|
||||||
|
return Command::FAILURE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user