diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e1b2a0c..8c08ebc 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -85,4 +85,4 @@ jobs:
run: vendor/bin/phpunit
- name: PHPStan
- run: vendor/bin/phpstan analyse --no-progress --memory-limit=512M
+ run: vendor/bin/phpstan analyse --no-progress
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 7b7f5c6..41a564d 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -79,7 +79,6 @@ jobs:
unifi-voucher-tool/database.sql \
unifi-voucher-tool/LICENSE \
unifi-voucher-tool/THIRD-PARTY-NOTICES.md \
- unifi-voucher-tool/CHANGELOG.md \
unifi-voucher-tool/assets/global.css \
unifi-voucher-tool/assets/vendor/inter/inter.css \
unifi-voucher-tool/assets/vendor/inter/LICENSE.txt \
diff --git a/CHANGELOG.md b/CHANGELOG.md
deleted file mode 100644
index ec41bd7..0000000
--- a/CHANGELOG.md
+++ /dev/null
@@ -1,30 +0,0 @@
-# Änderungsprotokoll
-
-Neueste Fassung oben. Die Abschnittsüberschriften tragen die Versionsnummer,
-denn genau daran liest der Update-Dienst ab, was seit einem Stand dazugekommen
-ist.
-
-## 3.0.0 – 2026-09-25
-
-- Selbst-Updater neu gebaut: Aktualisierung per Klick im Administrationsbereich, ohne Zugang zum Server
-- Update-Paket wird gegen die vom Dienst genannte Prüfsumme abgeglichen
-- Entpacken mit zweistufigem Schutz gegen Pfadausbrüche aus dem Archiv
-- Dateien werden einzeln erst daneben geschrieben und dann umbenannt; geschützte Pfade bleiben unberührt
-- Wartungsmodus läuft von allein aus, ein abgebrochener Lauf blockiert die Installation nicht mehr
-- Migrationen ziehen nach einem Update beim ersten Seitenaufruf nach, abgesichert über Fingerabdruck und Sperre
-- Datenschutzhinweis dauerhaft sichtbar an der Stelle, an der die Übertragung ausgelöst wird
-- Diagnoseseite `cron_test.php` entfernt, `test.php` ist ohne Anmeldung nicht mehr erreichbar
-
-## 2.9.0 – 2026-09-24
-
-- Display-Seiten: Betriebszeiten, PIN, Wartezeit je Gerät und feste Sprache je Seite
-- Vorschau der Display-Seiten in der Administration, Auswertung je Seite im Reporting
-- Zertifikatsprüfung pro Site und für den Mailversand einschaltbar
-- Karte „Über diese Installation“ mit Version, Lizenz und den Komponenten Dritter
-- Lizenzhinweise vervollständigt: `LICENSE`, `THIRD-PARTY-NOTICES.md` und die Lizenztexte der Bibliotheken
-
-## 2.8.0 – 2026-09-23
-
-- Öffentliche Display-Seiten für Gäste, gestaltbar mit Logo, Hintergrund und Farben
-- Tests für Anmeldung und Controller, PHP 8.1 als Mindestversion
-- Backup umfasst die Display-Seiten
diff --git a/Readme.md b/Readme.md
index f829230..86f54e5 100644
--- a/Readme.md
+++ b/Readme.md
@@ -10,7 +10,7 @@ Entwickelt von **[Loheide.eu](https://loheide.eu)**



-
+
[](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool/actions)
[](https://git.loheide.cloud/friloo/Unifi-Voucher-Tool)
@@ -203,63 +203,36 @@ cd Unifi-Voucher-Tool
---
-## 🔄 Selbst-Updater
+## 🔄 Auto-Updater
-Eine laufende Installation aktualisiert sich per Klick im Administrationsbereich
-– **ohne SSH und ohne `git pull` auf dem Server**. Quellcode und
-Datenbank-Migrationen kommen über einen Update-Dienst, der den aktuellen Stand
-des Branches als ZIP bereitstellt.
+Das System bringt einen vollständig integrierten Updater mit, der Quellcode und
+Datenbank-Migrationen über einen zentralen Update-Proxy nachzieht – ganz ohne
+SSH oder manuelles `git pull`.
```
-[diese Installation] ←HTTPS→ [Update-Dienst] ←pull→ [Git-Repository]
+[diese Instanz] ←HTTPS→ [Update-Proxy] ←pull→ [Git-Repo]
```
-**Aufruf:** Administration → **Aktualisierung** (`/admin/update.php`)
+**Aufruf:** Administration → **System-Update** (`/admin/update.php`)
-- 🔍 **„Nach Updates suchen"** zeigt, ob eine neue Fassung da ist, welche Version
- sie trägt und – sofern der Dienst etwas liefert – die Abschnitte aus dem
- Änderungsprotokoll. Gibt es dazu nichts, bleibt es bei der schlichten Aussage
- „neue Fassung verfügbar"
-- ⬇️ **„Jetzt aktualisieren"** spielt sie ein: Wartungsseite, Prüfsumme, gesichertes
- Entpacken, geschützte Pfade, Migrationen, Bytecode-Cache. Der Fortschritt wird
- alle zwei Sekunden abgefragt; der Ablauf läuft serverseitig weiter, auch wenn
- der Browser die Verbindung kappt
-- 🔀 **Kanal** zwischen `stable` und `development` umschaltbar
-- 📊 **Migrationen** mit Status je Datei und Schaltfläche zum Nachziehen
-- 📜 **Änderungsprotokoll** aus der mitgelieferten `CHANGELOG.md`
+- 🔍 **„Auf Updates prüfen"** zeigt verfügbare Versionen inkl. Changelog
+- ⬇️ **„Update installieren"** spielt das Update ein – mit Wartungsseite,
+ geschützten Pfaden (`config.php`, Uploads, …), automatischen DB-Migrationen
+ und OPcache-Reset
+- 🔀 **Channel-Auswahl** zwischen `stable` und `development`
+- 📊 **Migrations-Status** in einem eigenen Tab – inkl. Button **„Ausstehende
+ Migrationen ausführen"** (legt z. B. neue Tabellen für bestehende
+ Installationen an, ohne dass ein Code-Update nötig ist)
-Während eines Updates antwortet die Anwendung mit einer **Wartungsseite** (HTTP
-503 samt `Retry-After`) – ausgenommen die Update-Endpunkte selbst, die
-Anmeldeseite und der Health-Check, damit der Fortschritt sichtbar bleibt:
+Während eines Updates wird die Anwendung kurz in den **Wartungsmodus** versetzt:
-**Version 3.0.0** · Autor: **Friederich Loheide** · Lizenz: **MIT**
+**Version 2.9.0** · Autor: **Friederich Loheide** · Lizenz: **MIT**
Entwickelt von **[Loheide.eu](https://loheide.eu)**
diff --git a/VERSION b/VERSION
index 4a36342..c8e38b6 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.0.0
+2.9.0
diff --git a/admin/api_keys.php b/admin/api_keys.php
index a08e9f7..7c7fc9a 100644
--- a/admin/api_keys.php
+++ b/admin/api_keys.php
@@ -1,7 +1,4 @@
requireAdmin();
-I18n::init();
$db = Database::getInstance();
-$appTitle = $db->getSetting('app_title', 'UniFi Voucher System');
-$channel = \Updater\UpdaterFactory::channel();
-$channelLabels = \Updater\UpdaterFactory::channelLabels();
-$installedSha = \Updater\Version::current();
-$release = \Updater\Version::RELEASE;
-$migrations = [];
-$migrationError = '';
-
-try {
- $migrations = \Updater\UpdaterFactory::create($db)->migrationStatus();
-} catch (Throwable $e) {
- $migrationError = $e->getMessage();
-}
-$openMigrations = count(array_filter($migrations, static fn ($m) => !$m['applied']));
-
-$changelog = \Updater\Changelog::sections();
-$privacyUrl = trim((string)$db->getSetting('privacy_url', ''));
-$csrf = $auth->getCsrfToken();
-$currentPage = 'update';
-$adminBase = '';
-?>
-
-
-
-
-
-
= __('update_title') ?> – = htmlspecialchars($appTitle) ?>
-
-
-
-
-
= __('update_installed') ?>
-
- = __('update_version') ?>
- = htmlspecialchars($release) ?>= $installedSha ? ' ' . htmlspecialchars(substr($installedSha, 0, 7)) . '' : '' ?>
-
- = __('update_state') ?>
-
-
- = htmlspecialchars($installedSha) ?>
-
- = __('update_state_unknown') ?>
-
-
-
- = __('update_channel') ?>
- = htmlspecialchars($channelLabels[$channel] ?? $channel) ?>
-
-
-
-
-
-
-
= __('update_search') ?>
-
-
- = __('update_search_btn') ?>
-
-
- = __('update_install_btn') ?>
-
-
-
-
-
-
-
-
-
-
= __('update_privacy_title') ?>
-
= __('update_privacy_intro') ?>
-
- = __('update_privacy_item_state') ?>
- = __('update_privacy_item_tech') ?>
-
-
= __('update_privacy_purpose') ?>
-
= __('update_privacy_not') ?>
-
= __('update_privacy_retention') ?>
-
-
= __('update_privacy_link') ?>
-
-
-
-
-
-
= __('update_migrations') ?>
-
-
= htmlspecialchars($migrationError) ?>
-
-
- = str_replace(['{total}', '{open}'], [(string)count($migrations), (string)$openMigrations], __('update_migrations_hint')) ?>
-
-
-
-
-
- = __('update_migration_file') ?>
- = __('update_migration_state') ?>
-
-
-
-
-
- = htmlspecialchars($migration['filename']) ?>
-
-
- = __('update_migration_applied') ?>
-
- = __('update_migration_open') ?>
-
-
-
-
-
-
-
-
- = __('update_migrations_btn') ?>
-
-
-
-
-
-
-
= __('update_history') ?>
-
-
= __('update_history_empty') ?>
-
-
-
-
= htmlspecialchars($section['heading']) ?>
-
= \Updater\Changelog::toHtml($section['text']) ?>
-
-
-
-
-
-
-
-
-
-
+$controller = new \Updater\UpdateController($db, $auth);
+$controller->handle();
diff --git a/admin/update_api.php b/admin/update_api.php
deleted file mode 100644
index ace68e9..0000000
--- a/admin/update_api.php
+++ /dev/null
@@ -1,21 +0,0 @@
-requireAdmin();
-
-$controller = new \Updater\UpdateController(Database::getInstance(), $auth);
-$controller->handle((string)($_GET['action'] ?? $_POST['action'] ?? ''));
diff --git a/admin/users.php b/admin/users.php
index 4d62674..b489447 100644
--- a/admin/users.php
+++ b/admin/users.php
@@ -1,7 +1,4 @@
check();
+ $mgr = \Updater\UpdaterFactory::create($db, null);
+ $res = $mgr->checkForUpdates();
if (!empty($res['has_update'])) {
Notifier::updateAvailable($res['latest_sha'] ?? '');
}
diff --git a/cron_test.php b/cron_test.php
new file mode 100644
index 0000000..ab6067a
--- /dev/null
+++ b/cron_test.php
@@ -0,0 +1,72 @@
+ 1, 'message' => 'PHP läuft']);
+
+// Test 1: Config laden
+try {
+ require_once __DIR__ . '/config.php';
+ echo "\n" . json_encode(['step' => 2, 'message' => 'Config geladen']);
+} catch (Exception $e) {
+ echo "\n" . json_encode(['step' => 2, 'error' => $e->getMessage()]);
+ exit;
+}
+
+// Test 2: Database laden
+try {
+ require_once __DIR__ . '/includes/Database.php';
+ echo "\n" . json_encode(['step' => 3, 'message' => 'Database.php geladen']);
+} catch (Exception $e) {
+ echo "\n" . json_encode(['step' => 3, 'error' => $e->getMessage()]);
+ exit;
+}
+
+// Test 3: DB-Verbindung
+try {
+ $db = Database::getInstance();
+ echo "\n" . json_encode(['step' => 4, 'message' => 'DB-Verbindung OK']);
+} catch (Exception $e) {
+ echo "\n" . json_encode(['step' => 4, 'error' => $e->getMessage()]);
+ exit;
+}
+
+// Test 4: UniFiController laden
+try {
+ require_once __DIR__ . '/includes/UniFiController.php';
+ echo "\n" . json_encode(['step' => 5, 'message' => 'UniFiController.php geladen']);
+} catch (Exception $e) {
+ echo "\n" . json_encode(['step' => 5, 'error' => $e->getMessage()]);
+ exit;
+}
+
+// Test 5: Spalten prüfen
+try {
+ $columns = $db->fetchAll("SHOW COLUMNS FROM vouchers");
+ $columnNames = array_column($columns, 'Field');
+ echo "\n" . json_encode(['step' => 6, 'message' => 'Voucher-Spalten', 'columns' => $columnNames]);
+
+ // Prüfen ob neue Spalten existieren
+ $required = ['status', 'used_count', 'expires_at', 'synced_from_unifi', 'last_sync'];
+ $missing = array_diff($required, $columnNames);
+
+ if (!empty($missing)) {
+ echo "\n" . json_encode(['step' => 7, 'warning' => 'Fehlende Spalten', 'missing' => array_values($missing)]);
+ } else {
+ echo "\n" . json_encode(['step' => 7, 'message' => 'Alle Spalten vorhanden']);
+ }
+} catch (Exception $e) {
+ echo "\n" . json_encode(['step' => 6, 'error' => $e->getMessage()]);
+ exit;
+}
+
+// Test 6: Token prüfen
+try {
+ $token = $db->getSetting('cron_token', '');
+ echo "\n" . json_encode(['step' => 8, 'message' => 'Token Status', 'has_token' => !empty($token)]);
+} catch (Exception $e) {
+ echo "\n" . json_encode(['step' => 8, 'error' => $e->getMessage()]);
+ exit;
+}
+
+echo "\n" . json_encode(['final' => 'Alle Tests erfolgreich!']);
diff --git a/docs/screenshots/admin-dashboard-dark.png b/docs/screenshots/admin-dashboard-dark.png
index 58181d8..effa5ff 100644
Binary files a/docs/screenshots/admin-dashboard-dark.png and b/docs/screenshots/admin-dashboard-dark.png differ
diff --git a/docs/screenshots/admin-dashboard.png b/docs/screenshots/admin-dashboard.png
index 0b5e065..1c06c88 100644
Binary files a/docs/screenshots/admin-dashboard.png and b/docs/screenshots/admin-dashboard.png differ
diff --git a/docs/screenshots/api-keys.png b/docs/screenshots/api-keys.png
index 3a86c44..2053175 100644
Binary files a/docs/screenshots/api-keys.png and b/docs/screenshots/api-keys.png differ
diff --git a/docs/screenshots/bulk-vouchers.png b/docs/screenshots/bulk-vouchers.png
index e273f3f..4ceb658 100644
Binary files a/docs/screenshots/bulk-vouchers.png and b/docs/screenshots/bulk-vouchers.png differ
diff --git a/docs/screenshots/integrations.png b/docs/screenshots/integrations.png
index 6a50699..78d18b8 100644
Binary files a/docs/screenshots/integrations.png and b/docs/screenshots/integrations.png differ
diff --git a/docs/screenshots/kiosk-branded.png b/docs/screenshots/kiosk-branded.png
index 9fd3435..4fd41bc 100644
Binary files a/docs/screenshots/kiosk-branded.png and b/docs/screenshots/kiosk-branded.png differ
diff --git a/docs/screenshots/kiosk-code.png b/docs/screenshots/kiosk-code.png
index bd03a36..4a6d7a8 100644
Binary files a/docs/screenshots/kiosk-code.png and b/docs/screenshots/kiosk-code.png differ
diff --git a/docs/screenshots/kiosk-display.png b/docs/screenshots/kiosk-display.png
index f290ac4..2b984ca 100644
Binary files a/docs/screenshots/kiosk-display.png and b/docs/screenshots/kiosk-display.png differ
diff --git a/docs/screenshots/kiosks-admin.png b/docs/screenshots/kiosks-admin.png
index 5bbe14a..1d793e3 100644
Binary files a/docs/screenshots/kiosks-admin.png and b/docs/screenshots/kiosks-admin.png differ
diff --git a/docs/screenshots/kiosks-form.png b/docs/screenshots/kiosks-form.png
index 471bd42..2121081 100644
Binary files a/docs/screenshots/kiosks-form.png and b/docs/screenshots/kiosks-form.png differ
diff --git a/docs/screenshots/login-branding.png b/docs/screenshots/login-branding.png
index 18143c5..799d8a9 100644
Binary files a/docs/screenshots/login-branding.png and b/docs/screenshots/login-branding.png differ
diff --git a/docs/screenshots/login.png b/docs/screenshots/login.png
index e5cd21a..133e8f0 100644
Binary files a/docs/screenshots/login.png and b/docs/screenshots/login.png differ
diff --git a/docs/screenshots/maintenance.png b/docs/screenshots/maintenance.png
index 0bb19eb..55d6e4d 100644
Binary files a/docs/screenshots/maintenance.png and b/docs/screenshots/maintenance.png differ
diff --git a/docs/screenshots/mobile-vouchers.png b/docs/screenshots/mobile-vouchers.png
index a248f1d..bc29c3c 100644
Binary files a/docs/screenshots/mobile-vouchers.png and b/docs/screenshots/mobile-vouchers.png differ
diff --git a/docs/screenshots/settings-branding.png b/docs/screenshots/settings-branding.png
index dcd7e09..0bdd9a3 100644
Binary files a/docs/screenshots/settings-branding.png and b/docs/screenshots/settings-branding.png differ
diff --git a/docs/screenshots/settings-login.png b/docs/screenshots/settings-login.png
index 195a296..af8de26 100644
Binary files a/docs/screenshots/settings-login.png and b/docs/screenshots/settings-login.png differ
diff --git a/docs/screenshots/settings.png b/docs/screenshots/settings.png
index a39bff9..04299ec 100644
Binary files a/docs/screenshots/settings.png and b/docs/screenshots/settings.png differ
diff --git a/docs/screenshots/two-factor.png b/docs/screenshots/two-factor.png
index e0ded5b..0754713 100644
Binary files a/docs/screenshots/two-factor.png and b/docs/screenshots/two-factor.png differ
diff --git a/docs/screenshots/updater-available.png b/docs/screenshots/updater-available.png
index 794fe85..1ee6cd6 100644
Binary files a/docs/screenshots/updater-available.png and b/docs/screenshots/updater-available.png differ
diff --git a/docs/screenshots/updater.png b/docs/screenshots/updater.png
index 18e4d35..1ee6cd6 100644
Binary files a/docs/screenshots/updater.png and b/docs/screenshots/updater.png differ
diff --git a/docs/screenshots/voucher-form.png b/docs/screenshots/voucher-form.png
index b705f62..776bbf5 100644
Binary files a/docs/screenshots/voucher-form.png and b/docs/screenshots/voucher-form.png differ
diff --git a/docs/screenshots/voucher-result.png b/docs/screenshots/voucher-result.png
index 9445225..7119d7d 100644
Binary files a/docs/screenshots/voucher-result.png and b/docs/screenshots/voucher-result.png differ
diff --git a/docs/screenshots/vouchers.png b/docs/screenshots/vouchers.png
index 174594b..6f8204c 100644
Binary files a/docs/screenshots/vouchers.png and b/docs/screenshots/vouchers.png differ
diff --git a/forgot_password.php b/forgot_password.php
index 0fb25e9..de98f60 100644
--- a/forgot_password.php
+++ b/forgot_password.php
@@ -1,7 +1,4 @@
'Sicherheit (2FA)',
'nav_integrations' => 'Integration & Wartung',
'nav_backup' => 'Backup & Restore',
- 'nav_update' => 'Aktualisierung',
+ 'nav_update' => 'System-Update',
'nav_back' => 'Zurück zur Startseite',
'nav_administration'=> 'Administration',
@@ -667,48 +667,4 @@ return [
'never' => 'Noch nie',
'unknown' => 'Unbekannt',
'or' => 'oder',
-
- // Selbst-Updater
- 'update_title' => 'Aktualisierung',
- 'update_subtitle' => 'Neue Fassungen prüfen und ohne Serverzugang einspielen.',
- 'update_installed' => 'Installierter Stand',
- 'update_version' => 'Version',
- 'update_state' => 'Stand',
- 'update_state_unknown' => 'Noch nicht ermittelt – einmal nach Updates suchen.',
- 'update_channel' => 'Kanal',
- 'update_channel_change' => 'Kanal wechseln',
- 'update_channel_save' => 'Kanal übernehmen',
- 'update_channel_hint' => 'Der Entwicklungskanal führt Vorabfassungen. Für den laufenden Betrieb ist „Stabil“ die richtige Wahl.',
- 'update_search' => 'Nach Updates suchen',
- 'update_search_btn' => 'Nach Updates suchen',
- 'update_install_btn' => 'Jetzt aktualisieren',
- 'update_migrations' => 'Datenbank-Migrationen',
- 'update_migrations_hint' => '{total} Migrationen insgesamt, davon {open} offen.',
- 'update_migrations_btn' => 'Migrationen ausführen',
- 'update_migration_file' => 'Datei',
- 'update_migration_state' => 'Status',
- 'update_migration_applied' => 'Angewendet',
- 'update_migration_open' => 'Offen',
- 'update_history' => 'Änderungsprotokoll',
- 'update_history_empty' => 'Für diese Fassung liegt kein Änderungsprotokoll bei.',
- 'update_privacy_title' => 'Datenschutzhinweis',
- 'update_privacy_intro' => 'Bei der Suche nach Updates und beim Herunterladen einer neuen Fassung werden Daten an update.loheide.cloud übertragen. Übermittelt werden:',
- 'update_privacy_item_state' => 'der bei Ihnen installierte Stand, damit die Gegenstelle weiß, was neu ist',
- 'update_privacy_item_tech' => 'technisch bedingt: Ihre IP-Adresse, Datum und Uhrzeit des Abrufs',
- 'update_privacy_purpose' => 'Zweck: Bereitstellung der Aktualisierung.',
- 'update_privacy_not' => 'Nicht übertragen werden Inhalte aus diesem Programm: keine Dokumente, keine Datenbank, keine Eingaben. Die Verbindung ist verschlüsselt.',
- 'update_privacy_retention' => 'Zugriffe auf die Update-Endpunkte werden serverseitig 400 Tage aufbewahrt, danach gelöscht.',
- 'update_privacy_link' => 'Datenschutzerklärung dieser Installation',
- 'update_js_checking' => 'Es wird gesucht …',
- 'update_js_current' => 'Diese Installation ist auf dem neuesten Stand.',
- 'update_js_available' => 'Eine neue Fassung ist verfügbar.',
- 'update_js_behind' => '{count} Stand/Stände zurück',
- 'update_js_target' => 'Zielversion:',
- 'update_js_installing' => 'Aktualisierung wird vorbereitet …',
- 'update_js_done' => 'Aktualisierung abgeschlossen.',
- 'update_js_failed' => 'Die Aktualisierung ist fehlgeschlagen.',
- 'update_js_more' => 'Vollständiges Änderungsprotokoll ansehen',
- 'update_js_channel_switch' => 'Der gemeldete Stand stammt aus dem Kanal {to} (bisher {from}).',
- 'update_js_confirm' => 'Jetzt aktualisieren? Die Seite ist währenddessen kurz nicht erreichbar.',
- 'update_js_migrated' => '{count} Migration(en) ausgeführt.',
];
diff --git a/lang/en.php b/lang/en.php
index d7125f7..ed8fc9c 100644
--- a/lang/en.php
+++ b/lang/en.php
@@ -17,7 +17,7 @@ return [
'nav_security' => 'Security (2FA)',
'nav_integrations' => 'Integration & Maintenance',
'nav_backup' => 'Backup & Restore',
- 'nav_update' => 'Update',
+ 'nav_update' => 'System Update',
'nav_back' => 'Back to Home',
'nav_administration'=> 'Administration',
@@ -667,48 +667,4 @@ return [
'never' => 'Never',
'unknown' => 'Unknown',
'or' => 'or',
-
- // Self updater
- 'update_title' => 'Update',
- 'update_subtitle' => 'Check for new versions and install them without server access.',
- 'update_installed' => 'Installed version',
- 'update_version' => 'Version',
- 'update_state' => 'Revision',
- 'update_state_unknown' => 'Not determined yet – run a check once.',
- 'update_channel' => 'Channel',
- 'update_channel_change' => 'Change channel',
- 'update_channel_save' => 'Apply channel',
- 'update_channel_hint' => 'The development channel carries pre-releases. For production use, pick "stable".',
- 'update_search' => 'Check for updates',
- 'update_search_btn' => 'Check for updates',
- 'update_install_btn' => 'Update now',
- 'update_migrations' => 'Database migrations',
- 'update_migrations_hint' => '{total} migrations in total, {open} of them pending.',
- 'update_migrations_btn' => 'Run migrations',
- 'update_migration_file' => 'File',
- 'update_migration_state' => 'Status',
- 'update_migration_applied' => 'Applied',
- 'update_migration_open' => 'Pending',
- 'update_history' => 'Changelog',
- 'update_history_empty' => 'No changelog shipped with this version.',
- 'update_privacy_title' => 'Privacy notice',
- 'update_privacy_intro' => 'Checking for updates and downloading a new version transmits data to update.loheide.cloud. Transmitted are:',
- 'update_privacy_item_state' => 'the version installed on your side, so the service knows what is new',
- 'update_privacy_item_tech' => 'for technical reasons: your IP address, date and time of the request',
- 'update_privacy_purpose' => 'Purpose: delivering the update.',
- 'update_privacy_not' => 'No content from this application is transmitted: no documents, no database, no input. The connection is encrypted.',
- 'update_privacy_retention' => 'Requests to the update endpoints are kept on the server for 400 days and deleted afterwards.',
- 'update_privacy_link' => 'Privacy policy of this installation',
- 'update_js_checking' => 'Checking …',
- 'update_js_current' => 'This installation is up to date.',
- 'update_js_available' => 'A new version is available.',
- 'update_js_behind' => '{count} revision(s) behind',
- 'update_js_target' => 'Target version:',
- 'update_js_installing' => 'Preparing the update …',
- 'update_js_done' => 'Update completed.',
- 'update_js_failed' => 'The update failed.',
- 'update_js_more' => 'View the full changelog',
- 'update_js_channel_switch' => 'The reported revision comes from channel {to} (previously {from}).',
- 'update_js_confirm' => 'Update now? The site will be briefly unavailable.',
- 'update_js_migrated' => '{count} migration(s) applied.',
];
diff --git a/m365_callback.php b/m365_callback.php
index 3ffd401..584e77f 100644
--- a/m365_callback.php
+++ b/m365_callback.php
@@ -1,7 +1,4 @@
requireAdmin();
}
-require_once __DIR__ . '/config.php';
-require_once __DIR__ . '/includes/Database.php';
-require_once __DIR__ . '/includes/Auth.php';
-require_once __DIR__ . '/includes/Crypto.php';
-$auth = new Auth();
-$auth->requireAdmin();
-
echo '
'
. '
'
. '
System-Test '
diff --git a/tests/UpdaterTest.php b/tests/UpdaterTest.php
deleted file mode 100644
index 4209dcf..0000000
--- a/tests/UpdaterTest.php
+++ /dev/null
@@ -1,302 +0,0 @@
-tmp = sys_get_temp_dir() . '/uvt-updater-' . bin2hex(random_bytes(6));
- mkdir($this->tmp, 0775, true);
- Version::useStorageDir($this->tmp . '/storage');
- mkdir($this->tmp . '/storage', 0775, true);
- }
-
- protected function tearDown(): void
- {
- Version::useStorageDir(null);
- $this->removeTree($this->tmp);
- }
-
- // ------------------------------------------------------------- Version
-
- public function testVersionIsStoredAndReadBack(): void
- {
- $sha = str_repeat('a1b2c3d4', 5);
-
- $this->assertNull(Version::current(), 'Frische Installation kennt noch keinen Stand');
- $this->assertTrue(Version::save($sha));
- $this->assertSame($sha, Version::current());
- $this->assertSame(substr($sha, 0, 7), Version::short());
- }
-
- /**
- * Eine halbe Proxy-Antwort darf sich nicht als Version einzementieren -
- * sonst meldet die Installation dauerhaft einen Stand, den es nicht gibt.
- */
- public function testInvalidRevisionIsRejected(): void
- {
- foreach (['', 'nope', str_repeat('z', 40), str_repeat('ab', 10)] as $bad) {
- $this->assertFalse(Version::save($bad), 'Abgelehnt werden muss: ' . var_export($bad, true));
- }
- $this->assertNull(Version::current());
- }
-
- public function testReleaseConstantMatchesVersionFile(): void
- {
- $file = trim((string)file_get_contents(dirname(__DIR__) . '/VERSION'));
-
- $this->assertSame($file, Version::RELEASE, 'VERSION-Datei und Konstante duerfen nicht auseinanderlaufen');
- }
-
- // --------------------------------------------------------- Wartungsmodus
-
- public function testMaintenanceCanBeSwitchedOnAndOff(): void
- {
- $this->assertFalse(Maintenance::isActive());
- Maintenance::activate();
- $this->assertTrue(Maintenance::isActive());
- Maintenance::deactivate();
- $this->assertFalse(Maintenance::isActive());
- }
-
- /**
- * Ohne Selbstheilung legt ein Absturz mitten im Update die Installation
- * dauerhaft lahm - und niemand kaeme mehr an die Oberflaeche, um den
- * Modus abzuschalten.
- */
- public function testMaintenanceHealsItselfAfterExpiry(): void
- {
- file_put_contents(
- $this->tmp . '/storage/.maintenance',
- json_encode(['since' => time() - 7200, 'until' => time() - 60])
- );
-
- $this->assertFalse(Maintenance::isActive(), 'Abgelaufene Wartung darf nicht mehr greifen');
- $this->assertFileDoesNotExist($this->tmp . '/storage/.maintenance', 'und wird dabei aufgeraeumt');
- }
-
- // -------------------------------------------------------------- Fortschritt
-
- public function testProgressIsWrittenAndRead(): void
- {
- Progress::set(42, 'download', 'Update wird geladen …');
- $state = Progress::get();
-
- $this->assertSame(42, $state['pct']);
- $this->assertSame('download', $state['step']);
- $this->assertSame('Update wird geladen …', $state['text']);
- $this->assertTrue(Progress::isRunning());
- }
-
- /** pct = -1 trennt "fehlgeschlagen" eindeutig von "0 % erledigt". */
- public function testProgressErrorStateIsDistinguishable(): void
- {
- Progress::error('Der Update-Dienst ist nicht erreichbar.');
- $state = Progress::get();
-
- $this->assertSame(-1, $state['pct']);
- $this->assertSame('error', $state['step']);
- $this->assertFalse(Progress::isRunning());
- }
-
- /** Ein abgestuerzter Lauf darf den naechsten nicht dauerhaft blockieren. */
- public function testStaleProgressDoesNotCountAsRunning(): void
- {
- file_put_contents($this->tmp . '/storage/.update-progress', json_encode([
- 'pct' => 50,
- 'step' => 'extract',
- 'text' => 'haengt seit gestern',
- 'ts' => time() - (Progress::STALE_AFTER + 60),
- ]));
-
- $this->assertFalse(Progress::isRunning());
- }
-
- // ------------------------------------------------------------- ZIP-Slip
-
- public function testEntryNamesOutsideTheArchiveAreRejected(): void
- {
- foreach (['../evil.php', 'a/../../evil.php', '/etc/passwd', 'C:\\windows\\evil', "ok\0.php"] as $bad) {
- $this->assertFalse(Updater::isSafeEntryName($bad), 'Abgelehnt werden muss: ' . $bad);
- }
- foreach (['index.php', 'admin/index.php', 'a/b/c.txt'] as $good) {
- $this->assertTrue(Updater::isSafeEntryName($good));
- }
- }
-
- public function testZipSlipEntryNeverLandsOutsideTheStagingArea(): void
- {
- $zipPath = $this->tmp . '/slip.zip';
- $zip = new \ZipArchive();
- $this->assertTrue($zip->open($zipPath, \ZipArchive::CREATE) === true);
- $zip->addFromString('harmlos.txt', 'ok');
- $zip->addFromString('../evil.txt', 'boesartig');
- $zip->addFromString('a/../../auch-boese.txt', 'boesartig');
- $zip->close();
-
- $staging = $this->tmp . '/staging';
- $updater = new Updater(null, null, 'stable', null, $this->tmp . '/root');
- $written = $updater->extractZip($zipPath, $staging);
-
- $this->assertSame(1, $written, 'Nur der harmlose Eintrag darf ankommen');
- $this->assertFileExists($staging . '/harmlos.txt');
- $this->assertFileDoesNotExist($this->tmp . '/evil.txt');
- $this->assertFileDoesNotExist($this->tmp . '/auch-boese.txt');
- }
-
- // ------------------------------------------------------- Geschuetzte Pfade
-
- public function testProtectedPathsAreRecognised(): void
- {
- $this->assertTrue(Updater::isProtected('config.php'));
- $this->assertTrue(Updater::isProtected('uploads/logo.png'));
- $this->assertTrue(Updater::isProtected('updater/storage/.version'));
- $this->assertFalse(Updater::isProtected('index.php'));
- $this->assertFalse(Updater::isProtected('updater/Updater.php'));
- $this->assertFalse(Updater::isProtected('uploads.php'), 'Der Ordnername darf nicht auf Dateien durchschlagen');
- }
-
- public function testApplyStagingKeepsProtectedFilesAndUpdatesTheRest(): void
- {
- $root = $this->tmp . '/root';
- mkdir($root . '/uploads', 0775, true);
- file_put_contents($root . '/config.php', 'tmp . '/staging-apply';
- mkdir($staging . '/uploads', 0775, true);
- file_put_contents($staging . '/config.php', 'applyStaging($staging);
-
- $this->assertSame('assertSame('altes Logo', file_get_contents($root . '/uploads/logo.png'));
- $this->assertSame('neu', file_get_contents($root . '/index.php'));
- $this->assertSame('neue Datei', file_get_contents($root . '/neu.php'));
- $this->assertSame(2, $applied, 'Nur die ungeschuetzten Dateien zaehlen');
- }
-
- public function testApplyStagingLeavesNoHalfWrittenFiles(): void
- {
- $root = $this->tmp . '/root2';
- mkdir($root, 0775, true);
- $staging = $this->tmp . '/staging2';
- mkdir($staging, 0775, true);
- file_put_contents($staging . '/index.php', 'applyStaging($staging);
-
- $this->assertFileExists($root . '/index.php');
- $this->assertFileDoesNotExist($root . '/index.php.new', 'Die Zwischendatei muss verschwinden');
- }
-
- // ------------------------------------------------------------ Migrationen
-
- public function testMigrationRunnerCountsOnlyPendingFiles(): void
- {
- $dir = $this->tmp . '/migrations';
- mkdir($dir, 0775, true);
- file_put_contents($dir . '/0001_erste.sql', 'CREATE TABLE test_a (id INTEGER PRIMARY KEY);');
- file_put_contents($dir . '/0002_zweite.sql', 'CREATE TABLE test_b (id INTEGER PRIMARY KEY);');
-
- $pdo = new \PDO('sqlite::memory:');
- $pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
- $runner = new MigrationRunner($pdo, $dir, $this->tmp . '/storage');
-
- $this->assertCount(2, $runner->runPending(true));
- $this->assertCount(0, $runner->runPending(true), 'Ein zweiter Lauf hat nichts mehr zu tun');
-
- $status = $runner->status();
- $this->assertCount(2, $status);
- $this->assertTrue($status[0]['applied']);
- }
-
- /** Der Fingerabdruck entscheidet, ob ueberhaupt migriert wird. */
- public function testMigrationFingerprintChangesWithTheFiles(): void
- {
- $dir = $this->tmp . '/migrations-fp';
- mkdir($dir, 0775, true);
- file_put_contents($dir . '/0001_a.sql', 'SELECT 1;');
- $before = \Updater\AutoMigrate::fingerprint($dir);
-
- file_put_contents($dir . '/0002_b.sql', 'SELECT 1;');
- $after = \Updater\AutoMigrate::fingerprint($dir);
-
- $this->assertNotSame($before, $after);
- $this->assertSame($after, \Updater\AutoMigrate::fingerprint($dir), 'Ohne Aenderung bleibt er gleich');
- }
-
- // -------------------------------------------------------------- Changelog
-
- public function testChangelogIsSplitIntoVersions(): void
- {
- $markdown = "# Änderungsprotokoll\n\n## 3.0.0 – 2026-09-25\n\n- Selbst-Updater\n- Wartungsmodus\n\n## 2.9.0 – 2026-09-24\n\n- Display-Seiten\n";
- $sections = Changelog::sections($markdown);
-
- $this->assertCount(2, $sections);
- $this->assertSame('3.0.0', $sections[0]['version']);
- $this->assertStringContainsString('Selbst-Updater', $sections[0]['text']);
- $this->assertSame('2.9.0', $sections[1]['version']);
- }
-
- public function testChangelogRendersListsAndKeepsUnsafeLinksOut(): void
- {
- $html = Changelog::toHtml("- Erster Punkt mit **Nachdruck**\n- [Doku](https://example.com/doku)\n- [Böse](javascript:alert(1))\n");
-
- $this->assertStringContainsString('