]> _ Git - fluidbook-toolbox.git/commitdiff
wip #7868 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Feb 2026 19:34:05 +0000 (20:34 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Feb 2026 19:34:05 +0000 (20:34 +0100)
app/Jobs/AuditLinkRegister.php

index a94b45d59c40848036bbd8392e53c62e12d34c96..9458495d6f59c54a2b92fbf3d4f7783ec9b0d12c 100644 (file)
@@ -8,7 +8,7 @@ use App\Models\FluidbookPublication;
 use App\Models\FluidbookCollection;
 use Fluidbook\Tools\Links\Link as LinkAlias;
 use Illuminate\Support\Arr;
-use Illuminate\Support\Facades\Log;
+use Illuminate\Support\Facades\DB;
 
 class AuditLinkRegister extends Base
 {
@@ -26,6 +26,15 @@ class AuditLinkRegister extends Base
         foreach ($collections as $collection) {
             $publications = array_merge($publications, $collection->getFluidbooksID());
         }
+
+        // Add fluidbooks that have enabled linkShortener
+        foreach (DB::table('fluidbook_publication')->get() as $p) {
+            $s = json_decode($p->settings);
+            if (isset($s->linkShortener) && $s->linkShortener && $s->linkShortener !== 'none') {
+                $publications[] = $s->id;
+            }
+        }
+
         // Nécessaire pour vérifier si la liste des fluidbooks fourni par les collections
         // existent vraiment ou s'ils ont été supprimé sans être supprimé dans la collection
         $publications = FluidbookPublication::whereIn('id', $publications)->pluck('id');
@@ -84,7 +93,7 @@ class AuditLinkRegister extends Base
             if (count($externalLinks) > 0) {
                 FluidbookAuditLink::insert($externalLinks);
             }
-            Log::info('Parsed fluidbook ' . $publication . ' : found ' . count($externalLinks) . ' links');
+            //Log::info('Parsed fluidbook ' . $publication . ' : found ' . count($externalLinks) . ' links');
         }
 
         // Delete links that are not anymore in the fluidbooks
@@ -94,9 +103,7 @@ class AuditLinkRegister extends Base
             FluidbookAuditLink::where('fluidbook_id', $e[0])->where('link_id', $e[1])->delete();
 
         }
-        Log::info('Deleted ' . count($missing) . ' links');
-
-
-        Log::info('Job exécuté avec succès');
+        //Log::info('Deleted ' . count($missing) . ' links');
+        //Log::info('Job exécuté avec succès');
     }
 }