Skip to content

A live bird collage card for your Home Assistant dashboard.

Open db in write only if needed

Alexandrefb59d348738b
diff --git a/scripts/species_tools.php b/scripts/species_tools.php
index 580341ae..374405ae 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 */