2023-02-10 09:58:55 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2023-02-12 17:52:18 +01:00
|
|
|
* Mise à jour avant v12
|
2023-02-10 09:58:55 +01:00
|
|
|
* */
|
2023-02-18 08:41:01 +01:00
|
|
|
|
|
|
|
if (file_exists('site/data/core.json')) {
|
2023-07-29 17:18:33 +02:00
|
|
|
$core = json_decode(file_get_contents('site/data/core.json'), true);
|
|
|
|
$version = $core['core']['dataVersion'];
|
|
|
|
// Avant version 12.0.00
|
2023-07-18 00:16:39 +02:00
|
|
|
if (
|
2023-07-29 17:18:33 +02:00
|
|
|
$version < 12000
|
2023-07-18 00:16:39 +02:00
|
|
|
) {
|
2023-02-18 08:41:01 +01:00
|
|
|
// Correspondance pour les dossiers de langue à convertir
|
|
|
|
$languages = [
|
|
|
|
'fr' => 'fr_FR',
|
|
|
|
'en' => 'en_EN',
|
|
|
|
'pt' => 'pt_PT'
|
|
|
|
];
|
|
|
|
// Convertit les dossiers vers la nouvelle structure
|
|
|
|
foreach ($languages as $key => $value) {
|
|
|
|
if (
|
|
|
|
is_dir('site/data/' . $key) &&
|
|
|
|
!is_dir('site/data/' . $value)
|
|
|
|
) {
|
|
|
|
$end = rename('site/data/' . $key, 'site/data/' . $value);
|
|
|
|
}
|
2023-02-10 09:58:55 +01:00
|
|
|
}
|
2023-07-29 17:18:33 +02:00
|
|
|
|
2023-03-02 15:22:55 +01:00
|
|
|
sleep(1);
|
2023-02-10 09:58:55 +01:00
|
|
|
}
|
2023-03-02 15:22:55 +01:00
|
|
|
|
2023-03-05 16:28:44 +01:00
|
|
|
// Renomme les bases de données
|
2023-07-18 00:16:39 +02:00
|
|
|
if (
|
2023-07-29 17:18:33 +02:00
|
|
|
$version < 12400
|
2023-07-18 00:16:39 +02:00
|
|
|
) {
|
2023-03-10 15:21:53 +01:00
|
|
|
// Renommage les fichiers de données au pluriel
|
|
|
|
$t = [
|
|
|
|
'site/data/languages.json' => 'site/data/language.json',
|
|
|
|
'site/data/fonts.json' => 'site/data/font.json'
|
|
|
|
];
|
2023-03-10 15:49:14 +01:00
|
|
|
foreach ($t as $k => $v) {
|
2023-03-10 15:21:53 +01:00
|
|
|
if (file_exists($k)) {
|
2023-03-10 15:49:14 +01:00
|
|
|
$d = file_get_contents($k);
|
2023-09-08 20:49:11 +02:00
|
|
|
$d = str_replace('"' . basename($k, '.json') . '"' , '"' . basename($v, '.json') . '"', $d);
|
2023-03-10 15:49:14 +01:00
|
|
|
file_put_contents($v, $d);
|
2023-03-10 15:52:09 +01:00
|
|
|
unlink($k);
|
2023-03-10 15:21:53 +01:00
|
|
|
}
|
|
|
|
}
|
2023-03-01 15:50:41 +01:00
|
|
|
}
|
|
|
|
|
2023-02-10 09:58:55 +01:00
|
|
|
}
|