Plugins bei fehlender Klasse nicht dauerhaft deaktivieren, Speichern-Abstand im Admin, Profilbild-Fehlermeldung
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m4s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m8s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m32s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m35s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 5m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 5m1s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 5m30s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 5m31s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m26s
Some checks failed
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 3m4s
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 3m8s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 3m32s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 3m35s
CI / PHP 8.3 / mysql:8.0 (pull_request) Successful in 5m7s
CI / PHP 8.4 / mysql:8.0 (pull_request) Successful in 5m1s
CI / PHP 8.3 / mysql:8.4 (pull_request) Successful in 5m30s
CI / PHP 8.4 / mysql:8.4 (pull_request) Successful in 5m31s
CI / Build-Artefakte aktuell (pull_request) Failing after 1m26s
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
201c86d486
commit
293d7f86a4
104 changed files with 552 additions and 409 deletions
|
|
@ -11,8 +11,10 @@ use Illuminate\Http\RedirectResponse;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Validation\Rule;
|
||||
use Illuminate\Validation\Rules\File;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
use Throwable;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
|
|
@ -63,7 +65,17 @@ class ProfileController extends Controller
|
|||
'avatar' => ['required', File::image()->types(['jpg', 'jpeg', 'png', 'webp'])->max(8 * 1024)],
|
||||
]);
|
||||
|
||||
$avatars->store($request->user(), $request->file('avatar'));
|
||||
try {
|
||||
$avatars->store($request->user(), $request->file('avatar'));
|
||||
} catch (Throwable $e) {
|
||||
// Meist eine Server-Einschränkung (GD ohne WebP, Upload-Ordner schreibgeschützt,
|
||||
// zu wenig Speicher) – verständliche Meldung statt „500 Interner Fehler“.
|
||||
report($e);
|
||||
|
||||
throw ValidationException::withMessages([
|
||||
'avatar' => 'Das Bild konnte nicht gespeichert werden. Bitte ein anderes Foto versuchen oder die Administration informieren (Details unter „Systemzustand“ und im Fehlerprotokoll).',
|
||||
]);
|
||||
}
|
||||
|
||||
return back()->with('status', 'avatar-updated');
|
||||
}
|
||||
|
|
|
|||
14
app/Plugins/PluginClassMissing.php
Normal file
14
app/Plugins/PluginClassMissing.php
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
|
||||
namespace App\Plugins;
|
||||
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Die Plugin-Klasse fehlt – meist nur vorübergehend, weil gerade Dateien
|
||||
* aufgespielt werden. Anders als echte Fehler deaktiviert das das Plugin nicht.
|
||||
*/
|
||||
class PluginClassMissing extends RuntimeException
|
||||
{
|
||||
public const PREFIX = 'Plugin-Klasse ';
|
||||
}
|
||||
|
|
@ -164,6 +164,7 @@ class PluginManager
|
|||
public function registerAll(): void
|
||||
{
|
||||
$this->recoverFromCrash();
|
||||
$this->reenableAfterIncompleteUpload();
|
||||
|
||||
foreach ($this->bootOrder() as $manifest) {
|
||||
$this->guard($manifest, function () use ($manifest) {
|
||||
|
|
@ -323,7 +324,7 @@ class PluginManager
|
|||
private function instantiate(PluginManifest $manifest): Plugin
|
||||
{
|
||||
if (! class_exists($manifest->class)) {
|
||||
throw new RuntimeException("Plugin-Klasse {$manifest->class} nicht gefunden.");
|
||||
throw new PluginClassMissing(PluginClassMissing::PREFIX."{$manifest->class} nicht gefunden.");
|
||||
}
|
||||
|
||||
$plugin = new ($manifest->class)($this->app, $manifest);
|
||||
|
|
@ -369,6 +370,12 @@ class PluginManager
|
|||
|
||||
try {
|
||||
$callback();
|
||||
} catch (PluginClassMissing $e) {
|
||||
// Vorübergehend (z. B. während ein Update Dateien kopiert): nur diesen
|
||||
// Aufruf ohne das Plugin laufen lassen, nicht dauerhaft deaktivieren.
|
||||
unset($this->loaded[$manifest->slug]);
|
||||
$this->problems[$manifest->slug] = $e->getMessage();
|
||||
Log::warning("Plugin {$manifest->slug} konnte nicht geladen werden: ".$e->getMessage());
|
||||
} catch (Throwable $e) {
|
||||
unset($this->loaded[$manifest->slug]);
|
||||
$this->problems[$manifest->slug] = $e->getMessage();
|
||||
|
|
@ -398,6 +405,29 @@ class PluginManager
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Frühere Versionen haben ein Plugin dauerhaft deaktiviert, wenn seine Klasse
|
||||
* fehlte – typischerweise nur für einen Augenblick während des Aufspielens.
|
||||
* Ist die Datei inzwischen da, wird es wieder aktiviert.
|
||||
*/
|
||||
private function reenableAfterIncompleteUpload(): void
|
||||
{
|
||||
foreach ($this->all() as $manifest) {
|
||||
$reason = $this->state->disabledReason($manifest->slug);
|
||||
|
||||
if ($reason === null || ! str_starts_with($reason, 'Fehler beim Laden: '.PluginClassMissing::PREFIX)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$file = $manifest->path.'/src/'.str_replace('\\', '/', substr($manifest->class, strlen($manifest->namespace))).'.php';
|
||||
|
||||
if (is_file($file)) {
|
||||
$this->state->setEnabled($manifest->slug, true);
|
||||
Log::info("Plugin {$manifest->slug} wieder aktiviert (Klasse fehlte beim Aufspielen nur vorübergehend).");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function markerPath(string $slug): string
|
||||
{
|
||||
$dir = storage_path('framework/plugins');
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use Illuminate\Support\Str;
|
|||
use Intervention\Image\Drivers\Gd\Driver;
|
||||
use Intervention\Image\Encoders\WebpEncoder;
|
||||
use Intervention\Image\ImageManager;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* Speichert Profilbilder als quadratische WebP-Dateien in festen Größen.
|
||||
|
|
@ -53,7 +54,9 @@ class Avatars
|
|||
// Kopie in voller Auflösung im Speicher (wichtig bei 128 MB memory_limit).
|
||||
foreach (array_reverse(self::SIZES) as $size) {
|
||||
$image->cover($size, $size);
|
||||
Storage::disk('uploads')->put("{$base}-{$size}.webp", $image->encode(new WebpEncoder(quality: 85))->toString());
|
||||
if (! Storage::disk('uploads')->put("{$base}-{$size}.webp", $image->encode(new WebpEncoder(quality: 85))->toString())) {
|
||||
throw new RuntimeException('Profilbild konnte nicht gespeichert werden – ist public/uploads beschreibbar?');
|
||||
}
|
||||
}
|
||||
|
||||
$this->delete($user);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,15 @@ class SiteHealth
|
|||
'Es fehlen: '.implode(', ', $missing).'. Bitte beim Hoster aktivieren.',
|
||||
);
|
||||
|
||||
$gd = function_exists('gd_info') ? gd_info() : [];
|
||||
$formats = array_filter(['JPEG' => $gd['JPEG Support'] ?? false, 'PNG' => $gd['PNG Support'] ?? false, 'WebP' => $gd['WebP Support'] ?? false], fn ($supported) => ! $supported);
|
||||
$checks[] = $this->check(
|
||||
'Bildverarbeitung (GD)',
|
||||
$gd !== [] && $formats === [],
|
||||
'JPEG, PNG und WebP',
|
||||
$gd === [] ? 'Die PHP-Erweiterung „gd“ fehlt – Profilbilder und Titelbilder lassen sich nicht hochladen.' : 'GD kann kein '.implode(', ', array_keys($formats)).' – Profilbilder und Titelbilder lassen sich so nicht hochladen. Bitte beim Hoster eine GD-Version mit '.implode(', ', array_keys($formats)).'-Unterstützung aktivieren.',
|
||||
);
|
||||
|
||||
$checks[] = [
|
||||
'label' => 'Ausgehende Verbindungen',
|
||||
'status' => function_exists('curl_init') || ini_get('allow_url_fopen') ? self::OK : self::WARNING,
|
||||
|
|
|
|||
|
|
@ -9,5 +9,5 @@ namespace App;
|
|||
*/
|
||||
final class Version
|
||||
{
|
||||
public const VERSION = '0.12.1';
|
||||
public const VERSION = '0.12.2';
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue