From 20251b8b084faedacb7c2e6ba7da9afe6f2cee0a Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 1 Dec 2025 15:57:37 +0100 Subject: [PATCH] wait #7864 @1 --- app/Jobs/HostingUpdate.php | 50 +++++++++++---------- app/Models/Traits/PublicationSettings.php | 9 ++-- resources/hosting/server/docker-compose.yml | 9 ++-- resources/hosting/server/update | 2 +- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/app/Jobs/HostingUpdate.php b/app/Jobs/HostingUpdate.php index 74382cf07..b420b8cec 100644 --- a/app/Jobs/HostingUpdate.php +++ b/app/Jobs/HostingUpdate.php @@ -38,33 +38,35 @@ class HostingUpdate extends Base copy($r . 'updateall', $d . 'update'); - - foreach ($servers as $server) { - $basePath = trim($server->base_path, '/'); - if ($basePath != '') { - $basePath = '/' . $basePath; - } + try { + $basePath = trim($server->base_path, '/'); + if ($basePath != '') { + $basePath = '/' . $basePath; + } + + $phpversion = floatval($server->php); + $image = 'php:apache'; + if ($phpversion > 1) { + $image = 'php:' . $phpversion . '-apache'; + } + + /** @var FluidbookExternalInstallServer $server */ + $server->updateHtaccess(); + $s = $d . 'server-' . $server->id; + Files::copy($r . 'server', $s); + Files::recursiveReplaceStringInDir($s, [ + '$sid' => $server->id, + '$image' => $image, + '$dockerpath' => ($image !== 'httpd') ? '/var/www/html' : '/usr/local/apache2/htdocs', + '$domains' => implode(',', Text::explodeNewLines($server->subdomains)), + '$hosting' => $name, + '$path' => $data['basepath'] . $basePath, + ]); + $updateAll[] = '/docker/fluidbook-' . $name . '/server-' . $server->id . '/update'; + } catch (\Exception $e) { - $phpversion=floatval($server->php); - $image = 'php:apache'; - if ($phpversion > 1) { - $image = 'php:' . $phpversion . '-apache'; } - - /** @var FluidbookExternalInstallServer $server */ - $server->updateHtaccess(); - $s = $d . 'server-' . $server->id; - Files::copy($r . 'server', $s); - Files::recursiveReplaceStringInDir($s, [ - '$sid' => $server->id, - '$image' => $image, - '$dockerpath' => ($image !== 'httpd') ? '/var/www/html' : '/usr/local/apache2/htdocs', - '$domains' => implode(',', Text::explodeNewLines($server->subdomains)), - '$hosting' => $name, - '$path' => $data['basepath'] . $basePath, - ]); - $updateAll[] = '/docker/fluidbook-' . $name . '/server-' . $server->id . '/update'; } Files::recursiveReplaceStringInDir($d, [ diff --git a/app/Models/Traits/PublicationSettings.php b/app/Models/Traits/PublicationSettings.php index 1fc083043..95103f443 100644 --- a/app/Models/Traits/PublicationSettings.php +++ b/app/Models/Traits/PublicationSettings.php @@ -1304,11 +1304,14 @@ trait PublicationSettings protected function _accessibility() { $this->_addSettingField('section_accessibility', FormBigSection::class, $this->__('Accessibilité')); - $this->_addSettingField('audiodescriptionTexts', FilesOrURL::class, $this->__('Contenus textuels pour l\'audiodescription ou les lecteurs d\'écran'), [ + $this->_addSettingField('accessible_contents', SelectFromArray::class, $this->__('Contenus alternatifs accessibles'), ['default' => 'disabled', 'options' => ['disabled' => __('Désactivés'), 'docling' => __('Contenus accessibles extraits automatiquement et édités'), 'excel' => __('Fichier excel ou liens "audiodescription"')]]); + $this->_addSettingField('audiodescriptionTexts', FilesOrURL::class, $this->__('Contenus textuels'), [ 'accept' => self::$acceptXLSX, - 'hint' => '' . __('Télécharger les contenus extraits du PDF au format audiodescription') . '', + 'hint' => '' . $this->__('Télécharger les contenus extraits du PDF au format audiodescription') . '', + 'when' => ['accessible_contents' => ['excel']], ]); - $this->_addSettingField('audiodescriptionVoice', FluidbookTTSVoice::class, $this->__('Voix pour l\'audiodescription')); + $this->_addSettingField('audiodescription', Checkbox::class, $this->__('Activer l\'audiodescription'), ['default' => false, 'when' => ['accessible_contents' => ['docling', 'excel']]]); + $this->_addSettingField('audiodescriptionVoice', FluidbookTTSVoice::class, $this->__('Voix pour l\'audiodescription'), ['when' => ['audiodescription' => 1]]); } diff --git a/resources/hosting/server/docker-compose.yml b/resources/hosting/server/docker-compose.yml index 56a8d98d8..0ff394006 100644 --- a/resources/hosting/server/docker-compose.yml +++ b/resources/hosting/server/docker-compose.yml @@ -1,4 +1,3 @@ -version: '3.1' services: webserver: container_name: fluidbook-$hosting-server-$sid @@ -11,9 +10,13 @@ services: LETSENCRYPT_HOST: $domains networks: - fluidbook-$hosting + - nginxproxy restart: unless-stopped networks: fluidbook-$hosting: - external: - name: fluidbook-$hosting + name: fluidbook-$hosting + external: true + nginxproxy: + name: nginxproxy + external: true diff --git a/resources/hosting/server/update b/resources/hosting/server/update index 030d0b6a0..133244351 100644 --- a/resources/hosting/server/update +++ b/resources/hosting/server/update @@ -1,5 +1,5 @@ #!/bin/sh cd /docker/fluidbook-$hosting/server-$sid/ docker compose pull -docker compose down +docker compose down -v docker compose up -d -- 2.39.5