Schneller und stabiler bei Updates (0.45.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 12m25s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 12m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 10m43s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 10m37s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 12m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m38s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Successful in 12m25s
CI / PHP 8.4 / mariadb:10.6 (pull_request) Successful in 12m51s
CI / PHP 8.3 / mariadb:11.4 (pull_request) Successful in 10m43s
CI / PHP 8.4 / mariadb:11.4 (pull_request) Successful in 10m37s
CI / PHP 8.4 / mysql:8.0 (pull_request) Failing after 12m42s
CI / PHP 8.3 / mysql:8.0 (pull_request) Failing after 13m38s
CI / PHP 8.3 / mysql:8.4 (pull_request) Failing after 9m39s
CI / PHP 8.4 / mysql:8.4 (pull_request) Failing after 9m33s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 44s
CI / Build-Artefakte aktuell (pull_request) Successful in 1m10s
- Ladefehler während eines Updates schalten keine Plugins mehr ab: Wartungsmodus merkt sich den Update-Zeitraum (+2 min Nachlauf), Plugin-Uploads markieren den Dateiaustausch ohne Wartungsmodus; guard/recoverFromCrash prüfen das, betroffene Plugins (mit disabled_at im Zeitraum) werden wieder eingeschaltet - Plugin-Oberflächen werden nach public/plugin-assets kopiert (Webserver statt PHP), bei Deaktivieren/Löschen/Neu-Hochladen entfernt; Route bleibt als Rückfall - RichTextEditor in SDK, Leichte-Sprache-Leiste und Glossar asynchron; fehlende Menü-Symbole kuratiert → kein Laden des kompletten Symbolsatzes - Inertia-Prefetch (hover, 10 s) für Menülinks und Neuigkeiten-Vorschauen; Prefetch zählt nicht als Lesen (Reach) Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
55a26e3f8e
commit
bf68be68f9
205 changed files with 773 additions and 464 deletions
|
|
@ -11,6 +11,12 @@ namespace App\Support\Update;
|
|||
*/
|
||||
class MaintenanceFlag
|
||||
{
|
||||
/**
|
||||
* So lange nach einem Update gelten Abstürze beim Laden noch als Folge des Dateiaustauschs
|
||||
* (Zwischenspeicher wie OPcache und parallele Anfragen brauchen einen Moment).
|
||||
*/
|
||||
public const GRACE_SECONDS = 120;
|
||||
|
||||
public function __construct(private readonly ?string $file = null) {}
|
||||
|
||||
public function activate(int $maxSeconds = 600): void
|
||||
|
|
@ -23,7 +29,67 @@ class MaintenanceFlag
|
|||
|
||||
public function deactivate(): void
|
||||
{
|
||||
$data = json_decode((string) @file_get_contents($this->path()), true);
|
||||
@unlink($this->path());
|
||||
|
||||
// Zeitraum des letzten Updates merken (siehe covers())
|
||||
if (is_array($data) && isset($data['since'])) {
|
||||
AtomicFile::write($this->lastPath(), json_encode(['since' => (int) $data['since'], 'until' => time()]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dateiaustausch ohne Wartungsmodus (z. B. ein Plugin wird aktualisiert): Die Seite bleibt
|
||||
* erreichbar, Ladefehler in dieser Zeit schalten aber kein Plugin ab.
|
||||
*/
|
||||
public function beginQuietUpdate(): void
|
||||
{
|
||||
AtomicFile::write($this->windowPath(), json_encode(['since' => time()]));
|
||||
}
|
||||
|
||||
public function endQuietUpdate(): void
|
||||
{
|
||||
$data = json_decode((string) @file_get_contents($this->windowPath()), true);
|
||||
@unlink($this->windowPath());
|
||||
|
||||
if (is_array($data) && isset($data['since'])) {
|
||||
AtomicFile::write($this->lastPath(), json_encode(['since' => (int) $data['since'], 'until' => time()]));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Läuft gerade ein Update – oder ist eines erst eben zu Ende gegangen?
|
||||
*/
|
||||
public function isUpdating(): bool
|
||||
{
|
||||
return $this->isActive() || $this->covers(time());
|
||||
}
|
||||
|
||||
/**
|
||||
* Fiel dieser Zeitpunkt in ein Update (einschließlich der Nachlaufzeit)?
|
||||
*/
|
||||
public function covers(int $timestamp): bool
|
||||
{
|
||||
foreach ([$this->path(), $this->windowPath(), $this->lastPath()] as $file) {
|
||||
$data = json_decode((string) @file_get_contents($file), true);
|
||||
|
||||
if (! is_array($data) || ! isset($data['since'])) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$until = match ($file) {
|
||||
// Läuft noch (ein abgebrochener Plugin-Austausch zählt höchstens zehn Minuten)
|
||||
$this->path() => max(time(), (int) ($data['until'] ?? 0)),
|
||||
$this->windowPath() => min(time(), (int) $data['since'] + 600),
|
||||
default => (int) ($data['until'] ?? 0),
|
||||
};
|
||||
|
||||
if ($timestamp >= (int) $data['since'] && $timestamp <= $until + self::GRACE_SECONDS) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function isActive(): bool
|
||||
|
|
@ -56,4 +122,14 @@ class MaintenanceFlag
|
|||
{
|
||||
return $this->file ?? storage_path('.maintenance');
|
||||
}
|
||||
|
||||
private function windowPath(): string
|
||||
{
|
||||
return $this->path().'-quiet';
|
||||
}
|
||||
|
||||
private function lastPath(): string
|
||||
{
|
||||
return $this->path().'-last';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue