Automatische Updates, Browser-Tests, CI grün (0.63.0)
Some checks failed
CI / PHP 8.3 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:10.6 (pull_request) Has been skipped
CI / PHP 8.3 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.4 / mariadb:11.4 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.0 (pull_request) Has been skipped
CI / PHP 8.3 / mysql:8.4 (pull_request) Has been skipped
CI / PHP 8.4 / mysql:8.4 (pull_request) Has been skipped
CI / Browser-Tests (pull_request) Failing after 7m34s
CI / PHP 8.3 / mysql:8.4-1 (pull_request) Successful in 11m55s
CI / Bekannte Sicherheitslücken in Paketen (pull_request) Successful in 16m43s
CI / Build-Artefakte aktuell (pull_request) Successful in 13m17s

- Opt-in „Updates automatisch installieren“ (AutoUpdate, alle 10 Minuten)
- Playwright-Tests in tests/Browser, CI-Job „Browser-Tests“
- CI: volle Matrix nur auf main, PRs mit einem MySQL-Job
- MySQL-JSON-Reihenfolge in zwei Tests, QM-Suchausschnitt ohne <mark>, h1 auf Startseite/Editor

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Friederich Loheide 2026-10-07 17:29:20 +00:00
parent 3027a60275
commit e211db9f30
158 changed files with 774 additions and 378 deletions

View file

@ -0,0 +1,60 @@
<?php
namespace App\Support\Update;
use App\Support\Settings;
use Illuminate\Support\Facades\Log;
use Throwable;
/**
* „Updates automatisch installieren“ – gedacht für Test- und Vorschau-Instanzen, die
* immer den neuesten Stand ihres Kanals zeigen sollen. Läuft als geplante Aufgabe
* (Cron, Web-Cron oder Pseudo-Cron) und nutzt denselben Ablauf wie der Knopf auf
* der Seite „Aktualisierung“. Einen Kanalwechsel zurück installiert es nie selbst.
*/
class AutoUpdate
{
public function __construct(
private readonly Settings $settings,
private readonly UpdateCheck $check,
private readonly UpdateProgress $progress,
) {}
public function enabled(): bool
{
return (bool) $this->settings->get('updates.auto', false);
}
public function setEnabled(bool $enabled): void
{
$this->settings->set('updates.auto', $enabled);
}
/**
* @return array{sha: string, files: int, pending: bool}|null null, wenn nichts installiert wurde
*/
public function run(): ?array
{
if (! $this->enabled() || $this->progress->isRunning()) {
return null;
}
try {
$result = $this->check->run();
} catch (Throwable $e) {
Log::warning('Automatisches Update: Prüfung fehlgeschlagen: '.$e->getMessage());
return null;
}
if (! $result['has_update'] || ($result['channel_switch']['direction'] ?? null) === 'back') {
return null;
}
@set_time_limit(0);
@ignore_user_abort(true);
Log::info('Automatisches Update auf '.($result['version'] ?? $result['latest_short']).' beginnt.');
return app(Updater::class)->installUpdate();
}
}