--- /dev/null
+<?php
+
+namespace App\Console\Commands;
+
+use App\Console\Commands\Base\ToolboxCommand;
+use App\Models\FluidbookCollection;
+use App\Models\FluidbookAuditLink;
+use App\Models\FluidbookPublication;
+
+class AddFluidbookHemsleyToCollection extends ToolboxCommand
+{
+ /**
+ * The name and signature of the console command.
+ *
+ * @var string
+ */
+ protected $signature = 'fluidbook:fill-hemsley-collection {--sync}';
+
+ /**
+ * The console command description.
+ *
+ * @var string
+ */
+ protected $description = '';
+
+ /**
+ * Execute the console command.
+ */
+ public function handle()
+ {
+ //
+ $data = FluidbookPublication::getFluidbooksHemsley();
+ FluidbookCollection::updateHemsleyCollection($data);
+ }
+}
//
$c = FluidbookCollection::find($this->argument('id'));
$c->runAuditLink($this->option('sync', false));
- //$f->generateThumbnailsPreview($this->option('sync', false));
}
}
+++ /dev/null
-<?php
-
-namespace App\Console\Commands;
-
-use App\Console\Commands\Base\ToolboxCommand;
-use App\Models\FluidbookCollection;
-use App\Models\FluidbookAuditLink;
-use App\Models\FluidbookPublication;
-
-class addFluidbookHemsleyToCollection extends ToolboxCommand
-{
- /**
- * The name and signature of the console command.
- *
- * @var string
- */
- protected $signature = 'fluidbook:fill-hemsley-collection {--sync}';
-
- /**
- * The console command description.
- *
- * @var string
- */
- protected $description = '';
-
- /**
- * Execute the console command.
- */
- public function handle()
- {
- //
- //$f->generateThumbnailsPreview($this->option('sync', false));
- $data = FluidbookPublication::getFluidbooksHemsley();
- FluidbookCollection::updateHemsleyCollection($data);
- }
-}
// 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 : "",
}
}
- $audit = FluidbookAuditLink::insert($externalLinks);
+ FluidbookAuditLink::updateOrCreate($externalLinks);
Log::info('Job exécuté avec succès');
}