From f35fbb8c7133de2b4b4f5f27fd3185a5965976a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Tempez?= Date: Thu, 31 Mar 2022 15:37:44 +0200 Subject: [PATCH] import presque ok --- core/include/update.inc.php | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/core/include/update.inc.php b/core/include/update.inc.php index ea8ad2a6..d7658cbb 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -938,9 +938,8 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { // Conversion des fontes locales $files = $this->getData(['fonts', 'files']); if (is_array($files)) { - $this->deleteData(['fonts', 'files']); foreach ($files as $fontId => $fontName) { - if (file_exists(self::DATA_DIR . 'fonts' . $fontName)) { + if (file_exists(self::DATA_DIR . 'fonts/' . $fontName)) { $this->setData(['fonts', 'files', $fontId, [ 'name' => ucfirst($fontId), 'font-family'=> $fontId . ', sans-serif', @@ -949,28 +948,22 @@ if ($this->getData(['core', 'dataVersion']) < 11400) { } } } + // Consersion des fontes importées $imported = $this->getData(['fonts', 'imported']); if (is_array($imported)) { - $this->deleteData(['fonts', 'imported']); foreach ($imported as $fontId => $fontUrl) { $this->setData(['fonts', 'imported', $fontId, [ - 'name' => $fontId, + 'name' => ucfirst($fontId), 'font-family'=> '"' . $fontId . '", sans-serif', - 'resource' => 'https:\/\/fonts.cdnfonts.com\/css\/' . $fontUrl + 'resource' => 'https:\\fonts.cdnfonts.com\css' . $fontUrl ]]); } } - - - $this->setData(['fonts', 'imported', $fonts]); - - // Rafraichir les thèmes - if (file_exists(self::DATA_DIR . 'admin.css')) { - unlink (self::DATA_DIR . 'admin.css'); - } - if (file_exists(self::DATA_DIR . 'theme.css')) { - unlink (self::DATA_DIR . 'theme.css'); + // Importation des fontes exemples + $template = $fonts; + foreach ($template as $fontId => $fontValue) { + $this->setData(['fonts', 'imported', $fontId, $fontValue]); } // Transforme les URL en références relatives