[CONFIG][CORE] Fix bug in overriding default config

This commit is contained in:
Hugo Sales 2021-09-20 15:20:25 +01:00
parent 8bb6285522
commit 91fd7d1cfa
Signed by: someonewithpc
GPG Key ID: 7D0C7EAFC9D835A0
1 changed files with 2 additions and 2 deletions

View File

@ -235,7 +235,7 @@ class GNUsocial implements EventSubscriberInterface
// Overriding doesn't work as we want, overrides the top-most key, do it manually // Overriding doesn't work as we want, overrides the top-most key, do it manually
$local_file = INSTALLDIR . '/social.local.yaml'; $local_file = INSTALLDIR . '/social.local.yaml';
if (!file_exists($local_file)) { if (!file_exists($local_file)) {
file_put_contents($local_file, "parameters:\n locals:\n gnusocial:\n"); file_put_contents($local_file, "parameters:\n locals:\n gnusocial:\n");
} }
// Load .local // Load .local
@ -255,7 +255,7 @@ class GNUsocial implements EventSubscriberInterface
$wrapper = $container->hasParameter($to) ? $container->getParameter($to) : []; $wrapper = $container->hasParameter($to) ? $container->getParameter($to) : [];
$content = [$from => $container->getParameter($from)]; $content = [$from => $container->getParameter($from)];
$container->getParameterBag()->remove($from); $container->getParameterBag()->remove($from);
$locals = isset($locals[$from]) ? [$from => $locals[$from]] : []; $locals = $locals[$from] ?? [];
$configs = array_replace_recursive($wrapper, $content, $locals); $configs = array_replace_recursive($wrapper, $content, $locals);
$container->setParameter($to, $configs); $container->setParameter($to, $configs);
}; };