diff --git a/Rocksolid_Light/rocksolid/article-flat.php b/Rocksolid_Light/rocksolid/article-flat.php index 8a381e3..70aa81e 100644 --- a/Rocksolid_Light/rocksolid/article-flat.php +++ b/Rocksolid_Light/rocksolid/article-flat.php @@ -114,8 +114,28 @@ if ($message) { $thread = thread_load($group); $subthread = thread_getsubthreadids($message->header->id, $thread); if (! $subthread) { + $date_window = 86400; + $msg_log_file = $spooldir . '/admin_msg_log.dat'; echo '
Group is rebuilding... Please try again later
'; - file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " GROUP ERROR: " . $group . " may need repair", FILE_APPEND); + $msg_from = 'admin'; + $msg_to = 'admin'; + $msg_body = format_log_date() . " " . $config_name . " GROUP ERROR: " . $group . " may need repair"; + $msg_body_2 = "\n\nRun maintenance.php -import " . $group; + if (file_exists($msg_log_file)) { + $admin_msg_log = unserialize(file_get_contents($msg_log_file)); + } else { + $admin_msg_log = array(); + } + if (! isset($admin_msg_log[$group])) { + $admin_msg_log[$group] = 0; + } + if ($admin_msg_log[$group] < (time() - $date_window)) { + $msg_subject = "ERROR in $group"; + send_admin_message($msg_to, $msg_from, $msg_subject, $msg_body . $msg_body_2); + $admin_msg_log[$group] = time(); + } + file_put_contents($msg_log_file, serialize($admin_msg_log)); + file_put_contents($debug_log, "\n" . $msg_body, FILE_APPEND); exit(); } if ($thread_articles == false) {