Fixed cache directory auto-creating with SQLite (#247)

* Fixed cache directory auto-creating with SQLite

* Update CHANGELOG.md
This commit is contained in:
Roman Kelesidis 2023-09-17 17:34:27 +07:00 committed by GitHub
parent f7de89aa98
commit 8c893b4a32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -6,6 +6,7 @@
**Merged pull requests:**
- Release v2.1.5-2023.09 🎉
- Fixed cache directory auto-creating with SQLite [\#247](https://github.com/torrentpier/torrentpier-lts/pull/247) ([belomaxorka](https://github.com/belomaxorka))
- Minor improvements [\#245](https://github.com/torrentpier/torrentpier-lts/pull/245), [\#246](https://github.com/torrentpier/torrentpier-lts/pull/246) ([belomaxorka](https://github.com/belomaxorka))
## [v2.1.5-2023.08-HotFix](https://github.com/torrentpier/torrentpier-lts/tree/v2.1.5-2023.08-HotFix) (2023-09-17)

View File

@ -142,6 +142,24 @@ class sqlite_common extends cache_common
{
$this->cfg = array_merge($this->cfg, $cfg);
$this->dbg_enabled = sql_dbg_enabled();
// Creates filecache dir
$db_dir = dirname($this->cfg['db_file_path']);
if (!is_dir($db_dir))
{
if (!bb_mkdir($db_dir))
{
$create_error = "Cannot create {$this->engine} cache dir: $db_dir";
if (DBG_LOG)
{
dbg_log($create_error, "{$this->engine}-CACHE-mkdir-FAIL_" . time());
}
die($create_error);
}
}
}
function connect ()
@ -300,4 +318,4 @@ class sqlite_common extends cache_common
{
if (error_reporting()) trigger_error($msg, E_USER_ERROR);
}
}
}