]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7309 @3
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Feb 2025 20:53:23 +0000 (21:53 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 7 Feb 2025 20:53:23 +0000 (21:53 +0100)
app/Fluidbook/Link/LinksData.php
app/Models/FluidbookPublication.php
composer.lock

index 6b09bf478ac1b4d0e0c87a10fc1aa09f05edb209..dd439c752019f8ec4af991d3bba33952e50e46f0 100644 (file)
@@ -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)
index de1f203c4e8efebd16bee00a3c617871a36266a0..b24e6ecd824c941906f4a998dbb755900cb4fec3 100644 (file)
@@ -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;
index 606d279370bee1e529bc3e5bae2cf275b73d6a4d..5a98cad968cb24df18c0c9767975424705558c7d 100644 (file)
             "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",
                 }
             ],
             "description": "Cubist Backpack extension",
-            "time": "2024-11-25T12:49:19+00:00"
+            "time": "2025-01-31T19:07:27+00:00"
         },
         {
             "name": "cubist/cms-front",
             "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": "*",
                 }
             ],
             "description": "Fluidbook Tools",
-            "time": "2024-12-11T18:07:06+00:00"
+            "time": "2025-02-07T15:52:53+00:00"
         },
         {
             "name": "fpdf/fpdf",
         },
         {
             "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": {
             ],
             "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": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2023-12-03T19:50:20+00:00"
+            "time": "2025-02-03T10:55:03+00:00"
         },
         {
             "name": "hollodotme/fast-cgi-client",
         },
         {
             "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": {
                 "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",
         },
         {
             "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",
             },
             "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"
                 "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": [
                 {
                     "type": "custom"
                 }
             ],
-            "time": "2024-09-20T13:45:00+00:00"
+            "time": "2025-02-06T11:53:12+00:00"
         },
         {
             "name": "spatie/laravel-medialibrary",
         },
         {
             "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",
             ],
             "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": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2025-01-22T08:51:18+00:00"
+            "time": "2025-02-06T14:58:20+00:00"
         },
         {
             "name": "spatie/laravel-permission",
         },
         {
             "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": {
             ],
             "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": [
                 {
                     "type": "github"
                 }
             ],
-            "time": "2024-12-16T12:58:20+00:00"
+            "time": "2025-02-03T08:49:09+00:00"
         },
         {
             "name": "spatie/pdf-to-image",
         },
         {
             "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": {
             ],
             "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": [
                 {
                     "type": "tidelift"
                 }
             ],
-            "time": "2024-11-25T16:11:06+00:00"
+            "time": "2025-02-05T10:05:34+00:00"
         },
         {
             "name": "doctrine/instantiator",