From 2e795ff1740110cb2a81e7f327a90582e89dff15 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Thu, 26 Jun 2025 11:19:39 +0200 Subject: [PATCH] wait #7611 @2 --- app/Models/ELearningPackage.php | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/app/Models/ELearningPackage.php b/app/Models/ELearningPackage.php index 5e4042aff..4a86e329a 100644 --- a/app/Models/ELearningPackage.php +++ b/app/Models/ELearningPackage.php @@ -8,6 +8,7 @@ use App\Http\Controllers\Admin\Operations\ChangeownerOperation; use App\Http\Controllers\Admin\Operations\ELearningPackage\ImportOperation; use App\Http\Controllers\Admin\Operations\ELearningPackage\PreviewOperation; use App\Http\Controllers\Admin\Operations\ELearningPackage\DownloadOperation; +use App\Jobs\FluidbookPackage; use App\Models\Base\ToolboxDownloadable; use App\Models\Base\ToolboxModel; use App\Models\Traits\CheckHash; @@ -19,6 +20,7 @@ use Cubist\Backpack\Magic\Fields\Text; use Cubist\Backpack\Magic\Fields\Textarea; use Cubist\Scorm\Manifest; use Cubist\Scorm\Version; +use Cubist\Util\CommandLine\Rsync; use Cubist\Util\Files\Files; use Cubist\Util\Files\VirtualDirectory; use Cubist\Util\Zip; @@ -173,16 +175,21 @@ class ELearningPackage extends ToolboxModel $tmp = Files::tmpdir(); $vdir->addTemp($tmp); + $book = FluidbookPublication::withoutGlobalScopes()->find($id); + $packager = Packager::package($id, 'scorm', false, true); + $packager->handle(); + if ($packager->getFinalPath()) { + $rsync = new Rsync($packager->getFinalPath(), $tmp); + $rsync->execute(); - $workshop = new WorkshopV2($user); - $workshop->installBook($id, $tmp, [], 'scorm'); - if (file_exists($tmp . '/imsmanifest.xml')) { - unlink($tmp . '/imsmanifest.xml'); + + if (file_exists($tmp . '/imsmanifest.xml')) { + unlink($tmp . '/imsmanifest.xml'); + } + $vdir->copyDirectory($tmp, $basePath); } - $vdir->copyDirectory($tmp, $basePath); - $meta = $workshop->getMetadata($id); - return $meta->title; + return $book->title; } protected function _compileQuiz($id, $quiz_file, $vdir, $basePath) @@ -202,7 +209,7 @@ class ELearningPackage extends ToolboxModel if (null === $quiz) { return null; } - $quiz->compile($tmp, true); + $quiz->compile($tmp, null, true); if (file_exists($tmp . '/imsmanifest.xml')) { unlink($tmp . '/imsmanifest.xml'); } -- 2.39.5