From 02587c2153403d28ba74beb2548aabbf52f1e292 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sun, 24 May 2009 13:59:03 +0000 Subject: [PATCH] "when directly calling cmd object: - set domain as first argument, to select the right domain in header include - allow to give 1-dimensional arrays on command line (like php does it with urls, eg. 'config[name]=value')" --- setup/setup-cli.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/setup/setup-cli.php b/setup/setup-cli.php index 0da7036f8a..91fa0ade61 100755 --- a/setup/setup-cli.php +++ b/setup/setup-cli.php @@ -6,7 +6,7 @@ * @link http://www.egroupware.org * @package setup * @author Ralf Becker - * @copyright (c) 2006-8 by Ralf Becker + * @copyright (c) 2006-9 by Ralf Becker * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @version $Id$ */ @@ -112,7 +112,8 @@ switch($action) if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && is_subclass_of($class,'admin_cmd') && constant($class.'::SETUP_CLI_CALLABLE')) { - $args = null; + $args = array(); + $args['domain'] = array_shift($arguments); // domain must be first argument, to ensure right domain get's selected in header-include foreach($arguments as $arg) { list($name,$value) = explode('=',$arg,2); @@ -120,7 +121,15 @@ switch($action) { throw new egw_exception_wrong_userinput(lang("Invalid argument '%1' !!!",$arg),90); } - $args[$name] = $value; + if (substr($name,-1) == ']') // allow 1-dim. arrays + { + list($name,$sub) = explode('[',substr($name,0,-1),2); + $args[$name][$sub] = $value; + } + else + { + $args[$name] = $value; + } } $cmd = new $class($args); $msg = $cmd->run();