Avoid creating thread dbs for groups that do not exist.

This commit is contained in:
Retro_Guy 2024-06-02 08:04:07 -07:00
parent 7622cc4e3c
commit 057fca590a
2 changed files with 10 additions and 1 deletions

View File

@ -1 +1 @@
0.9.11
0.9.12

View File

@ -1748,6 +1748,15 @@ function mail_db_open($database, $table = 'messages')
function threads_db_open($database, $table = "threads")
{
global $spooldir, $logdir, $config_name;
$logfile = $logdir . '/debug.log';
$spooldir_len = strlen($spooldir);
$group = substr($database, $spooldir_len, (strlen($database) - $spooldir_len) - 9);
$group = trim($group, '/');
if (! get_section_by_group($group, true)) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Attempt to create: " . $database . " for: " . $group, FILE_APPEND);
return false;
}
try {
$dbh = new PDO('sqlite:' . $database);
} catch (PDOException $e) {