From d084bd06799dda8911a4cb4df7f4aa0076e4cd1b Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 23 Feb 2019 12:11:30 +0100 Subject: [PATCH] fix --exit-codes did not found (now used) exceptions --- setup/setup-cli.php | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/setup/setup-cli.php b/setup/setup-cli.php index 4629bce7cc..03ca11a97a 100755 --- a/setup/setup-cli.php +++ b/setup/setup-cli.php @@ -6,9 +6,8 @@ * @link http://www.egroupware.org * @package setup * @author Ralf Becker - * @copyright (c) 2006-16 by Ralf Becker + * @copyright (c) 2006-19 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License - * @version $Id$ */ use EGroupware\Api; @@ -117,6 +116,7 @@ switch($action) list_exit_codes(); break; + case '-h': case '--help': case '--usage': do_usage($arguments[0]); @@ -506,23 +506,15 @@ function do_usage($what='') } if (!$what || !in_array($what,array('config','header','list'))) { - echo '--help [config|header|list] '.lang('gives further options')."\n"; + echo '--help|-h [config|header|list] '.lang('gives further options')."\n"; } } -function fail($exit_code,$message) -{ - echo $message."\n"; - exit($exit_code); -} - /** * List all exit codes used by the command line interface * - * The list is generated by "greping" this file for calls to the fail() function. - * Calls to fail() have to be in one line, to be recogniced! - * - * @todo we need to grep for the exceptions too! + * The list is generated by "greping" this file for thrown exceptions. + * Exceptions have to be in one line, to be recogniced! */ function list_exit_codes() { @@ -543,7 +535,7 @@ function list_exit_codes() $content = file_get_contents($setup_dir.'/'.$file); $matches = null; - if (preg_match_all('/throw new (egw_exception[a-z_]*)\((.*),([0-9]+)\);/m',$content,$matches)) + if (preg_match_all('/throw new (Api\\\\Exception[\\\\a-z_]*)\((.*),([0-9]+)\);/mi',$content,$matches)) { //echo $file.":\n"; print_r($matches); foreach($matches[3] as $key => $code)