]> _ Git - fluidbook-toolbox.git/commitdiff
wait #5416 @0.25
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 25 Aug 2022 09:36:48 +0000 (11:36 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 25 Aug 2022 09:36:48 +0000 (11:36 +0200)
app/Jobs/FluidbookCompiler.php

index b5fe576494e30d332d7a018c08fce54550609a1a..a8c0bc1641179aa6ade344e26ae37bce90e5038b 100644 (file)
@@ -265,7 +265,7 @@ class FluidbookCompiler extends Base implements CompilerInterface
 
     /**
      * @param FluidbookPublication $book
-     * @param $version
+     * @param $version null|string
      * @param $phonegap
      * @param $phonegapVersion
      * @param $dir
@@ -278,7 +278,7 @@ class FluidbookCompiler extends Base implements CompilerInterface
      * @throws \Exception
      */
 
-    function __construct(FluidbookPublication $book, $version = 'stable', $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $forceTheme = false, $hybrid = false, Command $command = null)
+    function __construct(FluidbookPublication $book, $version = null, $phonegap = false, $phonegapVersion = 'latest', $dir = null, $standalone = false, $appcache = false, $home = false, $forceTheme = false, $hybrid = false, Command $command = null)
     {
         parent::__construct();
 
@@ -288,7 +288,7 @@ class FluidbookCompiler extends Base implements CompilerInterface
         $this->phonegapVersion = self::getPhonegapVersion($phonegapVersion);
         $this->appcache = $appcache;
         $this->multiApp = $this->home = $home;
-        $this->version = $version;
+        $this->version = $this->version ?? $this->getFluidbook()->mobileLVersion;
 
         $this->hybrid = $hybrid;
 
@@ -2703,11 +2703,9 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
         $this->beforeWriteConfig();
 
         $config = $this->writeConfig();
-
         $this->vdir->file_put_contents('data/datas.js', $config);
 
         $finals = $this->jsLibs;
-
         $this->addPDFJS();
 
         if ($this->fluidbookSettings->scorm_enable) {
@@ -2722,18 +2720,12 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
             $finals['widget'] = $this->widgetJsFiles;
         }
 
-        $dirminimized = $this->assets . '/js/min/';
-        if (!file_exists($dirminimized)) {
-            mkdir($dirminimized, 0777, true);
-        }
+        $dirminimized = Files::mkdir($this->assets . '/js/min');
 
         foreach ($finals as $jsfinal => $files) {
             $mintime = 0;
             $hash = hash('sha256', json_encode($files));
             $minimized = $dirminimized . $jsfinal . '-' . $hash . '-min.js';
-            if (!file_exists(dirname($minimized))) {
-                mkdir(dirname($minimized));
-            }
             if (file_exists($minimized) && filesize($minimized) > 0) {
                 $mintime = filemtime($minimized);
                 $reminimize = false;
@@ -2779,14 +2771,12 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
                     unlink($minimized);
                 }
 
-
                 if (file_exists($tmp) && filesize($tmp) > 0) {
                     if ($hasNonMin) {
                         $uglify = new CommandLine('/usr/local/bin/uglifyjs');
                         $uglify->setArg('o', $minimized);
                         $uglify->setArg(null, $tmp);
                         $uglify->execute();
-                        $uglify->debug();
                     } else {
                         $uglify = null;
                         copy($tmp, $minimized);
@@ -4007,6 +3997,7 @@ height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
     public static function getSourcesPath($version)
     {
         $base = self::getFluidbookPlayerBaseDirectory();
+
         if ($version === 'stable') {
             return $base . 'branches/master';
         } else if ($version === 'dev') {