Hardening ConfigUpgrade

This commit is contained in:
Philipp Holzer 2019-03-30 18:54:22 +01:00
parent 1c2a77c47f
commit e0b1f4f251
No known key found for this signature in database
GPG key ID: 517BE60E2CE5C8A5
5 changed files with 126 additions and 57 deletions

View file

@ -188,4 +188,32 @@ class ConfigCache implements IConfigCache, IPConfigCache
{
return $this->config;
}
/**
* Returns an array with missing categories/Keys
*
* @param array $config The array to check
*
* @return array
*/
public function keyDiff(array $config)
{
$return = [];
$categories = array_keys($config);
foreach ($categories as $category) {
if (is_array($config[$category])) {
$keys = array_keys($config[$category]);
foreach ($keys as $key) {
if (!isset($this->config[$category][$key])) {
$return[$category][$key] = $config[$category][$key];
}
}
}
}
return $return;
}
}