Add CLI audit command docs

This commit is contained in:
2026-04-17 07:56:10 +02:00
parent cdd42a0186
commit f02ea9a711
3 changed files with 352 additions and 3 deletions

View File

@@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Illuminate\Console\Command;
final class CheckArtworkUserIdsCommand extends Command
{
protected $signature = 'artworks:check-user-ids
{--chunk=1000 : Number of artworks to process per chunk}
{--show-missing=25 : Maximum number of missing references to print}
{--artwork-id= : Only check this specific artwork ID}
{--json : Output the summary as JSON}';
protected $description = 'Check whether every artworks.user_id exists in the users table.';
public function handle(): int
{
$options = [
'--chunk' => (string) max(1, (int) $this->option('chunk')),
'--show-missing' => (string) max(0, (int) $this->option('show-missing')),
];
if ($this->option('artwork-id') !== null) {
$options['--artwork-id'] = (string) (int) $this->option('artwork-id');
}
if ((bool) $this->option('json')) {
$options['--json'] = true;
}
return $this->call('artworks:check-user-refs', $options);
}
}