initial prototype based on nat-as-server
Some checks failed
PHPUnit / test (push) Has been cancelled

This commit is contained in:
tom.hempel
2026-06-29 12:39:55 +02:00
commit f1caa9e681
148 changed files with 34905 additions and 0 deletions

21
cli/cleanup_sessions.php Normal file
View File

@ -0,0 +1,21 @@
<?php
/**
* CLI: Remove expired sessions from the database.
* Usage: php cli/cleanup_sessions.php
*/
if (php_sapi_name() !== 'cli') {
http_response_code(403);
echo "CLI only\n";
exit(1);
}
require_once __DIR__ . '/../common.php';
require_once __DIR__ . '/../db_init.php';
[$pdo, $tmpDb, $lockFp] = qdb_open(true);
$stmt = $pdo->prepare("DELETE FROM session WHERE expiresAt < :now");
$stmt->execute([':now' => time()]);
$removed = $stmt->rowCount();
qdb_save($tmpDb, $lockFp);
echo "Removed $removed expired session(s).\n";