]> _ Git - fluidbook-toolbox.git/commitdiff
wip #6269 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 Sep 2023 15:54:16 +0000 (17:54 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 14 Sep 2023 15:54:16 +0000 (17:54 +0200)
app/Fluidbook/Packager/Download.php
app/Http/Controllers/Admin/Operations/FluidbookPublication/DownloadOperation.php
resources/views/vendor/backpack/crud/buttons/fluidbook_publication/download.blade.php

index ba67cfc9b40c2f4a59a79206319f00e4db889595..917532055187fd45c1375e9529873bf0c28ebd83 100644 (file)
@@ -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]);
index 21db71aac31f58a78e0e5a3207e1c1265ba9fd04..e06e2bd7f1f019607463b5a18a09a2b6dcb701c5 100644 (file)
@@ -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')) {
index 912605331c0e8a709d73958b37576136769786e7..808d1397a7795e08859ff926dba178996b45e162 100644 (file)
             $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'=>'',