| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- declare(strict_types=1);
- require_once __DIR__ . "/../includes/auth.php";
- require_once __DIR__ . "/../includes/layout.php";
- require_once __DIR__ . "/../includes/backups.php";
- manageRequireLogin();
- $messages = [];
- $errors = [];
- if (($_SERVER["REQUEST_METHOD"] ?? "") === "POST") {
- try {
- manageRequireCsrf();
- $action = (string) ($_POST["action"] ?? "");
- if ($action === "save_retention") {
- manageBackupWriteSettings([
- "retention" => (int) ($_POST["retention"] ?? 0),
- "s3_retention" => (int) ($_POST["s3_retention"] ?? 0),
- ]);
- // Retention changes take effect immediately, not only on next upload.
- manageBackupApplyRetentionAll();
- $messages[] = "Aufbewahrung gespeichert und angewendet.";
- }
- } catch (Throwable $exception) {
- $errors[] = $exception->getMessage();
- }
- }
- $settings = manageBackupSettings();
- $s3Log = manageLogS3Tail(30);
- // Everything an operator needs to sanity-check a deployment at a glance.
- $diagnostics = [
- "Produkt" => manageProductName(),
- "Paket-Präfix" => (string) MANAGE_PACKAGE_PREFIX,
- "Öffentliche URL" => trim((string) MANAGE_PUBLIC_URL) !== "" ? (string) MANAGE_PUBLIC_URL : "NICHT GESETZT",
- "Storage-Verzeichnis" => manageStorageDir(),
- "Storage beschreibbar" => is_writable(manageStorageDir()) ? "ja" : "NEIN",
- "Admin-Passwort" => managePasswordConfigured() ? "konfiguriert" : "NICHT KONFIGURIERT",
- "S3-Archiv" => manageS3Enabled() ? "aktiv" : "aus",
- "PHP-Version" => PHP_VERSION,
- "upload_max_filesize" => (string) ini_get("upload_max_filesize"),
- "post_max_size" => (string) ini_get("post_max_size"),
- ];
- manageRenderHeader("Einstellungen", $messages, $errors);
- ?>
- <h2>Aufbewahrung</h2>
- <form method="POST" class="panel">
- <?php echo manageCsrfField(); ?>
- <input type="hidden" name="action" value="save_retention">
- <div class="form-row">
- <div class="form-group">
- <label for="retention">Lokale Backups pro Instanz</label>
- <input type="number" id="retention" name="retention" min="1" required
- value="<?php echo (int) $settings["retention"]; ?>">
- <p class="hint">Mindestens 1. Bei aktivem S3 gilt dieser Wert nur für die lokale Kopie.</p>
- </div>
- <div class="form-group">
- <label for="s3_retention">S3-Backups pro Instanz</label>
- <input type="number" id="s3_retention" name="s3_retention" min="1" required
- value="<?php echo (int) $settings["s3_retention"]; ?>">
- <p class="hint">Nur wirksam, wenn das S3-Archiv aktiviert ist.</p>
- </div>
- </div>
- <button type="submit" class="btn">Speichern und anwenden</button>
- </form>
- <h2>Diagnose</h2>
- <div class="table-scroll">
- <table class="data-table">
- <tbody>
- <?php foreach ($diagnostics as $label => $value): ?>
- <tr>
- <th scope="row"><?php echo manageEscape($label); ?></th>
- <td><code><?php echo manageEscape($value); ?></code></td>
- </tr>
- <?php endforeach; ?>
- </tbody>
- </table>
- </div>
- <h2>Zugangsdaten</h2>
- <p>
- Passwort und S3-Zugangsdaten stehen ausschließlich in <code>config.php</code> und werden hier bewusst nicht
- bearbeitbar gemacht. Neuen Passwort-Hash erzeugen:
- </p>
- <pre class="code-block">php -r 'echo password_hash("neues-passwort", PASSWORD_DEFAULT), PHP_EOL;'</pre>
- <?php if (manageS3Enabled()): ?>
- <h2>S3-Protokoll</h2>
- <?php if ($s3Log === []): ?>
- <p class="empty">Keine S3-Meldungen protokolliert.</p>
- <?php else: ?>
- <pre class="code-block log-tail"><?php echo manageEscape(implode(PHP_EOL, $s3Log)); ?></pre>
- <?php endif; ?>
- <?php endif; ?>
- <?php manageRenderFooter(); ?>
|