diff --git a/module/VuFind/src/VuFind/CLI/Controller/AbstractBase.php b/module/VuFind/src/VuFind/CLI/Controller/AbstractBase.php index 4aa60042d4659cd0eac74a07fd35c34af696481b..092ff02f7a69d757f198322e37c9d1c8cf5a480a 100644 --- a/module/VuFind/src/VuFind/CLI/Controller/AbstractBase.php +++ b/module/VuFind/src/VuFind/CLI/Controller/AbstractBase.php @@ -71,4 +71,26 @@ class AbstractBase extends AbstractActionController echo "Without it, inappropriate default settings may be loaded.\n\n"; } } + + /** + * Indicate failure. + * + * @return void + */ + protected function getFailureResponse() + { + // TODO: better framework integration for response codes + exit(1); + } + + /** + * Indicate success. + * + * @return void + */ + protected function getSuccessResponse() + { + // TODO: better framework integration for response codes + exit(0); + } } \ No newline at end of file diff --git a/module/VuFind/src/VuFind/CLI/Controller/ImportController.php b/module/VuFind/src/VuFind/CLI/Controller/ImportController.php index 9dc622c71c45c728c817ffe6b1e70c72c450bed9..bda3aabf2dde34ac77e96c642e06762f7031cb95 100644 --- a/module/VuFind/src/VuFind/CLI/Controller/ImportController.php +++ b/module/VuFind/src/VuFind/CLI/Controller/ImportController.php @@ -72,7 +72,7 @@ class ImportController extends AbstractBase . "SolrAuth to load authority records.\n\n" . "Note: See vudl.properties and ojs.properties for configuration " . "examples.\n"; - exit(1); + return $this->getFailureResponse(); } // Try to import the document if successful: @@ -80,11 +80,11 @@ class ImportController extends AbstractBase Importer::save($argv[0], $argv[1], $index, $testMode); } catch (\Exception $e) { echo "Fatal error: " . $e->getMessage() . "\n"; - exit(1); + return $this->getFailureResponse(); } if (!$testMode) { echo "Successfully imported {$argv[0]}...\n"; } - exit(0); + return $this->getSuccessResponse(); } }