From 5ba0115e7beb16afd49e9a958c7bf9c97b103d4e Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Fri, 7 Feb 2025 21:53:23 +0100 Subject: [PATCH] wait #7309 @3 --- app/Fluidbook/Link/LinksData.php | 21 +++-- app/Models/FluidbookPublication.php | 9 ++- composer.lock | 114 ++++++++++++++-------------- 3 files changed, 78 insertions(+), 66 deletions(-) diff --git a/app/Fluidbook/Link/LinksData.php b/app/Fluidbook/Link/LinksData.php index 6b09bf478..dd439c752 100644 --- a/app/Fluidbook/Link/LinksData.php +++ b/app/Fluidbook/Link/LinksData.php @@ -582,8 +582,10 @@ class LinksData } krsort($updates); if (!count($updates)) { - LinksData::addLinksFromPDF($book_id); - return self::getLinksVersions($book_id); + if (LinksData::addLinksFromPDF($book_id)) { + return self::getLinksVersions($book_id); + } + return []; } @@ -659,7 +661,15 @@ class LinksData $numbers = ['left', 'top', 'width', 'height']; $links = []; - foreach ($book->getComposition() as $page => $doc) { + $composition = $book->getComposition(); + if (!$composition) { + return false; + } + $docs = []; + foreach ($composition as $page => $doc) { + if (!in_array($doc[0], $docs)) { + $docs[] = $doc[0]; + } try { $fp = Gzip::fopen($book->getDocument($page)->path('links/p' . $doc[1] . '.csv')); } catch (\Exception $e) { @@ -731,8 +741,9 @@ class LinksData } fclose($fp); } - - self::saveLinksInFile($book_id, backpack_user() ? backpack_user()->id : 0, 'Links imported from PDF', $links); + // throw new \Exception(":/ " . count($links) . ' // ' . json_encode($book->getComposition())); + self::saveLinksInFile($book_id, backpack_user() ? backpack_user()->id : 0, 'Links imported from PDF (Documents ' . implode(', ', $docs).')', $links); + return true; } public static function getLinksAndRulersFromExcelFile($path, &$links, &$rulers) diff --git a/app/Models/FluidbookPublication.php b/app/Models/FluidbookPublication.php index de1f203c4..b24e6ecd8 100644 --- a/app/Models/FluidbookPublication.php +++ b/app/Models/FluidbookPublication.php @@ -339,8 +339,9 @@ class FluidbookPublication extends ToolboxStatusModel $this->generateThumbnailsPreview(); if ($this->_compositionUpdated) { FluidbookImagesPreprocess::dispatch($this->id); + FluidbookSocialImage::dispatch($this); } - FluidbookSocialImage::dispatch($this); + return parent::onSaved(); } @@ -384,7 +385,7 @@ class FluidbookPublication extends ToolboxStatusModel if (null !== $this->composition) { $this->c_pages = count($this->getComposition()); } else { - Log::warning('Fluidbook ' . $this->id . ' has empty composition'); + //Log::warning('Fluidbook ' . $this->id . ' has empty composition'); } } @@ -854,7 +855,7 @@ class FluidbookPublication extends ToolboxStatusModel public function replicateSettings(array $except = null) { - $new = $this->_baseReplicate($except); + $new = $this->_baseReplicate(array_merge($except ?? [], ['composition'])); $new->composition = []; $new->save(); @@ -1139,7 +1140,7 @@ class FluidbookPublication extends ToolboxStatusModel protected function _getCompositionAttribute($name) { if (null === $this->_fluidbookToUseForComposition) { - if ($this->composition_fluidbook) { + if ($this->composition_fluidbook && $this->composition_fluidbook_id) { $this->_fluidbookToUseForComposition = FluidbookPublication::withoutGlobalScopes()->find($this->composition_fluidbook_id); } else { $this->_fluidbookToUseForComposition = $this; diff --git a/composer.lock b/composer.lock index 606d27937..5a98cad96 100644 --- a/composer.lock +++ b/composer.lock @@ -1960,13 +1960,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/cubist_cms-back.git", - "reference": "f8bde0ce73872d1ddcc803d852130747a77bd337" + "reference": "b3f31479e39bd6b09ff3e419a3673d0560615a46" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-d8204e.tar", - "reference": "f8bde0ce73872d1ddcc803d852130747a77bd337", - "shasum": "4e2fc55ca5c327fb7ebc2ab15f25d4b348b75e10" + "url": "https://composer.cubedesigners.com/dist/cubist/cms-back/cubist-cms-back-dev-master-3e17d0.tar", + "reference": "b3f31479e39bd6b09ff3e419a3673d0560615a46", + "shasum": "f6971efdb4bb4ff5cfa03ca519cbe18e99e3ae62" }, "require": { "backpack/backupmanager": "^v3.0.9", @@ -2045,7 +2045,7 @@ } ], "description": "Cubist Backpack extension", - "time": "2024-11-25T12:49:19+00:00" + "time": "2025-01-31T19:07:27+00:00" }, { "name": "cubist/cms-front", @@ -4121,13 +4121,13 @@ "source": { "type": "git", "url": "git://git.cubedesigners.com/fluidbook_tools.git", - "reference": "d83448e998295ff432eabecece03cb29f5624e4d" + "reference": "09ed0ad1ac1a483b4b0249cd7b7700af147c631b" }, "dist": { "type": "tar", - "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-f65c1b.tar", - "reference": "d83448e998295ff432eabecece03cb29f5624e4d", - "shasum": "bd719aa721fb1c8b7966dea37e63b576889b7cd9" + "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-860327.tar", + "reference": "09ed0ad1ac1a483b4b0249cd7b7700af147c631b", + "shasum": "fcdd63b3516f3c263e1aed4856301f1d53278530" }, "require": { "barryvdh/laravel-debugbar": "*", @@ -4163,7 +4163,7 @@ } ], "description": "Fluidbook Tools", - "time": "2024-12-11T18:07:06+00:00" + "time": "2025-02-07T15:52:53+00:00" }, { "name": "fpdf/fpdf", @@ -4758,16 +4758,16 @@ }, { "name": "guzzlehttp/uri-template", - "version": "v1.0.3", + "version": "v1.0.4", "source": { "type": "git", "url": "https://github.com/guzzle/uri-template.git", - "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c" + "reference": "30e286560c137526eccd4ce21b2de477ab0676d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/uri-template/zipball/ecea8feef63bd4fef1f037ecb288386999ecc11c", - "reference": "ecea8feef63bd4fef1f037ecb288386999ecc11c", + "url": "https://api.github.com/repos/guzzle/uri-template/zipball/30e286560c137526eccd4ce21b2de477ab0676d2", + "reference": "30e286560c137526eccd4ce21b2de477ab0676d2", "shasum": "" }, "require": { @@ -4824,7 +4824,7 @@ ], "support": { "issues": "https://github.com/guzzle/uri-template/issues", - "source": "https://github.com/guzzle/uri-template/tree/v1.0.3" + "source": "https://github.com/guzzle/uri-template/tree/v1.0.4" }, "funding": [ { @@ -4840,7 +4840,7 @@ "type": "tidelift" } ], - "time": "2023-12-03T19:50:20+00:00" + "time": "2025-02-03T10:55:03+00:00" }, { "name": "hollodotme/fast-cgi-client", @@ -5523,16 +5523,16 @@ }, { "name": "laravel/framework", - "version": "v10.48.27", + "version": "v10.48.28", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "eb0be33e4b806b92f396357b99ffcb2d3ef67957" + "reference": "e714e7e0c1ae51bf747e3df5b10fa60c54e3e0e1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/eb0be33e4b806b92f396357b99ffcb2d3ef67957", - "reference": "eb0be33e4b806b92f396357b99ffcb2d3ef67957", + "url": "https://api.github.com/repos/laravel/framework/zipball/e714e7e0c1ae51bf747e3df5b10fa60c54e3e0e1", + "reference": "e714e7e0c1ae51bf747e3df5b10fa60c54e3e0e1", "shasum": "" }, "require": { @@ -5726,7 +5726,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2025-01-24T16:17:36+00:00" + "time": "2025-01-31T10:04:17+00:00" }, { "name": "laravel/prompts", @@ -10444,24 +10444,24 @@ }, { "name": "spatie/laravel-honeypot", - "version": "4.5.3", + "version": "4.5.4", "source": { "type": "git", "url": "https://github.com/spatie/laravel-honeypot.git", - "reference": "57727836997ae7351a4f56008bbaf4e2801ce4a0" + "reference": "b9bf50effce4c403cd3ac59f69266225498f3a2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-honeypot/zipball/57727836997ae7351a4f56008bbaf4e2801ce4a0", - "reference": "57727836997ae7351a4f56008bbaf4e2801ce4a0", + "url": "https://api.github.com/repos/spatie/laravel-honeypot/zipball/b9bf50effce4c403cd3ac59f69266225498f3a2e", + "reference": "b9bf50effce4c403cd3ac59f69266225498f3a2e", "shasum": "" }, "require": { - "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0", - "illuminate/encryption": "^8.0|^9.0|^10.0|^11.0", - "illuminate/http": "^8.0|^9.0|^10.0|^11.0", - "illuminate/support": "^8.0|^9.0|^10.0|^11.0", - "illuminate/validation": "^8.0|^9.0|^10.0|^11.0", + "illuminate/contracts": "^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/encryption": "^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/http": "^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/support": "^8.0|^9.0|^10.0|^11.0|^12.0", + "illuminate/validation": "^8.0|^9.0|^10.0|^11.0|^12.0", "nesbot/carbon": "^2.0|^3.0", "php": "^8.0", "spatie/laravel-package-tools": "^1.9", @@ -10469,9 +10469,9 @@ }, "require-dev": { "livewire/livewire": "^2.10|^3.0", - "orchestra/testbench": "^6.23|^7.0|^8.0|^9.0", - "pestphp/pest-plugin-livewire": "^1.0|^2.1", - "phpunit/phpunit": "^9.6|^10.5", + "orchestra/testbench": "^6.23|^7.0|^8.0|^9.0|^10.0", + "pestphp/pest-plugin-livewire": "^1.0|^2.1|^3.0", + "phpunit/phpunit": "^9.6|^10.5|^11.5", "spatie/pest-plugin-snapshots": "^1.1|^2.1", "spatie/phpunit-snapshot-assertions": "^4.2|^5.1", "spatie/test-time": "^1.2.1" @@ -10508,7 +10508,7 @@ "spatie" ], "support": { - "source": "https://github.com/spatie/laravel-honeypot/tree/4.5.3" + "source": "https://github.com/spatie/laravel-honeypot/tree/4.5.4" }, "funding": [ { @@ -10516,7 +10516,7 @@ "type": "custom" } ], - "time": "2024-09-20T13:45:00+00:00" + "time": "2025-02-06T11:53:12+00:00" }, { "name": "spatie/laravel-medialibrary", @@ -10628,27 +10628,27 @@ }, { "name": "spatie/laravel-package-tools", - "version": "1.18.3", + "version": "1.19.0", "source": { "type": "git", "url": "https://github.com/spatie/laravel-package-tools.git", - "reference": "ba67eee37d86ed775dab7dad58a7cbaf9a6cfe78" + "reference": "1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/ba67eee37d86ed775dab7dad58a7cbaf9a6cfe78", - "reference": "ba67eee37d86ed775dab7dad58a7cbaf9a6cfe78", + "url": "https://api.github.com/repos/spatie/laravel-package-tools/zipball/1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa", + "reference": "1c9c30ac6a6576b8d15c6c37b6cf23d748df2faa", "shasum": "" }, "require": { - "illuminate/contracts": "^9.28|^10.0|^11.0", + "illuminate/contracts": "^9.28|^10.0|^11.0|^12.0", "php": "^8.0" }, "require-dev": { "mockery/mockery": "^1.5", - "orchestra/testbench": "^7.7|^8.0|^9.0", - "pestphp/pest": "^1.22|^2", - "phpunit/phpunit": "^9.5.24|^10.5", + "orchestra/testbench": "^7.7|^8.0|^9.0|^10.0", + "pestphp/pest": "^1.23|^2.1|^3.1", + "phpunit/phpunit": "^9.5.24|^10.5|^11.5", "spatie/pest-plugin-test-time": "^1.1|^2.2" }, "type": "library", @@ -10676,7 +10676,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-package-tools/issues", - "source": "https://github.com/spatie/laravel-package-tools/tree/1.18.3" + "source": "https://github.com/spatie/laravel-package-tools/tree/1.19.0" }, "funding": [ { @@ -10684,7 +10684,7 @@ "type": "github" } ], - "time": "2025-01-22T08:51:18+00:00" + "time": "2025-02-06T14:58:20+00:00" }, { "name": "spatie/laravel-permission", @@ -10844,16 +10844,16 @@ }, { "name": "spatie/laravel-translatable", - "version": "6.9.3", + "version": "6.10.2", "source": { "type": "git", "url": "https://github.com/spatie/laravel-translatable.git", - "reference": "5f0712701a71054ba9bd6693808c4748f1f4ebda" + "reference": "6150f6d55f4712279883d56490406f8a92a9c72a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/5f0712701a71054ba9bd6693808c4748f1f4ebda", - "reference": "5f0712701a71054ba9bd6693808c4748f1f4ebda", + "url": "https://api.github.com/repos/spatie/laravel-translatable/zipball/6150f6d55f4712279883d56490406f8a92a9c72a", + "reference": "6150f6d55f4712279883d56490406f8a92a9c72a", "shasum": "" }, "require": { @@ -10915,7 +10915,7 @@ ], "support": { "issues": "https://github.com/spatie/laravel-translatable/issues", - "source": "https://github.com/spatie/laravel-translatable/tree/6.9.3" + "source": "https://github.com/spatie/laravel-translatable/tree/6.10.2" }, "funding": [ { @@ -10923,7 +10923,7 @@ "type": "github" } ], - "time": "2024-12-16T12:58:20+00:00" + "time": "2025-02-03T08:49:09+00:00" }, { "name": "spatie/pdf-to-image", @@ -15362,16 +15362,16 @@ }, { "name": "composer/class-map-generator", - "version": "1.5.0", + "version": "1.6.0", "source": { "type": "git", "url": "https://github.com/composer/class-map-generator.git", - "reference": "4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915" + "reference": "ffe442c5974c44a9343e37a0abcb1cc37319f5b9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/class-map-generator/zipball/4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915", - "reference": "4b0a223cf5be7c9ee7e0ef1bc7db42b4a97c9915", + "url": "https://api.github.com/repos/composer/class-map-generator/zipball/ffe442c5974c44a9343e37a0abcb1cc37319f5b9", + "reference": "ffe442c5974c44a9343e37a0abcb1cc37319f5b9", "shasum": "" }, "require": { @@ -15415,7 +15415,7 @@ ], "support": { "issues": "https://github.com/composer/class-map-generator/issues", - "source": "https://github.com/composer/class-map-generator/tree/1.5.0" + "source": "https://github.com/composer/class-map-generator/tree/1.6.0" }, "funding": [ { @@ -15431,7 +15431,7 @@ "type": "tidelift" } ], - "time": "2024-11-25T16:11:06+00:00" + "time": "2025-02-05T10:05:34+00:00" }, { "name": "doctrine/instantiator", -- 2.39.5