Restore toolbar background to bg-nebula; add toolbar backdrop blur

This commit is contained in:
2026-02-15 09:24:43 +01:00
parent 79192345e3
commit 9dbe848412
28 changed files with 736 additions and 110 deletions

View File

@@ -0,0 +1,58 @@
<?php
declare(strict_types=1);
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
use Illuminate\Support\Facades\DB;
function printSection($title) {
echo "\n===== $title =====\n";
}
printSection('Recent queued jobs (jobs table)');
$jobs = DB::table('jobs')->where('payload', 'like', '%AutoTagArtworkJob%')->orderByDesc('id')->limit(10)->get();
if (count($jobs) === 0) {
echo "No queued AutoTagArtworkJob entries found.\n";
} else {
foreach ($jobs as $j) {
echo "--- job id: {$j->id} | queued_at: " . ($j->available_at ?? $j->created_at ?? '') . "\n";
$payload = isset($j->payload) ? $j->payload : '';
echo substr($payload, 0, 2000) . "\n\n";
}
}
printSection('Recent failed jobs (failed_jobs table)');
$failed = DB::table('failed_jobs')->where('payload', 'like', '%AutoTagArtworkJob%')->orderByDesc('id')->limit(10)->get();
if (count($failed) === 0) {
echo "No failed AutoTagArtworkJob entries found.\n";
} else {
foreach ($failed as $f) {
echo "--- failed id: {$f->id} | connection: {$f->connection} | failed_at: {$f->failed_at}\n";
$payload = isset($f->payload) ? $f->payload : '';
echo substr($payload, 0, 2000) . "\n\n";
}
}
printSection('Recent Laravel logs (last 200 lines)');
$logs = glob(__DIR__ . '/../storage/logs/*.log');
if ($logs === false || count($logs) === 0) {
echo "No log files found.\n";
} else {
usort($logs, function($a, $b){ return filemtime($b) <=> filemtime($a); });
$latest = $logs[0];
echo "Latest log: " . basename($latest) . "\n\n";
$lines = file($latest, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if ($lines === false) {
echo "Unable to read log file.\n";
} else {
$tail = array_slice($lines, -200);
foreach ($tail as $line) {
echo $line . "\n";
}
}
}
echo "\nDone.\n";

View File

@@ -0,0 +1,138 @@
<?php
declare(strict_types=1);
use App\Models\Artwork;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$options = getopt('', ['id::', 'limit::', 'publish']);
$id = isset($options['id']) ? (int) $options['id'] : null;
$limit = isset($options['limit']) ? max(1, (int) $options['limit']) : 25;
$publish = array_key_exists('publish', $options);
$brokenQuery = Artwork::query()->where(function ($query): void {
$query->where('file_path', 'pending')
->orWhereNull('hash')
->orWhereNull('file_ext')
->orWhereNull('thumb_ext')
->orWhere('file_name', 'pending')
->orWhere('file_size', 0)
->orWhere('width', '<=', 1)
->orWhere('height', '<=', 1);
});
if ($id && $id > 0) {
$brokenQuery->whereKey($id);
}
$rows = $brokenQuery->orderBy('id')->limit($limit)->get();
if ($rows->isEmpty()) {
fwrite(STDOUT, "No matching broken artworks found.\n");
exit(0);
}
$storageRoot = rtrim((string) config('uploads.storage_root'), DIRECTORY_SEPARATOR);
$fixed = 0;
$skipped = 0;
$makeUniqueSlug = static function (Artwork $artwork, string $title): string {
$base = Str::slug($title);
if ($base === '') {
$base = 'artwork-' . $artwork->id;
}
$slug = $base;
$suffix = 2;
while (Artwork::query()->where('slug', $slug)->where('id', '!=', $artwork->id)->exists()) {
$slug = $base . '-' . $suffix;
$suffix++;
}
return $slug;
};
foreach ($rows as $artwork) {
$files = DB::table('artwork_files')
->where('artwork_id', $artwork->id)
->get(['variant', 'path', 'mime', 'size'])
->keyBy('variant');
$orig = $files->get('orig');
if (! $orig || empty($orig->path)) {
fwrite(STDOUT, "[SKIP] {$artwork->id}: no orig variant in artwork_files\n");
$skipped++;
continue;
}
$origPath = (string) $orig->path;
$absolute = $storageRoot . DIRECTORY_SEPARATOR . str_replace(['/', '\\\\'], DIRECTORY_SEPARATOR, $origPath);
$hash = null;
$fileSize = (int) ($orig->size ?? 0);
$width = (int) $artwork->width;
$height = (int) $artwork->height;
if (is_file($absolute)) {
$hash = hash_file('sha256', $absolute) ?: null;
$actualSize = @filesize($absolute);
if (is_int($actualSize) && $actualSize > 0) {
$fileSize = $actualSize;
}
$dimensions = @getimagesize($absolute);
if (is_array($dimensions) && isset($dimensions[0], $dimensions[1])) {
$width = max(1, (int) $dimensions[0]);
$height = max(1, (int) $dimensions[1]);
}
}
$ext = strtolower((string) pathinfo($origPath, PATHINFO_EXTENSION));
if ($ext === '') {
$ext = 'webp';
}
$title = trim((string) ($artwork->title ?? ''));
if ($title === '') {
$title = 'Artwork ' . $artwork->id;
}
$slug = $makeUniqueSlug($artwork, $title);
$updates = [
'title' => $title,
'slug' => $slug,
'file_name' => basename($origPath),
'file_path' => $origPath,
'file_size' => max(1, $fileSize),
'mime_type' => (string) ($orig->mime ?: 'image/webp'),
'hash' => $hash ?: (string) ($artwork->hash ?? ''),
'file_ext' => $ext,
'thumb_ext' => $ext,
'width' => max(1, $width),
'height' => max(1, $height),
];
if ($publish) {
$updates['is_public'] = true;
$updates['is_approved'] = true;
$updates['published_at'] = $artwork->published_at ?: now();
}
if (empty($updates['hash'])) {
fwrite(STDOUT, "[SKIP] {$artwork->id}: hash could not be recovered from file\n");
$skipped++;
continue;
}
Artwork::query()->whereKey($artwork->id)->update($updates);
fwrite(STDOUT, "[FIXED] {$artwork->id}: {$updates['file_path']} | hash=" . substr((string) $updates['hash'], 0, 12) . "...\n");
$fixed++;
}
fwrite(STDOUT, "Done. fixed={$fixed} skipped={$skipped}\n");
exit(0);

View File

@@ -0,0 +1,98 @@
<?php
declare(strict_types=1);
use App\Models\Artwork;
use Illuminate\Support\Carbon;
require __DIR__ . '/../vendor/autoload.php';
$app = require __DIR__ . '/../bootstrap/app.php';
$app->make(Illuminate\Contracts\Console\Kernel::class)->bootstrap();
$options = getopt('', ['id::', 'limit::']);
$id = isset($options['id']) ? (int) $options['id'] : null;
$limit = isset($options['limit']) ? max(1, (int) $options['limit']) : 5;
$query = Artwork::query()->orderByDesc('id');
if ($id && $id > 0) {
$query->whereKey($id);
}
$rows = $query->limit($limit)->get();
if ($rows->isEmpty()) {
fwrite(STDOUT, "No artwork rows found.\n");
exit(1);
}
$requiredFields = [
'title',
'slug',
'file_name',
'file_path',
'hash',
'file_ext',
'thumb_ext',
'mime_type',
'file_size',
'published_at',
];
$hasFailure = false;
foreach ($rows as $artwork) {
$missing = [];
foreach ($requiredFields as $field) {
$value = $artwork->{$field};
if ($value === null || $value === '' || $value === 'pending') {
$missing[] = $field;
}
}
if (! (bool) $artwork->is_public) {
$missing[] = 'is_public';
}
if (! (bool) $artwork->is_approved) {
$missing[] = 'is_approved';
}
if ((int) $artwork->width <= 1) {
$missing[] = 'width';
}
if ((int) $artwork->height <= 1) {
$missing[] = 'height';
}
$publishedAt = $artwork->published_at instanceof Carbon
? $artwork->published_at->toDateTimeString()
: (string) $artwork->published_at;
fwrite(STDOUT, str_repeat('-', 72) . "\n");
fwrite(STDOUT, "artwork_id: {$artwork->id}\n");
fwrite(STDOUT, "title : " . (string) $artwork->title . "\n");
fwrite(STDOUT, "slug : " . (string) $artwork->slug . "\n");
fwrite(STDOUT, "file_path : " . (string) $artwork->file_path . "\n");
fwrite(STDOUT, "hash : " . (string) $artwork->hash . "\n");
fwrite(STDOUT, "file_ext : " . (string) $artwork->file_ext . " | thumb_ext: " . (string) $artwork->thumb_ext . "\n");
fwrite(STDOUT, "visible : is_public=" . ((int) (bool) $artwork->is_public) . " is_approved=" . ((int) (bool) $artwork->is_approved) . "\n");
fwrite(STDOUT, "published : " . ($publishedAt !== '' ? $publishedAt : 'NULL') . "\n");
if ($missing !== []) {
$hasFailure = true;
fwrite(STDOUT, "status : FAIL (missing/invalid: " . implode(', ', array_unique($missing)) . ")\n");
} else {
fwrite(STDOUT, "status : OK\n");
}
}
fwrite(STDOUT, str_repeat('-', 72) . "\n");
if ($hasFailure) {
fwrite(STDOUT, "Result: FAIL\n");
exit(2);
}
fwrite(STDOUT, "Result: OK\n");
exit(0);