prepare('INSERT INTO license_products (slug, name, default_cache_ttl_hours, notes) VALUES (:s, :n, :t, :notes)');
$stmt->execute([':s' => $slug, ':n' => $name, ':t' => $ttl, ':notes' => $notes]);
$msg = "Produkt '{$name}' wurde erfolgreich erstellt.";
} catch (Throwable $e) {
$msg = "Fehler beim Erstellen des Produkts: " . $e->getMessage();
$msgType = 'danger';
}
}
}
// Create License Key
if ($action === 'create_license') {
$productId = (int)($_POST['product_id'] ?? 0);
$customerName = trim($_POST['customer_name'] ?? '');
$customerEmail = trim($_POST['customer_email'] ?? '');
$maxActivations = (int)($_POST['max_activations'] ?? 2);
$expiresAt = !empty($_POST['expires_at']) ? $_POST['expires_at'] . ' 23:59:59' : null;
$notes = trim($_POST['notes'] ?? '');
if ($productId > 0) {
$licenseKey = KeyGen::generateKey();
try {
$stmt = $pdo->prepare('
INSERT INTO license_licenses (product_id, license_key, customer_name, customer_email, max_activations, expires_at, notes)
VALUES (:pid, :key, :cname, :cemail, :max, :exp, :notes)
');
$stmt->execute([
':pid' => $productId,
':key' => $licenseKey,
':cname' => $customerName,
':cemail' => $customerEmail,
':max' => $maxActivations,
':exp' => $expiresAt,
':notes' => $notes
]);
$msg = "Lizenzschlüssel erfolgreich generiert: {$licenseKey}";
} catch (Throwable $e) {
$msg = "Fehler bei Generierung: " . $e->getMessage();
$msgType = 'danger';
}
}
}
// Revoke License
if ($action === 'revoke_license') {
$licId = (int)($_POST['license_id'] ?? 0);
if ($licId > 0) {
$stmt = $pdo->prepare('UPDATE license_licenses SET status = "revoked" WHERE id = :id');
$stmt->execute([':id' => $licId]);
$msg = "Lizenz wurde widerrufen.";
}
}
// Add Update Release
if ($action === 'add_release') {
$productSlug = trim($_POST['product_slug'] ?? '');
$version = trim($_POST['version'] ?? '');
$url = trim($_POST['download_url'] ?? '');
$hash = trim($_POST['sha256_hash'] ?? '');
$notes = trim($_POST['release_notes'] ?? '');
$critical = isset($_POST['is_critical']);
if ($productSlug && $version && $url) {
$updMgr = new UpdateManager($pdo);
if ($updMgr->addRelease($productSlug, $version, $notes, $url, $hash, $critical)) {
$msg = "Release v{$version} für '{$productSlug}' gespeichert.";
} else {
$msg = "Fehler beim Speichern des Releases.";
$msgType = 'danger';
}
}
}
}
// Fetch stats & data
$productsCount = (int)$pdo->query('SELECT COUNT(*) FROM license_products')->fetchColumn();
$licensesCount = (int)$pdo->query('SELECT COUNT(*) FROM license_licenses')->fetchColumn();
$activationsCount = (int)$pdo->query('SELECT COUNT(*) FROM license_activations')->fetchColumn();
$monitorRepo = new MonitorRepo($pdo);
$monitors = $monitorRepo->getAllMonitors();
$monitorsUp = 0;
$monitorsWarning = 0;
$monitorsDown = 0;
foreach ($monitors as $m) {
if ($m['state'] === 'up') $monitorsUp++;
elseif ($m['state'] === 'warning') $monitorsWarning++;
else $monitorsDown++;
}
$eventLog = new EventLog($pdo);
$recentEvents = $eventLog->getRecentEvents(15);
$products = $pdo->query('SELECT * FROM license_products ORDER BY name ASC')->fetchAll();
$licenses = $pdo->query('
SELECT l.*, p.name as product_name, p.slug as product_slug,
(SELECT COUNT(*) FROM license_activations a WHERE a.license_id = l.id) as active_count
FROM license_licenses l
JOIN license_products p ON l.product_id = p.id
ORDER BY l.created_at DESC
')->fetchAll();
$updateMgr = new UpdateManager($pdo);
$releases = $updateMgr->getReleases();
?>
Deploymentcenter - Central Management
= $msg ?>
Produkte
= $productsCount ?>
Aktive Lizenzen
= $licensesCount ?>
Hardware Aktivierungen
= $activationsCount ?>
Watchdog Monitore
= $monitorsUp ?> /
= $monitorsWarning ?> /
= $monitorsDown ?>
| Source / Instanz |
Typ |
Status |
Letzte Meldung |
Zuletzt Gesehen |
| Keine Monitore registriert. |
| = htmlspecialchars($m['source']) ?> (= htmlspecialchars($m['instance']) ?>) |
= htmlspecialchars($m['type']) ?> |
= strtoupper($m['state']) ?>
|
= htmlspecialchars($m['last_message'] ?? '-') ?> |
= htmlspecialchars($m['last_seen_utc'] ?? 'Nie') ?> |
| Zeitpunkt (UTC) |
Source |
Event Kind |
Severity |
Nachricht |
| Keine Events vorhanden. |
| = htmlspecialchars($e['at_utc']) ?> |
= htmlspecialchars($e['source']) ?> |
= htmlspecialchars($e['kind']) ?> |
= strtoupper($e['severity']) ?> |
= htmlspecialchars($e['message'] ?? '-') ?> |
| Produkt |
Lizenzschlüssel |
Kunde |
Aktivierungen |
Status |
Ablaufdatum |
Aktion |
| Keine Lizenzen vorhanden. |
| = htmlspecialchars($l['product_name']) ?> |
= htmlspecialchars($l['license_key']) ?> |
= htmlspecialchars($l['customer_name'] ?? '-') ?> |
= $l['active_count'] ?> / = $l['max_activations'] ?> |
= strtoupper($l['status']) ?> |
= $l['expires_at'] ? htmlspecialchars($l['expires_at']) : 'Unbefristet' ?> |
|
Monitore und Agents senden Heartbeats an folgenden unauthentifizierten API-Endpunkt:
POST https://dc.mhdf.de/api/watchdog/v1/ping
| Produkt |
Version |
Download URL |
Release Datum |
| Noch keine Releases eingetragen. |
| = htmlspecialchars($r['product_slug']) ?> |
v= htmlspecialchars($r['version']) ?> |
= htmlspecialchars($r['download_url']) ?> |
= htmlspecialchars($r['created_at']) ?> |