From 057fca590a0b687815583007b86a4d269e0914f6 Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Sun, 2 Jun 2024 08:04:07 -0700 Subject: [PATCH] Avoid creating thread dbs for groups that do not exist. --- Rocksolid_Light/common/version.txt | 2 +- Rocksolid_Light/rocksolid/newsportal.php | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Rocksolid_Light/common/version.txt b/Rocksolid_Light/common/version.txt index 8225a4b..583b27a 100644 --- a/Rocksolid_Light/common/version.txt +++ b/Rocksolid_Light/common/version.txt @@ -1 +1 @@ -0.9.11 +0.9.12 diff --git a/Rocksolid_Light/rocksolid/newsportal.php b/Rocksolid_Light/rocksolid/newsportal.php index 0129f84..5860be7 100644 --- a/Rocksolid_Light/rocksolid/newsportal.php +++ b/Rocksolid_Light/rocksolid/newsportal.php @@ -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) {