]> _ Git - fluidbook-toolbox.git/commitdiff
wait #6846 @2.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 3 Apr 2024 12:26:09 +0000 (14:26 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 3 Apr 2024 12:26:09 +0000 (14:26 +0200)
app/Fluidbook/PDF.php
app/Models/FluidbookPublication.php

index 19a82d510c82c28c39f60da9d61b831176953e1c..99c1718a15d635790e5b744eefcc50d45fb98612 100644 (file)
@@ -30,10 +30,12 @@ class PDF
         $compressedPDF = $cacheDir . 'compressed.pdf';
         $onlytextsPDF = $cacheDir . 'onlytexts.pdf';
 
-        $files = [$normalPDF, $originalPDF, $compressedPDF];
+        $files = [$normalPDF, $originalPDF, $compressedPDF, $onlytextsPDF];
 
         foreach ($files as $file) {
-            if (file_exists($file) && filesize($file) == 0) {
+            if (is_link($file)) {
+                unlink($file);
+            } else if (file_exists($file) && filesize($file) == 0) {
                 unlink($file);
             }
         }
@@ -181,8 +183,9 @@ class PDF
         if ($type === 'original') {
             return $originalPDF;
         } else if ($type === 'onlytexts') {
-            if (!file_exists($onlytextsPDF) || !filesize($onlytextsPDF) || filemtime($originalPDF) > filemtime($onlytextsPDF)) {
+            if (!file_exists($onlytextsPDF) || !filesize($onlytextsPDF) || filemtime($originalPDF) !== filemtime($onlytextsPDF)) {
                 PDFTools::filter($originalPDF, $onlytextsPDF, false, false, true);
+                touch($onlytextsPDF, filemtime($originalPDF));
             }
             return $onlytextsPDF;
         }
index b3e6e62b6f82627b0cefac647cb164539c66f924..545468dce5c1f2d5603213ab1a03b5db34e1ac16 100644 (file)
@@ -1124,6 +1124,7 @@ class FluidbookPublication extends ToolboxStatusModel
                 $this->{$n} = $f->getAttribute('default');
             }
         }
+        $this->svgToCanvas = !$this->svgToCanvas ? 0 : 1;
         $this->save();
 
         DB::update('UPDATE ' . WorkshopMigration::OLD_DB . '.books SET version=' . $version . ' WHERE book_id=' . $this->id);