From 7f18d059ddfe50c7de9d933710412c4e56c684da Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 27 May 2019 13:55:40 +0200 Subject: [PATCH] allow to call PSR-4 admin-cmds classes with admin-cli.php --- admin/admin-cli.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/admin/admin-cli.php b/admin/admin-cli.php index 37e7e0a5f3..59e704d782 100755 --- a/admin/admin-cli.php +++ b/admin/admin-cli.php @@ -85,7 +85,9 @@ switch($action) default: // we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE - if (substr($action,0,2) == '--' && class_exists($class = str_replace('-','_',substr($action,2))) && + if (substr($action,0,2) == '--' && (class_exists($class = str_replace('-','_',substr($action, 2))) || + class_exists($class = preg_replace('/^--([a-z0-9_]+)-([a-z0-9_]+)$/i', 'EGroupware\\$1\\$2', $action)) || + class_exists($class = preg_replace('/^--([a-z0-9_]+)-([a-z0-9_]+)$/i', 'EGroupware\\$1\\AdminCmds\\$2', $action))) && is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE')) { $args = array(); @@ -100,7 +102,14 @@ switch($action) if (substr($name,-1) == ']') // allow 1-dim. arrays { list($name,$sub) = explode('[',substr($name,0,-1),2); - $args[$name][$sub] = $value; + if (empty($sub)) + { + $args[$name][] = $value; + } + else + { + $args[$name][$sub] = $value; + } } else {