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

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-09-26 18:28:03 +00:00
parent 201c86d486
commit 293d7f86a4
104 changed files with 552 additions and 409 deletions

View file

@ -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');