From 106387fab8bb2b4923f170b3f0e3c95ebd4819a9 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Tue, 18 Jul 2023 11:19:53 +0200 Subject: [PATCH] Initialisation WIP --- core/core.php | 14 ++++++++++++++ core/include/update.inc.php | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/core.php b/core/core.php index 9b33eac7..6a93f1aa 100644 --- a/core/core.php +++ b/core/core.php @@ -605,6 +605,19 @@ class common // Tableau avec les données vierges require_once('core/module/install/ressource/defaultdata.php'); + if (!file_exists(self::DATA_DIR . $lang)) { + mkdir(self::DATA_DIR . $lang, 0755); + } + $db = $this->dataFiles[$module]; + + if ($sampleSite === true && $lang === 'fr_FR') { + $db->set($module, init::$defaultDataI18n[$module]); + } else { + $db->set($module, init::$defaultData[$module]); + } + $db->save; // Stockage dans un sous-dossier localisé + + // Localisations if ( $module === 'page' || $module === 'module' || @@ -642,6 +655,7 @@ class common file_put_contents(self::DATA_DIR . $module . '.json', json_encode([$module => init::$defaultData[$module]], JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT)); } + } diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 0e592b3c..f3458487 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -6,7 +6,7 @@ // Premier appel lors de l'installation, les fichiers sont vides en lecture if (is_null($this->getData(['core', 'dataVersion']))) { - header("Location: " . $_SERVER['PHP_SELF']); +// header("Location: " . $_SERVER['PHP_SELF']); exit(); }