Add admin notification of possble broken group.

This commit is contained in:
Retro_Guy 2023-09-26 05:48:04 -07:00
parent b5b6f05100
commit ebf43579ff
1 changed files with 21 additions and 1 deletions

View File

@ -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 '<center>Group is rebuilding... Please try again later</center>';
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) {