]> _ Git - psq.git/commitdiff
try #7454 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 May 2025 09:58:28 +0000 (11:58 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 7 May 2025 09:58:28 +0000 (11:58 +0200)
app/Console/Commands/ConvertArchivesToFluidbook.php

index 6407409ea3d6bacb3badf4cff2c4cafc95d28951..4023cfebc4a0f6746e42a70246dc1c235d68727b 100644 (file)
@@ -5,6 +5,7 @@ namespace App\Console\Commands;
 use App\PdfFile;
 use Fluidbook\ToolboxApiClient\Client;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Cache;
 
 class ConvertArchivesToFluidbook extends Command
 {
@@ -15,8 +16,13 @@ class ConvertArchivesToFluidbook extends Command
         $client = new Client(config('fluidbook.api_token'));
         /** @var PdfFile $pdf */
         foreach (PdfFile::all() as $pdf) {
+            $cacheKey = "fluidbook_done_{$pdf->slug}";
+            if (Cache::has($cacheKey)) {
+                continue;
+            }
             $fluidbook = $client->getFluidbookByReference($pdf->slug);
             if ($fluidbook) {
+                Cache::forever($cacheKey, true);
                 continue;
             }
             $path = \Storage::disk('local')->path($pdf->pdfPath);
@@ -28,6 +34,7 @@ class ConvertArchivesToFluidbook extends Command
                 $pdf->slug,
                 ['reference' => $pdf->slug]
             );
+            Cache::forever($cacheKey, true);
             return;
         }
     }