]> _ Git - fluidbook-toolbox.git/commitdiff
wip #5393 @0:10
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 24 Jul 2023 07:16:42 +0000 (09:16 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 24 Jul 2023 07:16:42 +0000 (09:16 +0200)
app/Http/Controllers/Admin/Operations/FluidbookPublication/PreviewOperation.php
app/Jobs/Maintenance/CheckPublicationsHashAndCid.php

index 6c1d8cee9111a2c2537b0f31932c3b56c0b472e8..82510514928dbacf787fbb8ab66b91d8063e5a00 100644 (file)
@@ -100,6 +100,9 @@ trait PreviewOperation
         PHP::neverStop(false);
 
         self::_getFluidbookAndTheme($id, $hash, $fluidbook, $theme);
+        if (null === $theme || null === $fluidbook) {
+            abort(404);
+        }
         $res = $this->_loadingCompile($theme, $fluidbook->title, $url);
         return response($res);
     }
index 1e2b0054ff8bb62935660d5591643bd2a09947c0..2bfe24931dc3afdbc6646618a9747a7d3ffadbb9 100644 (file)
@@ -11,7 +11,9 @@ class CheckPublicationsHashAndCid extends Base
     public function handle()
     {
         /** @var FluidbookPublication $fluidbook */
-        foreach (FluidbookPublication::withoutGlobalScopes()->where('created_ok', '1')->whereNull('hash')->orWhere('hash', '')->orWhereNull('cid')->orWhere('cid', '')->get() as $fluidbook) {
+        foreach (FluidbookPublication::withoutGlobalScopes()->where('created_ok', '1')->where(function ($query) {
+            $query->whereNull('hash')->orWhere('hash', '')->orWhereNull('cid')->orWhere('cid', '');
+        })->get() as $fluidbook) {
             Log::warning('Fluidbook #' . $fluidbook->id . ' had empty hash or cid (hash: hash , cid: :cid)', ['hash' => $fluidbook->hash, 'cid' => $fluidbook->cid]);
             $fluidbook->save();
         }