From 17fd5fd6363c9633bc3408bc9863e8360fb8cbf0 Mon Sep 17 00:00:00 2001 From: soufiane Date: Mon, 3 Nov 2025 19:21:16 +0100 Subject: [PATCH] wip #7819 --- ...ection.php => AddFluidbookHemsleyToCollection.php} | 3 +-- app/Console/Commands/AuditLink.php | 1 - app/Jobs/AuditLink.php | 11 ++++++----- 3 files changed, 7 insertions(+), 8 deletions(-) rename app/Console/Commands/{addFluidbookHemsleyToCollection.php => AddFluidbookHemsleyToCollection.php} (84%) diff --git a/app/Console/Commands/addFluidbookHemsleyToCollection.php b/app/Console/Commands/AddFluidbookHemsleyToCollection.php similarity index 84% rename from app/Console/Commands/addFluidbookHemsleyToCollection.php rename to app/Console/Commands/AddFluidbookHemsleyToCollection.php index f9bd9ca81..59ce4f5e0 100644 --- a/app/Console/Commands/addFluidbookHemsleyToCollection.php +++ b/app/Console/Commands/AddFluidbookHemsleyToCollection.php @@ -7,7 +7,7 @@ use App\Models\FluidbookCollection; use App\Models\FluidbookAuditLink; use App\Models\FluidbookPublication; -class addFluidbookHemsleyToCollection extends ToolboxCommand +class AddFluidbookHemsleyToCollection extends ToolboxCommand { /** * The name and signature of the console command. @@ -29,7 +29,6 @@ class addFluidbookHemsleyToCollection extends ToolboxCommand public function handle() { // - //$f->generateThumbnailsPreview($this->option('sync', false)); $data = FluidbookPublication::getFluidbooksHemsley(); FluidbookCollection::updateHemsleyCollection($data); } diff --git a/app/Console/Commands/AuditLink.php b/app/Console/Commands/AuditLink.php index 140c91d38..97c7ff856 100644 --- a/app/Console/Commands/AuditLink.php +++ b/app/Console/Commands/AuditLink.php @@ -30,6 +30,5 @@ class AuditLink extends ToolboxCommand // $c = FluidbookCollection::find($this->argument('id')); $c->runAuditLink($this->option('sync', false)); - //$f->generateThumbnailsPreview($this->option('sync', false)); } } diff --git a/app/Jobs/AuditLink.php b/app/Jobs/AuditLink.php index 0a2d35a53..e1dcb3d9a 100644 --- a/app/Jobs/AuditLink.php +++ b/app/Jobs/AuditLink.php @@ -42,14 +42,15 @@ class AuditLink extends Base // Error code start with 4 or 5 // Redirection code start with 3 $httpCode = FluidbookAuditLink::getHttpCode($link['to']); + $comment = FluidbookAuditLink::getHttpCodeComment($httpCode); $externalLinks[] = [ + 'link_id' => $link['uid'], 'fluidbook_id' => intval($publication['fluidbook']), 'page' => intval($link['page']), - 'link_id' => $link['uid'], - 'error_code' => str_starts_with($httpCode, 4) || str_starts_with($httpCode, 5) ? $httpCode : "", - 'first_time_error' => '', // Datetime of the first time we saw this error - 'last_date_test' => time(), + 'error_code' => str_starts_with($httpCode, 4) || str_starts_with($httpCode, 5) ? $httpCode.$comment : "", + 'first_time_error' => "", // Datetime of the first time we saw this error + 'last_date_test' => date('Y-m-d H:i:s'), 'url' => $link['to'], 'new_url' => '', 'redirection_code' => str_starts_with($httpCode, 3) ? $httpCode : "", @@ -61,7 +62,7 @@ class AuditLink extends Base } } - $audit = FluidbookAuditLink::insert($externalLinks); + FluidbookAuditLink::updateOrCreate($externalLinks); Log::info('Job exécuté avec succès'); } -- 2.39.5