| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- <?php
- declare(strict_types=1);
- // Small status block for an existing settings page in the host application.
- //
- // Include it wherever a short "update available / last backup" summary belongs:
- //
- // <?php include __DIR__ . "/../manage-client/ui/status-partial.php"; ?>
- //
- // Renders nothing but a fragment: no <html>, no styles of its own beyond the
- // inline minimum, and it never throws. Set $manageStatusPanelUrl before the
- // include to link to the full panel.
- require_once dirname(__DIR__) . "/lib/client.php";
- /** @var string $manageStatusPanelUrl */
- $manageStatusPanelUrl = $manageStatusPanelUrl ?? "manage.php";
- $manageStatus = null;
- $manageStatusError = null;
- try {
- $manageStatus = manageClientStatus();
- } catch (Throwable $exception) {
- $manageStatusError = $exception->getMessage();
- }
- $manageStatusEscape = static function ($value): string {
- return htmlspecialchars((string) $value, ENT_QUOTES | ENT_SUBSTITUTE, "UTF-8");
- };
- ?>
- <div class="manage-status" style="border:1px solid #d9dde3;border-radius:8px;padding:.9rem 1rem;background:#fff;">
- <?php if ($manageStatusError !== null): ?>
- <p>Status nicht verfügbar: <?php echo $manageStatusEscape($manageStatusError); ?></p>
- <?php elseif ($manageStatus === null): ?>
- <p>Status nicht verfügbar.</p>
- <?php else: ?>
- <p>
- <strong>Version:</strong>
- <?php echo $manageStatusEscape($manageStatus["version"] !== "" ? $manageStatus["version"] : "unbekannt"); ?>
- <?php if ($manageStatus["update"] !== null && $manageStatus["update"]["available"]): ?>
- — <strong>Update <?php echo $manageStatusEscape($manageStatus["update"]["latest"]); ?> verfügbar</strong>
- <?php elseif ($manageStatus["update"] !== null): ?>
- — aktuell
- <?php elseif ($manageStatus["update_error"] !== null): ?>
- — <span title="<?php echo $manageStatusEscape($manageStatus["update_error"]); ?>">Update-Prüfung fehlgeschlagen</span>
- <?php endif; ?>
- </p>
- <p>
- <strong>Letztes Backup:</strong>
- <?php echo $manageStatusEscape($manageStatus["last_backup_at"] ?? "nie"); ?>
- (<?php echo count($manageStatus["backups"]); ?> lokal)
- </p>
- <?php if ($manageStatus["pending_migrations"] !== []): ?>
- <p><strong><?php echo count($manageStatus["pending_migrations"]); ?> offene Migration(en).</strong></p>
- <?php endif; ?>
- <p><a href="<?php echo $manageStatusEscape($manageStatusPanelUrl); ?>">Update & Backup verwalten</a></p>
- <?php endif; ?>
- </div>
|