Pas d'update des fichiers de langues non installés

This commit is contained in:
Fred Tempez 2025-02-06 20:01:52 +01:00
parent 5051e6072c
commit d4e118a578

View File

@ -179,7 +179,8 @@ if ($this->getData(['core', 'dataVersion']) < 10300) {
$this->setData(['config', 'searchPageId', '']); $this->setData(['config', 'searchPageId', '']);
// Mettre à jour les données des galeries // Mettre à jour les données des galeries
$hierarchy = array(); foreach ($this->getHierarchy() as $parentKey => $parentValue) { $hierarchy = array();
foreach ($this->getHierarchy() as $parentKey => $parentValue) {
$hierarchy[] = $parentKey; $hierarchy[] = $parentKey;
foreach ($parentValue as $childKey) { foreach ($parentValue as $childKey) {
$hierarchy[] = $childKey; $hierarchy[] = $childKey;
@ -1110,7 +1111,7 @@ if ($this->getData(['core', 'dataVersion']) < 13101) {
// Supprime le choix du thème à l'installation // Supprime le choix du thème à l'installation
if (is_dir('core/module/install/ressource/themes')) { if (is_dir('core/module/install/ressource/themes')) {
$this->deleteDir('core/module/install/ressource/themes') ; $this->deleteDir('core/module/install/ressource/themes');
} }
// Mise à jour // Mise à jour
@ -1120,53 +1121,57 @@ if ($this->getData(['core', 'dataVersion']) < 13101) {
// Version 1.21.00 // Version 1.21.00
if ( if (
$this->getData(['core', 'dataVersion']) < 13600 $this->getData(['core', 'dataVersion']) < 13600
) { ) {
/** /**
* Renomme la clé dans la base des utilisateurs * Renomme la clé dans la base des utilisateurs
*/ */
if ( if (
is_array($this->getData(['user'])) is_array($this->getData(['user']))
&& empty($this->getData(['user'])) === false && empty($this->getData(['user'])) === false
) { ) {
foreach ($this->getData(['user']) as $userId => $userValue) { foreach ($this->getData(['user']) as $userId => $userValue) {
$d = $this->getData(['user', $userId]); $d = $this->getData(['user', $userId]);
if (isset($d['group']) && $d['group'] !== '') { if (isset($d['group']) && $d['group'] !== '') {
$position = array_search('group', array_keys($d)) + 1; $position = array_search('group', array_keys($d)) + 1;
$l = array_merge( $l = array_merge(
array_slice($d, 0, $position), array_slice($d, 0, $position),
['role' => $d['group']], ['role' => $d['group']],
array_slice($d, $position) array_slice($d, $position)
); );
unset($l['group']); unset($l['group']);
$this->setData(['user', $userId, $l], false); $this->setData(['user', $userId, $l], false);
} }
} }
} }
$this->saveDb('user'); $this->saveDb('user');
/** /**
* Convertit les pages et les modules * Convertit les pages et les modules
*/ */
$languages = array_merge($this->getData(['language'])); $languages = array_merge($this->getData(['language']));
foreach ($languages as $languageId => $courseValue) { foreach ($languages as $languageId => $courseValue) {
// Les pages // Les pages
$filePath = self::DATA_DIR . $languageId . '/page.json'; $filePath = self::DATA_DIR . $languageId . '/page.json';
$jsonContent = file_get_contents($filePath); if (file_exists($filePath) === true) {
$updatedJsonContent = str_replace('"group":', '"role":', $jsonContent); $jsonContent = file_get_contents($filePath);
if ($updatedJsonContent !== $jsonContent) { $updatedJsonContent = str_replace('"group":', '"role":', $jsonContent);
file_put_contents($filePath, $updatedJsonContent); if ($updatedJsonContent !== $jsonContent) {
} file_put_contents($filePath, $updatedJsonContent);
}
}
// Les modules // Les modules
$filePath = self::DATA_DIR . $languageId . '/module.json'; $filePath = self::DATA_DIR . $languageId . '/module.json';
$jsonContent = file_get_contents($filePath); if (file_exists($filePath) === true) {
$updatedJsonContent = str_replace('"group":', '"role":', $jsonContent); $jsonContent = file_get_contents($filePath);
if ($updatedJsonContent !== $jsonContent) { $updatedJsonContent = str_replace('"group":', '"role":', $jsonContent);
file_put_contents($filePath, $updatedJsonContent); if ($updatedJsonContent !== $jsonContent) {
} file_put_contents($filePath, $updatedJsonContent);
} }
$this->setData(['core', 'dataVersion', 13600]); }
}
$this->setData(['core', 'dataVersion', 13600]);
} }