Webhook-Events & Health-Endpoint
- Notifier: controllerUnreachable, loginNewIp, updateAvailable - Login von neuer IP -> Webhook (Abgleich gegen audit_log) - cron_sync meldet nicht erreichbare Controller; cron_cleanup prüft täglich optional auf Updates und meldet Verfügbarkeit - health.php: Status-Endpoint (DB; optional Controller per ?deep=1&token=)
This commit is contained in:
parent
c7f9b7d39c
commit
0b1d4ec3b8
5 changed files with 116 additions and 0 deletions
|
|
@ -23,6 +23,7 @@ if (!$isCli) {
|
|||
|
||||
require_once __DIR__ . '/config.php';
|
||||
require_once __DIR__ . '/includes/Database.php';
|
||||
require_once __DIR__ . '/includes/Notifier.php';
|
||||
|
||||
function out($data, $isCli) {
|
||||
if ($isCli) {
|
||||
|
|
@ -101,6 +102,24 @@ try {
|
|||
$deleted['reset_tokens'] = $stmt->rowCount();
|
||||
} catch (Exception $e) { /* Tabelle evtl. nicht vorhanden */ }
|
||||
|
||||
// Optionaler täglicher Update-Check mit Webhook-Hinweis (Updater isoliert,
|
||||
// daher nur falls vorhanden und nur einmal pro Tag).
|
||||
$bootstrap = __DIR__ . '/updater/bootstrap.php';
|
||||
if (is_file($bootstrap)) {
|
||||
$lastCheck = $db->getSetting('last_update_check', '');
|
||||
if (!$lastCheck || strtotime($lastCheck) < strtotime('-23 hours')) {
|
||||
try {
|
||||
require_once $bootstrap;
|
||||
$mgr = \Updater\UpdaterFactory::create($db, null);
|
||||
$res = $mgr->checkForUpdates();
|
||||
if (!empty($res['has_update'])) {
|
||||
Notifier::updateAvailable($res['latest_sha'] ?? '');
|
||||
}
|
||||
} catch (\Throwable $e) { /* Update-Check nie blockierend */ }
|
||||
$db->setSetting('last_update_check', date('Y-m-d H:i:s'));
|
||||
}
|
||||
}
|
||||
|
||||
$db->query(
|
||||
"INSERT INTO settings (setting_key, setting_value) VALUES ('last_cleanup', NOW())
|
||||
ON DUPLICATE KEY UPDATE setting_value = NOW()"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue