Skip to content

Commit

Permalink
Add --halt-on-error option.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunosh committed Nov 3, 2014
1 parent 9e6eaf5 commit ad62090
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions horde/bin/horde-db-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,12 @@ Horde_Registry::appInit('horde', array(
// Parse command line arguments.
$parser = new Horde_Argv_Parser(
array(
'usage' => "%prog\n\t[--config=filename]\n\t[--debug]\n\t[(application|directory) [(up|down|version)]]",
'usage' => "%prog\n\t[--config=filename]\n\t[--debug]\n\t[--halt-on-error]\n\t[(application|directory) [(up|down|version)]]",
'optionList' => array(
new Horde_Argv_Option(
'-c',
'--config',
array(
//'action' => 'store_true',
'help' => 'Path to PEAR configuration file.'
)
),
Expand All @@ -54,6 +53,14 @@ $parser = new Horde_Argv_Parser(
'help' => 'Provide full debugging output.'
)
),
new Horde_Argv_Option(
'-s',
'--halt-on-error',
array(
'action' => 'store_true',
'help' => 'Halt migration immediately on error.'
)
),
)
)
);
Expand Down Expand Up @@ -155,7 +162,11 @@ foreach ($apps as $app) {
}
} catch (Exception $e) {
echo $e->getMessage() . "\n";
continue;
if (empty($options['halt-on-error'])) {
continue;
} else {
exit(1);
}
}

$cli->message("Ending $app schema version: " . $migrator->getCurrentVersion());
Expand Down

0 comments on commit ad62090

Please sign in to comment.