From: Vincent Vanwaelscappel Date: Thu, 14 Sep 2023 15:54:16 +0000 (+0200) Subject: wip #6269 @0.5 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=94c6cefade2f4e0f1e4a175b96d90d8ac640c729;p=fluidbook-toolbox.git wip #6269 @0.5 --- diff --git a/app/Fluidbook/Packager/Download.php b/app/Fluidbook/Packager/Download.php index ba67cfc9b..917532055 100644 --- a/app/Fluidbook/Packager/Download.php +++ b/app/Fluidbook/Packager/Download.php @@ -16,7 +16,6 @@ use Monolog\Logger; class Download extends DownloadBase { - protected $version = 'online'; protected $type = 'Fluidbook'; @@ -25,6 +24,12 @@ class Download extends DownloadBase // __('Fluidbook ":title" (#:nb) installé sur :server') protected $_installSubject = 'Fluidbook ":title" (#:nb) installé sur :server'; + // __('Fluidbook ":title" (#:nb) déployé sur le loadbalancer') + protected $_loadbalancerSubject = 'Fluidbook ":title" (#:nb) déployé sur le loadbalancer'; + + // __('Le Fluidbook ":title" a été installé sur :server.') + protected $_loadbalancerText = 'Le Fluidbook ":title" a été installé sur le loadbalancer.'; + // __('Le Fluidbook ":title" est prêt au téléchargement.'); protected $_text = 'Le Fluidbook ":title" est prêt au téléchargement.'; @@ -124,6 +129,16 @@ class Download extends DownloadBase $actions = [__('Voir sur :server', ['server' => $server->name]) => $url]; } + } else if ($this->action === 'loadbalancer') { + $path = $this->_compileandpackage(false); + $dest = protected_path('fluidbookpublication/loadbalancer/' . $this->entry->id . '_' . $this->entry->hash . '/'); + + $rsync = new Rsync($path, $dest, true); + $rsync->execute(); + $rsync->debug(); + + $subject = __($this->_loadbalancerSubject, $translateVariables); + $text = __($this->_loadbalancerText, $translateVariables); } } catch (\Exception $e) { $subject = __('Erreur lors de la compilation du :type :nb', ['nb' => $this->_id(), 'type' => $this->type]); diff --git a/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php b/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php index 21db71aac..e06e2bd7f 100644 --- a/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php +++ b/app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php @@ -85,7 +85,7 @@ trait DownloadOperation */ protected function package($id, $action, $version) { - if (!in_array($action, ['download', 'install', 'scormcloud'])) { + if (!in_array($action, ['download','loadbalancer', 'install', 'scormcloud'])) { abort(404, __('Cette action n\'est pas disponible')); } if (!FluidbookPublication::hasPermission($id, 'read')) { diff --git a/resources/views/vendor/backpack/crud/buttons/fluidbook_publication/download.blade.php b/resources/views/vendor/backpack/crud/buttons/fluidbook_publication/download.blade.php index 912605331..808d1397a 100644 --- a/resources/views/vendor/backpack/crud/buttons/fluidbook_publication/download.blade.php +++ b/resources/views/vendor/backpack/crud/buttons/fluidbook_publication/download.blade.php @@ -57,6 +57,13 @@ $actions=array_merge($actions,$installActions); } } + if(can('fluibook-publication:download:install-hosting') && $entry->hosting_loadbalancer){ + $actions['sep_lb']='---------'; + $actions['install_lb']=[ + 'label'=>__('Envoyer sur le loadbalancer'), + 'url'=> $basePackage.'/loadbalancer/online', + ]; + } $confirm=[ 'title'=>'',