⚙ settings saving improvements + refactor - DB lock v0.1 #685

This commit is contained in:
jokob-sk
2024-05-29 19:24:43 +10:00
parent 3853b8a4ec
commit bb2beda12a
10 changed files with 334 additions and 302 deletions

View File

@@ -12,6 +12,8 @@
// DB File Path
$DBFILE = dirname(__FILE__).'/../../../db/app.db';
$db_locked = false;
//------------------------------------------------------------------------------
// Connect DB
//------------------------------------------------------------------------------
@@ -20,12 +22,21 @@ function SQLite3_connect ($trytoreconnect) {
try
{
// connect to database
global $db_locked;
$db_locked = false;
// return new SQLite3($DBFILE, SQLITE3_OPEN_READONLY);
return new SQLite3($DBFILE, SQLITE3_OPEN_READWRITE);
}
catch (Exception $exception)
{
// sqlite3 throws an exception when it is unable to connect
global $db_locked;
$db_locked = true;
// try to reconnect one time after 3 seconds
if($trytoreconnect)