]> _ Git - fluidbook-toolbox.git/commitdiff
#7894 @1.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jan 2026 19:01:47 +0000 (20:01 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Thu, 15 Jan 2026 19:01:47 +0000 (20:01 +0100)
app/Fluidbook/Compiler/Links.php
app/Jobs/BaseStatus.php
app/Jobs/FluidbookDocumentFileProcess.php
app/Jobs/FluidbookImagesPreprocess.php
app/Jobs/OCR.php
composer.lock

index 7252b66dd08f6e51c125e6e831ca475858be4847..2d7c689591e56387ad230c9163daee5705f94864 100644 (file)
@@ -557,7 +557,11 @@ trait Links
             }
 
             if ($returnJobs) {
-                $res[] = new OCR($file, $this->getFluidbook()->locale);
+                $j = new OCR($file, $this->getFluidbook()->locale);
+                if ($j->isOK()) {
+                    continue;
+                }
+                $res[] = $j;
             } else {
                 $res .= Farm::OCR($file, $this->getFluidbook()->locale);
             }
index 25f05fa960c835ee90056da9f613f0e6cb304a3c..79355b1ef1a98eafaa2fdbbd6f8595a7e271e27c 100644 (file)
@@ -11,16 +11,28 @@ abstract class BaseStatus extends Base
 
     public function setFinish($finish = true)
     {
-        Cache::put($this->_cacheKey(), $finish, 1200);
+        Cache::put($this->_cacheKey(), $finish, 3600);
     }
 
-
     public function isFinish()
     {
         return Cache::get($this->_cacheKey(), false);
     }
 
-    public function isDone()
+    /**
+     * @return boolean
+     */
+    public function isDone($forceCheck = false)
+    {
+        return $this->isFinish() || $this->isOK($forceCheck);
+    }
+
+    public function isError()
+    {
+        return $this->isFinish() && !$this->isOK();
+    }
+
+    public function isOK($forceCheck = false)
     {
         return $this->isFinish();
     }
index 79abfb8991174ac92604a8382e74463a616f1b44..f4134492cee82c97d1d9ea9cad40edd0607c7c48 100644 (file)
@@ -60,24 +60,12 @@ class FluidbookDocumentFileProcess extends BaseStatus
         return 'job_' . $this->path;
     }
 
-    /**
-     * @return boolean
-     */
-    public function isDone($forceCheck = false)
-    {
-        return $this->isFinish() || $this->isOK($forceCheck);
-    }
 
     public function isOK($forceCheck = false)
     {
         return $this->document->hasFile($this->page, $this->format, $this->resolution, $this->quality, $this->withText, $this->withGraphics, $this->transparent, $this->version, $this->forceCheck || $forceCheck);
     }
 
-    public function isError()
-    {
-        return $this->isFinish() && !$this->isOK();
-    }
-
     /**
      * @return mixed|string
      */
index d039d8d835eb92701794430f857d3feaf3b2b688..9b8cb5fc3f445a0a8b4f9c482a9fd6fa44b96cf6 100644 (file)
@@ -66,20 +66,20 @@ class FluidbookImagesPreprocess extends Base
             $imdir = 'html';
         }
 
-        for ($page = 1; $page <= $this->book->getPagesNumber(); $page++) {
-            $thisrasterize = in_array($page, $rasterizePages);
-            $thisimagesvg = !$thisrasterize && $svg;
-            $pageBackgroundsToGenerate = $thisrasterize ? [true] : $globalBackgroundToGenerate;
-            foreach ($resolutions as $r) {
-                foreach ($pageBackgroundsToGenerate as $withText) {
-                    $this->getFile($page, $settings->imageFormat, $r, $withText, true, $transparent, $imdir);
-                }
-            }
-            if ($thisimagesvg) {
-                $this->getFile($page, 'svg', 150, true, in_array($page, $vectorPages), false, 'html');
-            }
-            $this->getFile($page, $settings->imageFormat, 'thumb');
-        }
+//        for ($page = 1; $page <= $this->book->getPagesNumber(); $page++) {
+//            $thisrasterize = in_array($page, $rasterizePages);
+//            $thisimagesvg = !$thisrasterize && $svg;
+//            $pageBackgroundsToGenerate = $thisrasterize ? [true] : $globalBackgroundToGenerate;
+//            foreach ($resolutions as $r) {
+//                foreach ($pageBackgroundsToGenerate as $withText) {
+//                    $this->getFile($page, $settings->imageFormat, $r, $withText, true, $transparent, $imdir);
+//                }
+//            }
+//            if ($thisimagesvg) {
+//                $this->getFile($page, 'svg', 150, true, in_array($page, $vectorPages), false, 'html');
+//            }
+//            $this->getFile($page, $settings->imageFormat, 'thumb');
+//        }
 
         $this->book->getLinksAndRulers($links, $rulers);
         $compiler = new Compiler($this->book);
@@ -93,7 +93,8 @@ class FluidbookImagesPreprocess extends Base
             if (!$jobs) {
                 continue;
             }
