more work on traffic and npm dependencies update

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-09-12 21:52:32 +02:00
parent 15a1ff2f83
commit ddedce1671
6 changed files with 114 additions and 118 deletions

View File

@@ -208,32 +208,12 @@ class PhpHelper
}
}
public static function loadConfigArrayDir()
public static function loadConfigArrayDir(...$configdirs)
{
// we now use dynamic function parameters
// so we can read from more than one directory
// and still be valid for old calls
$numargs = func_num_args();
if ($numargs <= 0) {
if (count($configdirs) <= 0) {
return null;
}
// variable that holds all dirs that will
// be parsed for inclusion
$configdirs = [];
// if one of the parameters is an array
// we assume that this is a list of
// setting-groups to be selected
$selection = null;
for ($x = 0; $x < $numargs; $x++) {
$arg = func_get_arg($x);
if (is_array($arg) && isset($arg[0])) {
$selection = $arg;
} else {
$configdirs[] = $arg;
}
}
$data = [];
$data_files = [];
$has_data = false;
@@ -257,20 +237,6 @@ class PhpHelper
}
}
// if we have specific setting-groups
// to select, we'll handle this here
// (this is for multiserver-client settings)
$_data = [];
if ($selection != null && is_array($selection) && isset($selection[0])) {
$_data['groups'] = [];
foreach ($data['groups'] as $group => $data) {
if (in_array($group, $selection)) {
$_data['groups'][$group] = $data;
}
}
$data = $_data;
}
return $data;
}