From 515a793464e4096c74825c7d271400d47ada730e Mon Sep 17 00:00:00 2001 From: ASVVVAD Date: Wed, 19 Aug 2020 01:12:56 +0000 Subject: [PATCH] Add support for custom SQLite database path --- inc/database_sqlite.php | 2 +- inc/database_sqlite3.php | 2 +- settings.default.php | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/inc/database_sqlite.php b/inc/database_sqlite.php index daeff65..7db007b 100644 --- a/inc/database_sqlite.php +++ b/inc/database_sqlite.php @@ -7,7 +7,7 @@ if (!function_exists('sqlite_open')) { fancyDie("SQLite library is not installed"); } -if (!$db = sqlite_open('tinyib.db', 0666, $error)) { +if (!$db = sqlite_open(TINYIB_DBPATH, 0666, $error)) { fancyDie("Could not connect to database: " . $error); } diff --git a/inc/database_sqlite3.php b/inc/database_sqlite3.php index 4c795b3..c727a93 100644 --- a/inc/database_sqlite3.php +++ b/inc/database_sqlite3.php @@ -7,7 +7,7 @@ if (!extension_loaded('sqlite3')) { fancyDie("SQLite3 extension is either not installed or loaded"); } -$db = new SQLite3('tinyib.db'); +$db = new SQLite3(TINYIB_DBPATH); if (!$db) { fancyDie("Could not connect to database: " . $db->lastErrorMsg()); } diff --git a/settings.default.php b/settings.default.php index 9abc5b4..b340225 100644 --- a/settings.default.php +++ b/settings.default.php @@ -93,6 +93,10 @@ define('TINYIB_DBUSERNAME', ''); // Username define('TINYIB_DBPASSWORD', ''); // Password define('TINYIB_DBNAME', ''); // Database +// Database configuration - SQLite3, SQLite +// The following only apply when TINYIB_DBMODE is set to sqlite3 or sqlite +define('TINYIB_DBPATH', 'tinyib.db'); // Sqlite DB path + // Database configuration - PDO // The following only apply when TINYIB_DBMODE is set to pdo (see README for instructions) define('TINYIB_DBDRIVER', 'mysql'); // PDO driver to use (mysql / pgsql / sqlite / etc.)