Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
51
app/Support/Health/Checks/BrokenImages.php
Normal file
51
app/Support/Health/Checks/BrokenImages.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Support\Health\Checks;
|
||||
|
||||
use App\Models\Media;
|
||||
use App\Support\Health\Check;
|
||||
use App\Support\Health\Finding;
|
||||
use App\Support\Health\Severity;
|
||||
|
||||
/**
|
||||
* Images the site is publishing a URL for that no longer exist.
|
||||
*
|
||||
* The API keeps serving the path — it has no reason to doubt it — so the
|
||||
* result is a broken image on the public site and nothing at all in the panel,
|
||||
* where the record still looks complete. A file goes missing when a disk is
|
||||
* changed, a deploy wipes storage, or somebody tidies up by hand.
|
||||
*
|
||||
* Failures recorded by the processor count here too: an image it could not
|
||||
* read is one no visitor will see either.
|
||||
*/
|
||||
class BrokenImages implements Check
|
||||
{
|
||||
public function key(): string
|
||||
{
|
||||
return 'broken-images';
|
||||
}
|
||||
|
||||
public function permission(): ?string
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public function run(): Finding
|
||||
{
|
||||
$count = 0;
|
||||
$samples = [];
|
||||
|
||||
// Only what has been looked at: an image still queued is not broken,
|
||||
// it is early, and StalledMediaQueue is the check for that.
|
||||
foreach (Media::query()->whereNotNull('processed_at')->get() as $media) {
|
||||
if ($media->error !== null || ! $media->exists()) {
|
||||
$count++;
|
||||
$samples[] = $media->path;
|
||||
}
|
||||
}
|
||||
|
||||
return Finding::problem($this->key(), $count, Severity::Error, samples: $samples);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user