-            $this->jobs += $jobs;
+            $this->jobs = array_merge($this->jobs, $jobs);
+
             foreach ($jobs as $job) {
                 if ($this->_sync) {
                     $job->handle();
@@ -118,6 +119,7 @@ class FluidbookImagesPreprocess extends Base
         $done = 0;
         $error = 0;
 
+
         foreach ($this->jobs as $job) {
             if ($job->isDone()) {
                 $done++;
index ffe713db4b13c47e7eb650fbb41b17a2e25ef63f..90f7ce402784db9229ee86d4c5f9363f10847c1f 100644 (file)
@@ -3,6 +3,7 @@
 namespace App\Jobs;
 
 use App\Fluidbook\Farm;
+use Cubist\Util\CommandLine\Docling;
 
 class OCR extends BaseStatus
 {
@@ -19,11 +20,27 @@ class OCR extends BaseStatus
     public function handle()
     {
         Farm::OCR($this->file, $this->locale);
-        $this->setFinish();
+    }
+
+    public function isDone($forceCheck = false)
+    {
+        return $this->isOK($forceCheck);
+    }
+
+    public function isOK($forceCheck = false)
+    {
+        return Docling::isCached($this->file, $this->locale);
+    }
+
+    public function isFinish()
+    {
+        return false;
     }
 
     protected function _cacheKey(): string
     {
-        return 'job_ocr_' . $this->file . '_' . ($this->locale ?? '');
+        $res= 'job_ocr_' . $this->file . '_' . ($this->locale ?? '');
+        return $res;
     }
+
 }
index 4bd8bb6a54a8946ae7e313ae103e450c4ff595a8..e5c442101e2eb7aed6a005a1736a57be7bd6a3b4 100644 (file)
         },
         {
             "name": "aws/aws-sdk-php",
-            "version": "3.369.12",
+            "version": "3.369.13",
             "source": {
                 "type": "git",
                 "url": "https://github.com/aws/aws-sdk-php.git",
-                "reference": "36ee8894743a254ae2650bad4968c874b76bc7de"
+                "reference": "bedc36250c92b8287be855a2d25427fb0e065483"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/36ee8894743a254ae2650bad4968c874b76bc7de",
-                "reference": "36ee8894743a254ae2650bad4968c874b76bc7de",
+                "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/bedc36250c92b8287be855a2d25427fb0e065483",
+                "reference": "bedc36250c92b8287be855a2d25427fb0e065483",
                 "shasum": ""
             },
             "require": {
             "support": {
                 "forum": "https://github.com/aws/aws-sdk-php/discussions",
                 "issues": "https://github.com/aws/aws-sdk-php/issues",
-                "source": "https://github.com/aws/aws-sdk-php/tree/3.369.12"
+                "source": "https://github.com/aws/aws-sdk-php/tree/3.369.13"
             },
-            "time": "2026-01-13T19:12:08+00:00"
+            "time": "2026-01-14T19:13:46+00:00"
         },
         {
             "name": "backpack/backupmanager",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/cubist_util.git",
-                "reference": "1c47b1f5be2cd335d034a64fe10000e59473241f"
+                "reference": "65cd40762e14da2264dbf9a8a362cd3c4846cb4a"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-834a22.tar",
-                "reference": "1c47b1f5be2cd335d034a64fe10000e59473241f",
-                "shasum": "6b0e2cfc57d879e4114031ea3f019c179ab87ce6"
+                "url": "https://composer.cubedesigners.com/dist/cubist/util/cubist-util-dev-master-2e01d2.tar",
+                "reference": "65cd40762e14da2264dbf9a8a362cd3c4846cb4a",
+                "shasum": "a4c0d149a3ba22a2d929ba4cc785d2fbdfee00aa"
             },
             "require": {
                 "cubist/net": "dev-master",
                 }
             ],
             "description": "Utilities class",
-            "time": "2026-01-14T18:00:53+00:00"
+            "time": "2026-01-15T17:50:37+00:00"
         },
         {
             "name": "cviebrock/eloquent-sluggable",
             "source": {
                 "type": "git",
                 "url": "git://git.cubedesigners.com/fluidbook_tools.git",
-                "reference": "87006bd32ce4299a18924401eaa6c4b7a6bb26fa"
+                "reference": "86e6dfafcae904bf7a9e71e84785492a6331dc04"
             },
             "dist": {
                 "type": "tar",
-                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-af8ec1.tar",
-                "reference": "87006bd32ce4299a18924401eaa6c4b7a6bb26fa",
-                "shasum": "c9e07243c7a85d9bd00b1a2ee2810c8f4984b2fb"
+                "url": "https://composer.cubedesigners.com/dist/fluidbook/tools/fluidbook-tools-dev-master-ee535f.tar",
+                "reference": "86e6dfafcae904bf7a9e71e84785492a6331dc04",
+                "shasum": "e34ed35d3e10ac66d28537c9e04bfe07685cc29e"
             },
             "require": {
                 "barryvdh/laravel-debugbar": "*",
                 }
             ],
             "description": "Fluidbook Tools",
-            "time": "2026-01-14T16:56:21+00:00"
+            "time": "2026-01-15T16:03:49+00:00"
         },
         {
             "name": "fpdf/fpdf",