Open db in write only if needed

This commit is contained in:
Alexandre
2025-08-26 09:22:26 +02:00
committed by Nachtzuster
parent 97fa0c5e11
commit fb59d34873
+3 -1
View File
@@ -7,7 +7,9 @@ require_once __DIR__ . '/common.php';
ensure_authenticated();
$home = get_home();
$db = new SQLite3(__DIR__ . '/birds.db', SQLITE3_OPEN_READWRITE);
// Open database read-only for typical operations; enable writes only for deletions
$flags = isset($_GET['delete']) ? SQLITE3_OPEN_READWRITE : SQLITE3_OPEN_READONLY;
$db = new SQLite3(__DIR__ . '/birds.db', $flags);
$db->busyTimeout(1000);
/* Paths / lists */