forked from GithubBackups/tinyib
Potentially fix SQLite lock timeout
This commit is contained in:
parent
c09278028d
commit
5d191f3513
@ -40,4 +40,6 @@ RedirectMatch 404 (.*)\.logs$
|
|||||||
RedirectMatch 404 (.*)\.posts$
|
RedirectMatch 404 (.*)\.posts$
|
||||||
RedirectMatch 404 (.*)\.reports$
|
RedirectMatch 404 (.*)\.reports$
|
||||||
RedirectMatch 404 (.*)\.tinyib.db$
|
RedirectMatch 404 (.*)\.tinyib.db$
|
||||||
|
RedirectMatch 404 (.*)\.tinyib.db-wal$
|
||||||
|
RedirectMatch 404 (.*)\.tinyib.db-shm$
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
@ -12,8 +12,12 @@ if (!$db) {
|
|||||||
fancyDie("Could not connect to database: " . $db->lastErrorMsg());
|
fancyDie("Could not connect to database: " . $db->lastErrorMsg());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set lock timeout
|
||||||
$db->busyTimeout(60000);
|
$db->busyTimeout(60000);
|
||||||
|
|
||||||
|
// Set journal mode to write-ahead logging
|
||||||
|
$db->exec("PRAGMA journal_mode = wal");
|
||||||
|
|
||||||
// Create tables (when necessary)
|
// Create tables (when necessary)
|
||||||
$result = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='" . TINYIB_DBACCOUNTS . "'");
|
$result = $db->query("SELECT name FROM sqlite_master WHERE type='table' AND name='" . TINYIB_DBACCOUNTS . "'");
|
||||||
if (!$result->fetchArray()) {
|
if (!$result->fetchArray()) {
|
||||||
|
@ -11,6 +11,12 @@ if (!$db = sqlite_open(TINYIB_DBPATH, 0666, $error)) {
|
|||||||
fancyDie("Could not connect to database: " . $error);
|
fancyDie("Could not connect to database: " . $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set lock timeout
|
||||||
|
sqlite_busy_timeout($db, 60000);
|
||||||
|
|
||||||
|
// Set journal mode to write-ahead logging
|
||||||
|
sqlite_query($db, "PRAGMA journal_mode = wal");
|
||||||
|
|
||||||
// Create tables (when necessary)
|
// Create tables (when necessary)
|
||||||
$result = sqlite_query($db, "SELECT name FROM sqlite_master WHERE type='table' AND name='" . TINYIB_DBACCOUNTS . "'");
|
$result = sqlite_query($db, "SELECT name FROM sqlite_master WHERE type='table' AND name='" . TINYIB_DBACCOUNTS . "'");
|
||||||
if (sqlite_num_rows($result) == 0) {
|
if (sqlite_num_rows($result) == 0) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user