From 756dc43c681ee5bfc465a83a9e997779c58f59a0 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 14 Jan 2025 11:48:16 +0100 Subject: [PATCH] wait #7256 @2.5 --- app/Fluidbook/Compiler/Links.php | 1 - app/Fluidbook/Packager/Packager.php | 9 +++++++-- app/Models/Traits/PublicationSettings.php | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/Fluidbook/Compiler/Links.php b/app/Fluidbook/Compiler/Links.php index f95b5a775..2e76c3e6c 100644 --- a/app/Fluidbook/Compiler/Links.php +++ b/app/Fluidbook/Compiler/Links.php @@ -5,7 +5,6 @@ namespace App\Fluidbook\Compiler; use App\Fluidbook\Link\Link; use App\Fluidbook\Link\LinksData; use App\SubForms\Link\Base; -use Cubist\Util\Files\Files; use Cubist\Util\Text; use Fluidbook\Tools\Links\AnchorLink; use Fluidbook\Tools\Links\ContentLink; diff --git a/app/Fluidbook/Packager/Packager.php b/app/Fluidbook/Packager/Packager.php index c6b2a6fcc..d83961ac1 100644 --- a/app/Fluidbook/Packager/Packager.php +++ b/app/Fluidbook/Packager/Packager.php @@ -44,7 +44,7 @@ class Packager extends \App\Jobs\Base public $type = "unset"; - /** @var Lock */ + /** @var Lock */ protected $lock; /** @@ -332,14 +332,16 @@ class Packager extends \App\Jobs\Base $htmlFiles = array('index'); $filesToDelete = []; + $htmlPrepend = $book->getSettings()->get('htmlPrepend'); foreach ($htmlFiles as $name) { - $html = $book->getSettings()->get('htmlPrepend') . file_get_contents($dest . $name . '.html'); + $html = $htmlPrepend . file_get_contents($dest . $name . '.html'); file_put_contents($dest . '/' . $name . '.' . $this->_ext, $html); if ($this->_ext != 'html') { $filesToDelete[] = $name . '.html'; } } + $rm = new CommandLine('rm'); foreach ($filesToDelete as $f) { $rm->setArg(null, $dest . '/' . $f); @@ -348,8 +350,11 @@ class Packager extends \App\Jobs\Base if ($this->_ext !== 'html') { $e = $this->_ext; + $cmd = "find $dest -type f -name \"*.html\" -exec sed -i \"s/index_player\.html/index_player\.$e/g\" '{}' +"; + `$cmd`; $cmd = "find $dest -type f -name \"*.html\" -exec rename 's/\.html$/.$e/' '{}' \;"; `$cmd`; + } return $compiler; } diff --git a/app/Models/Traits/PublicationSettings.php b/app/Models/Traits/PublicationSettings.php index 80362fd25..33536a9d0 100644 --- a/app/Models/Traits/PublicationSettings.php +++ b/app/Models/Traits/PublicationSettings.php @@ -1648,7 +1648,7 @@ trait PublicationSettings 'default' => 'html', ]); $this->addSettingField('actualHtmlExtension', LongText::class, $this->__('Extension des fichiers html réellement appliquée au fluidbook'), [ - 'hint' => $this->__('Ex : php, htm, html, phtml, asp'), + 'hint' => $this->__('Ex : php, htm, html, phtml, asp, aspx'), 'default' => 'html', ]); $this->addSettingField('htmlPrepend', Textarea::class, $this->__('Code à insérer en tête des fichiers')); -- 2.39.5