From fb59d348738b0e42723f1bb8ebf474fdcc9b5946 Mon Sep 17 00:00:00 2001 From: Alexandre <44178713+alexbelgium@users.noreply.github.com> Date: Tue, 26 Aug 2025 09:22:26 +0200 Subject: [PATCH] Open db in write only if needed --- scripts/species_tools.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/species_tools.php b/scripts/species_tools.php index 580341a..374405a 100644 --- a/scripts/species_tools.php +++ b/scripts/species_tools.php @@ -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 */