mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:29 +01:00
allow to call PSR-4 admin-cmds classes with admin-cli.php
This commit is contained in:
parent
950255e554
commit
7f18d059dd
@ -85,7 +85,9 @@ switch($action)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
// we allow to call admin_cmd classes directly, if they define the constant SETUP_CLI_CALLABLE
|
// 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'))
|
is_subclass_of($class,'admin_cmd') && @constant($class.'::SETUP_CLI_CALLABLE'))
|
||||||
{
|
{
|
||||||
$args = array();
|
$args = array();
|
||||||
@ -100,8 +102,15 @@ switch($action)
|
|||||||
if (substr($name,-1) == ']') // allow 1-dim. arrays
|
if (substr($name,-1) == ']') // allow 1-dim. arrays
|
||||||
{
|
{
|
||||||
list($name,$sub) = explode('[',substr($name,0,-1),2);
|
list($name,$sub) = explode('[',substr($name,0,-1),2);
|
||||||
|
if (empty($sub))
|
||||||
|
{
|
||||||
|
$args[$name][] = $value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$args[$name][$sub] = $value;
|
$args[$name][$sub] = $value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$args[$name] = $value;
|
$args[$name] = $value;
|
||||||
|
Loading…
Reference in New Issue
Block a user