new system prototype

This commit is contained in:
2026-04-15 10:19:42 +02:00
parent e805f225bc
commit 034b108c7e
80 changed files with 12212 additions and 890 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";