rename database

This commit is contained in:
Fred Tempez 2023-03-10 15:21:53 +01:00
parent ead284fff7
commit 6e9f30719b

View File

@ -29,12 +29,22 @@ if (file_exists('site/data/core.json')) {
// Renomme les bases de données
if ($version['core']['dataVersion'] < 12400) {
if (file_exists('core/module/install/ressource/i18n/languages.json'))
rename('core/module/install/ressource/i18n/languages.json', 'core/module/install/ressource/i18n/language.json');
if (file_exists('site/data/languages.json'))
rename('site/data/languages.json', 'site/data/language.json');
if (file_exists('site/data/fonts.json'))
rename('site/data/fonts.json', 'site/data/font.json');
// Renommage les fichiers de données au pluriel
$t = [
'core/module/install/ressource/i18n/languages.json' => 'core/module/install/ressource/i18n/language.json',
'site/data/languages.json' => 'site/data/language.json',
'site/data/fonts.json' => 'site/data/font.json'
];
foreach ($d as $k => $v) {
if (file_exists($k)) {
rename($k, $v);
$d = file_get_contents($v);
$d = str_replace(basename($k,'.json'), basename($v, '.json'));
file_put_contents($v);
}
}
}
}