]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5994 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 5 Jun 2023 15:40:49 +0000 (17:40 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 5 Jun 2023 15:40:49 +0000 (17:40 +0200)
app/Fluidbook/Compiler/Compiler.php
app/Fluidbook/Packager/Online.php
app/Fluidbook/Packager/Packager.php

index 36467d7f5c1525c1f45e82f8ec2baba1161764b1..d5d88ebad9efd7d79db685c573c44d5c85b47d26 100644 (file)
@@ -267,6 +267,7 @@ class Compiler extends Base implements CompilerInterface
     protected $_command = null;
 
 
+
     use \App\Fluidbook\Compiler\Links;
     use Cart;
     use Stats;
@@ -292,6 +293,7 @@ class Compiler extends Base implements CompilerInterface
 
         parent::__construct();
 
+
         $this->setFluidbook($book);
         $this->setCommand($command);
 
index a584dc61da180d398eaccc0c57657f1dc431a715..e2f9d782ca674305891a5cb151bea32afe06e633 100644 (file)
@@ -3,6 +3,8 @@
 namespace App\Fluidbook\Packager;
 
 use App\Models\FluidbookPublication;
+use Fluidbook\Tools\Compiler\Compiler;
+
 class Online extends Packager
 {
     protected $origHTML;
@@ -11,6 +13,7 @@ class Online extends Packager
     protected $_ext = 'html';
     public $type = 'html';
     protected $_compileOnConstruct = false;
+
     protected function preparePackage()
     {
         parent::preparePackage();
@@ -22,6 +25,10 @@ class Online extends Packager
 
         $this->prepareFluidbook();
     }
+
+    /**
+     * @throws \Exception
+     */
     public function prepareFluidbook()
     {
         $dest = $this->vdir;
@@ -29,9 +36,9 @@ class Online extends Packager
         $mfid = $this->book->getSettings()->get('mobilefirstFluidbookId', '');
         if ($mfid != '' && (int)$mfid > 0) {
             $mfbook = FluidbookPublication::find($mfid);
-            $this->_compileFluidbook($this->book, $dest . '/d', true);
-            $vars = wsDAOBook::$lastHTML5Compiler->getIndexVars();
-            $this->_compileFluidbook($mfbook, $dest . '/mf', true);
+            $desktopCompiler = $this->_compileFluidbook($this->book, $dest . 'd/', true);
+            $vars = $desktopCompiler->getIndexVars();
+            $this->_compileFluidbook($mfbook, $dest . 'mf/', true);
 
             $hybrid = file_get_contents($this->resource_path('hybrid.html'));
             $replace = [
@@ -52,6 +59,7 @@ class Online extends Packager
         }
 
     }
+
     public function makePackage($zip)
     {
         parent::makePackage($zip);
index 7047dc6b7d77441bc675ff2393b2a79ef882cf84..6549e42eea44e0253d999f4324d58a88a2019200 100644 (file)
@@ -293,6 +293,10 @@ class Packager extends \App\Jobs\Base
     }
 
     /**
+     * @param $book
+     * @param $dest
+     * @param $hybrid
+     * @return Compiler
      * @throws Exception
      */
     protected function _compileFluidbook($book, $dest = null, $hybrid = false)
@@ -329,6 +333,7 @@ class Packager extends \App\Jobs\Base
             $cmd = "find $dest -type f -name \"*.html\" -exec rename 's/\.html$/.$e/' '{}' \;";
             `$cmd`;
         }
+        return $compiler;
     }
 
     /**