From 4e03087c41c0b03dee3eb535dfc99d70911e4a7b Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 25 Aug 2022 11:36:48 +0200 Subject: [PATCH] wait #5416 @0.25 --- app/Jobs/FluidbookCompiler.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/app/Jobs/FluidbookCompiler.php b/app/Jobs/FluidbookCompiler.php index b5fe57649..a8c0bc164 100644 --- a/app/Jobs/FluidbookCompiler.php +++ b/app/Jobs/FluidbookCompiler.php @@ -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"> $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"> $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"> 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"> public static function getSourcesPath($version) { $base = self::getFluidbookPlayerBaseDirectory(); + if ($version === 'stable') { return $base . 'branches/master'; } else if ($version === 'dev') { -- 2.39.5