Nettoyage des anciennes installations

This commit is contained in:
Fred Tempez 2023-04-24 22:28:53 +02:00
parent 760907a67a
commit f235a65fe7
2 changed files with 10 additions and 7 deletions

View File

@ -167,7 +167,7 @@ class common
// Langue de l'interface sélectionnée
public static $i18nUI = 'fr_FR';
// Langues de contenu
public static $i18nContent = '';
public static $i18nContent = 'fr_FR';
public static $languages = [
'az_AZ' => 'Azərbaycan dili',
'bg_BG' => 'български език',

View File

@ -51,10 +51,9 @@ class install extends common
]);
}
// Soumission du formulaire
if ($this->isPost()) {
$lang = $this->getInput('installLanguage');
// Pour la suite de l'installation
// setcookie('ZWII_UI', $lang, time() + 3600, helper::baseUrl(false, false), '', false, false);
@ -70,7 +69,6 @@ class install extends common
if (is_dir(self::I18N_DIR)) {
foreach ($this->getData(['languages']) as $lang => $value) {
self::$i18nFiles[$lang] = self::$languages[$lang];
;
}
}
@ -150,6 +148,12 @@ class install extends common
// La langue du site est la langue de l'UI
$_SESSION['ZWII_CONTENT'] = $_SESSION['ZWII_UI'];
// Efface les langues déjà installées
foreach ($this->getData(['languages']) as $lang => $value) {
if (is_dir(self::DATA_DIR . $lang))
$this->removeDir(self::DATA_DIR . $lang);
}
// Création du dossier de langue avec le marqueur de langue par défaut
if (!is_dir(self::DATA_DIR . $_SESSION['ZWII_CONTENT'])) {
mkdir(self::DATA_DIR . $_SESSION['ZWII_CONTENT']);
@ -163,6 +167,7 @@ class install extends common
) {
$this->initData('page', $_SESSION['ZWII_CONTENT'], true);
$this->initData('module', $_SESSION['ZWII_CONTENT'], true);
$this->initData('locale', $_SESSION['ZWII_CONTENT'], true);
$this->setData(['module', 'blog', 'posts', 'mon-premier-article', 'userId', $userId]);
$this->setData(['module', 'blog', 'posts', 'mon-deuxieme-article', 'userId', $userId]);
$this->setData(['module', 'blog', 'posts', 'mon-troisieme-article', 'userId', $userId]);
@ -172,9 +177,7 @@ class install extends common
if ($_SESSION['ZWII_CONTENT'] !== 'fr_FR') {
$this->initData('page', $_SESSION['ZWII_CONTENT'], false);
$this->initData('module', $_SESSION['ZWII_CONTENT'], false);
// Supprime l'installation FR générée par défaut.
if (is_dir(self::DATA_DIR . 'fr_FR'))
$this->removeDir(self::DATA_DIR . 'fr_FR');
$this->initData('locale', $_SESSION['ZWII_CONTENT'], false);
}
// Sauvegarder la configuration du Proxy