mirror of
https://github.com/friendica/friendica
synced 2025-04-25 11:10:11 +00:00
Hardening ConfigUpgrade
This commit is contained in:
parent
1c2a77c47f
commit
e0b1f4f251
5 changed files with 126 additions and 57 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue