From 7b056b2952893a33bb4e7b2275d16ab2ba592d55 Mon Sep 17 00:00:00 2001 From: jdarwood007 Date: Fri, 21 Nov 2025 16:50:12 -0800 Subject: [PATCH] [3.0] Sqlite caching didn't always create a table Due to the journal mode changes, it seems that the table doesn't always get created because the file size can be larger than 0. But it still seems to be exactly 4096. Changed the check and added an exists to trying to create the table/index. --- Sources/Cache/APIs/Sqlite.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/Cache/APIs/Sqlite.php b/Sources/Cache/APIs/Sqlite.php index 619d50400a..ee56e75a80 100755 --- a/Sources/Cache/APIs/Sqlite.php +++ b/Sources/Cache/APIs/Sqlite.php @@ -98,9 +98,9 @@ public function connect(): bool $this->cacheDB->exec('PRAGMA journal_mode = wal;'); } - if (filesize($database) == 0) { - $this->cacheDB->exec('CREATE TABLE cache (key text unique, value blob, ttl int);'); - $this->cacheDB->exec('CREATE INDEX ttls ON cache(ttl);'); + if (filesize($database) <= 4096) { + $this->cacheDB->exec('CREATE TABLE IF NOT EXISTS cache (key text unique, value blob, ttl int);'); + $this->cacheDB->exec('CREATE INDEX IF NOT EXISTS ttls ON cache(ttl);'); } return true;