/**
* @param FluidbookPublication $book
- * @param $version
+ * @param $version null|string
* @param $phonegap
* @param $phonegapVersion
* @param $dir
* @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();
$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;
$this->beforeWriteConfig();
$config = $this->writeConfig();
-
$this->vdir->file_put_contents('data/datas.js', $config);
$finals = $this->jsLibs;
-
$this->addPDFJS();
if ($this->fluidbookSettings->scorm_enable) {
$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;
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);
public static function getSourcesPath($version)
{
$base = self::getFluidbookPlayerBaseDirectory();
+
if ($version === 'stable') {
return $base . 'branches/master';
} else if ($version === 'dev') {