autorestart=true
user=toolbox
group=www-data
-numprocs=4
+numprocs=12
redirect_stderr=true
stdout_logfile=/proc/self/fd/2
stopwaitsecs=3600
}
- public static function getLinksAndRulers($book_id, &$links, &$rulers, $time = 'latest')
+ public static function getLinksAndRulers($book_id, &$links, &$rulers, $time = 'latest',$forceDecrypt=false)
{
if (null === $time) {
$time = 'latest';
$links = self::_UID($r['links']);
$rulers = self::_UID($r['rulers']);
- if (can('fluidbook-publication:links:edit-animations')) {
+ if ($forceDecrypt || can('fluidbook-publication:links:edit-animations')) {
$links = Link::decryptLinks($links);
} else {
$links = Link::encryptLinks($links);
use App\Models\FluidbookExternalInstallServer;
use App\Services\ScormCloud;
use Cubist\Backpack\Facades\App;
+use Cubist\Backpack\Magic\Models\ExternalServer;
+use Cubist\Net\Transfer\Driver;
use Cubist\Util\CommandLine\Rsync;
use Cubist\Util\Files\Files;
use Cubist\Util\Text;
}
} else if ($this->action === 'install') {
$s = $this->entry->install_online;
- $dest = self::_cleanInstallDir($s['path']);
+ $dest = Driver::cleanInstallDir($s['path']);
/** @var FluidbookExternalInstallServer $server */
$server = FluidbookExternalInstallServer::find($s['server']);
if (!$server) {
$this->sendNotification($subject, $text, $actions, $showTextIfNotEmail);
}
- protected static function _cleanInstallDir($path)
- {
- $path = str_replace('/\.{2,}/', '', $path);
- $path = preg_replace('/\/{2,}/', '/', $path);
- $path = trim($path, '/');
- return Text::str2URL($path, '-', true);
- }
protected function _compileandpackage($zip = true)
{
use App\Console\Commands\WorkshopMigration;
use App\Fluidbook\Packager\Packager;
+use App\Models\FluidbookExternalInstallServer;
use App\Models\FluidbookPublication;
use Cubist\Backpack\Magic\PageData;
+use Cubist\Net\Transfer\Driver;
use Cubist\Util\CommandLine\Rsync;
use Cubist\Util\Files\Files;
use Cubist\Util\PHP;
{
$translateVariables = $this->_getTranslateVariables();
if ($this->action === 'install') {
- $url = $this->installHosting($this->entry->getPageData());
- $this->sendNotification(__('Collection ":title" (#:nb) installée sur le serveur hosting', $translateVariables), '', $url);
+ $s = $this->entry->install;
+ $dest = Driver::cleanInstallDir($s['path']);
+ /** @var FluidbookExternalInstallServer $server */
+ $server = FluidbookExternalInstallServer::find($s['server']);
+ if (!$server) {
+ throw new \Exception('No valid server defined for external installation');
+ }
+ if (!$dest) {
+ throw new \Exception('No path defined for external server installation');
+ }
+
+ $translateVariables['server'] = $server->name;
+ $url = $this->install($dest, $server);
+ $this->sendNotification(__('Collection ":title" (#:nb) installée sur le serveur :server', $translateVariables), __('La collection ":title" a été installée sur le serveur :server', $translateVariables), [__('Voir sur :server', $translateVariables) => $url]);
} else if ($this->action === 'export' && in_array($this->entry->version, ['win_inss_html', 'win_ins_html'])) {
$url = $this->downloadList($this->entry->getPageData());
- $this->sendNotification(__($this->_subject, $translateVariables), __($this->_text, $translateVariables), $url);
+ $this->sendNotification(__($this->_subject, $translateVariables), __($this->_text, $translateVariables), [__('Télécharger') => $url]);
} else {
parent::handle();
}
}
+ public function install($dest, $server)
+ {
+ $path = $this->_compile();
+ $driver = $server->getTransferDriver();
+ $driver->copy($path, $dest, false, false);
+ return $server->makeURL($dest);
+ }
protected function _compile()
{
/**
* @param $path
- * @return null
+ * @return void
* @throws \Exception
*/
public function compile($path)
PHP::neverStop();
if ($data->type === 'scorm_multilang') {
- $res = $this->compileMultilang($data, $path, true);
+ $this->compileMultilang($data, $path, true);
} else if ($data->type === 'export_multilang') {
- $res = $this->compileMultilang($data, $path, false);
+ $this->compileMultilang($data, $path, false);
} elseif ($data->type === 'export') {
- $res = $this->compileExport($data, $path);
+ $this->compileExport($data, $path);
}
- return $res;
}
protected function getCollectionGlobalSettings()
$langs = [];
$countries = [];
- $defaultFlags = ['en' => 'gb', 'sv' => 'se'];
+ $defaultFlags = ['en' => 'gb', 'sv' => 'se', 'zh' => 'cn'];
$fluidbooks = [];
$jobs = [];
foreach ($fluidbooks as $fbid => $publication) {
- $jobs[] = $this->_jobDownloadFluidbook($fbid, $scorm ? 'scorm' : $data->version, $path . $langs[$fbid], $options);
+ $jobs[] = $this->_jobDownloadFluidbook($fbid, $scorm ? 'scorm' : 'online', $path . $langs[$fbid], $options);
}
$this->_waitJobs($jobs);
$job->setBookId($id);
$job->setVersion($version);
$job->setOptions($options);
- $job->setAction('export');
$job->setJobName('export_' . $id);
$job->setDestination($dest);
- $f = $async ? 'dispatch' : 'dispatchSync';
- $f($job)->onQueue('ws2');
+ if ($async) {
+ dispatch($job)->onQueue('ws2');
+ } else {
+ $job->handle();
+ }
return $job;
}
{
$nbjobs = count($jobs);
$done = 0;
- foreach ($jobs as $label => $job) {
+ foreach ($jobs as $job) {
if ($job->isDone()) {
$done++;
}
$file = $cdir . $this->fluidbookSettings->basketReferences;
$this->config->basketReferences = ExcelToArray::excelToArrayKeyVars($file);
- Links::getLinksAndRulers($this->book_id, $links, $rulers);
+ $this->getLinksAndRulers($links,$rulers);
foreach ($links as $link) {
if ($link['type'] == '12') {
}
}
+ public function getLinksAndRulers(&$links, &$rulers){
+ Links::getLinksAndRulers($this->book_id, $links, $rulers,'latest',true);
+ }
+
public function writeMIFCart()
{
$this->lessVariables['import-cart-styles'] = 'mif';
$file = $cdir . $this->fluidbookSettings->basketReferences;
$this->config->basketReferences = ExcelToArray::excelToArrayKeyVars($file);
- Links::getLinksAndRulers($this->book_id, $links, $rulers);
+ $this->getLinksAndRulers($links, $rulers);
foreach ($this->config->basketReferences as $ref => $data) {
$source = $cdir . '/' . $data['Image'];
$this->vdir->copy($cdir . $f, 'data/commerce/' . $f);
}
- Links::getLinksAndRulers($this->book_id, $links, $rulers);
+ $this->getLinksAndRulers($links, $rulers);
}
public function writeGrandPavoisCart()
$file = $cdir . $this->fluidbookSettings->basketReferences;
$this->config->basketReferences = ExcelToArray::excelToArrayKeyVars($file);
- Links::getLinksAndRulers($this->book_id, $links, $rulers);
+ $this->getLinksAndRulers($links, $rulers);
}
$this->config->eanReferences = ExcelToArray::excelToArrayIndexKeyVars($eanFile);
}
- Links::getLinksAndRulers($this->book_id, $links, $rulers);
+ $this->getLinksAndRulers($links, $rulers);
foreach ($links as $link) {
if ($link['type'] == '12' && isset($this->config->basketReferences[$link['to']])) {
$this->config->basketReferences[$link['to']]['zoom_image'] = 'data/links/zoom_' . $link['uid'] . '.jpg';
$this->vdir->copyDirectory($d['dir'], $d['fdir']);
}
- Links::getLinksAndRulers($this->book_id, $links, $rulers);
+ $this->getLinksAndRulers($links, $rulers);
$this->_fluidbook->normalizeLinks($links);
if ($this->fluidbookSettings->basketManager === 'Puma') {
{
Log::error($e);
- $c = explode('\\', get_class($link));
+ /*$c = explode('\\', get_class($link));
$type = array_pop($c);
$type = str_replace('Link', '', $type);
- throw new \Exception('Error on the ' . $type . ' link to ' . $link->to . ' on page ' . $link->page . ' with message : ' . $e->getMessage());
+ throw new \Exception('Error on the ' . $type . ' link to ' . $link->to . ' on page ' . $link->page . ' with message : ' . $e->getMessage());*/
}
protected function _htmlLinkList($list)
namespace App\Jobs;
use App\Fluidbook\Packager\Packager;
+use Cubist\Util\CommandLine\Rsync;
use Illuminate\Support\Facades\Log;
class FluidbookPackage extends Base
{
try {
$packager = Packager::package($this->getBookId(), $this->getVersion(), false, true, $this->getOptions());
- $this->setResult($packager->getFinalPath());
+ $packager->handle();
+ (new Rsync($packager->getFinalPath(),$this->getDestination()))->execute();
+ $this->setResult(true);
} catch (\Exception $e) {
$this->setException($e);
}
},
{
"name": "brick/math",
- "version": "0.10.2",
+ "version": "0.11.0",
"source": {
"type": "git",
"url": "https://github.com/brick/math.git",
- "reference": "459f2781e1a08d52ee56b0b1444086e038561e3f"
+ "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/brick/math/zipball/459f2781e1a08d52ee56b0b1444086e038561e3f",
- "reference": "459f2781e1a08d52ee56b0b1444086e038561e3f",
+ "url": "https://api.github.com/repos/brick/math/zipball/0ad82ce168c82ba30d1c01ec86116ab52f589478",
+ "reference": "0ad82ce168c82ba30d1c01ec86116ab52f589478",
"shasum": ""
},
"require": {
- "ext-json": "*",
- "php": "^7.4 || ^8.0"
+ "php": "^8.0"
},
"require-dev": {
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^9.0",
- "vimeo/psalm": "4.25.0"
+ "vimeo/psalm": "5.0.0"
},
"type": "library",
"autoload": {
],
"support": {
"issues": "https://github.com/brick/math/issues",
- "source": "https://github.com/brick/math/tree/0.10.2"
+ "source": "https://github.com/brick/math/tree/0.11.0"
},
"funding": [
{
"type": "github"
}
],
- "time": "2022-08-10T22:54:19+00:00"
+ "time": "2023-01-15T23:15:59+00:00"
},
{
"name": "cache/adapter-common",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_cms-back.git",
- "reference": "d3c2c4e5e13dfb63d851324d4e87a367219692dc"
+ "reference": "cd4d4fcc83a76f6c3b15b8f959ed8a9f4d6c0d7b"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-ca37b0.tar",
- "reference": "d3c2c4e5e13dfb63d851324d4e87a367219692dc",
- "shasum": "1f3141c258a8d6d1a5eaf5c249597ab0053ccae3"
+ "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-cc5f17.tar",
+ "reference": "cd4d4fcc83a76f6c3b15b8f959ed8a9f4d6c0d7b",
+ "shasum": "5cf65154b2b704fc6eb57bb4abc1bda4c9047b73"
},
"require": {
"backpack/backupmanager": "^3.0",
}
],
"description": "Cubist Backpack extension",
- "time": "2023-03-30T14:44:48+00:00"
+ "time": "2023-03-31T11:53:56+00:00"
},
{
"name": "cubist/cms-front",
"source": {
"type": "git",
"url": "git://git.cubedesigners.com/cubist_net.git",
- "reference": "48d99d29868cf879ddd258e89ff23f1c19820d8e"
+ "reference": "4dad0f1bddd1e5c0655db0d7a975a1de52c23f22"
},
"dist": {
"type": "tar",
- "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-6b4fb6.tar",
- "reference": "48d99d29868cf879ddd258e89ff23f1c19820d8e",
- "shasum": "47fdf6d79be5d8fbdd6113a1b3d8e67f94436fa4"
+ "url": "https://composer.cubedesigners.com/dist/cubist/net/cubist-net-dev-master-f3e6ce.tar",
+ "reference": "4dad0f1bddd1e5c0655db0d7a975a1de52c23f22",
+ "shasum": "a6e68a4029c88dbded4d4c4eb1a660a1f310a289"
},
"require": {
"cubist/util": "dev-master",
}
],
"description": "net cubist composer package",
- "time": "2023-02-13T18:16:16+00:00"
+ "time": "2023-03-31T11:53:22+00:00"
},
{
"name": "cubist/pdf",
},
{
"name": "ramsey/uuid",
- "version": "4.7.3",
+ "version": "4.x-dev",
"source": {
"type": "git",
"url": "https://github.com/ramsey/uuid.git",
- "reference": "433b2014e3979047db08a17a205f410ba3869cf2"
+ "reference": "8e955307d32dc9b6992440ff81321d3cb09db75a"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/ramsey/uuid/zipball/433b2014e3979047db08a17a205f410ba3869cf2",
- "reference": "433b2014e3979047db08a17a205f410ba3869cf2",
+ "url": "https://api.github.com/repos/ramsey/uuid/zipball/8e955307d32dc9b6992440ff81321d3cb09db75a",
+ "reference": "8e955307d32dc9b6992440ff81321d3cb09db75a",
"shasum": ""
},
"require": {
- "brick/math": "^0.8.8 || ^0.9 || ^0.10",
+ "brick/math": "^0.8.8 || ^0.9 || ^0.10 || ^0.11",
"ext-json": "*",
"php": "^8.0",
"ramsey/collection": "^1.2 || ^2.0"
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
"ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type."
},
+ "default-branch": true,
"type": "library",
"extra": {
"captainhook": {
],
"support": {
"issues": "https://github.com/ramsey/uuid/issues",
- "source": "https://github.com/ramsey/uuid/tree/4.7.3"
+ "source": "https://github.com/ramsey/uuid/tree/4.x"
},
"funding": [
{
"type": "tidelift"
}
],
- "time": "2023-01-12T18:13:24+00:00"
+ "time": "2023-03-27T22:05:11+00:00"
},
{
"name": "react/promise",
"ext-zlib": "*"
},
"platform-dev": [],
- "plugin-api-version": "2.3.0"
+ "plugin-api-version": "2.1.0"
}