A retry of updating threads in spoolnews.php.

This commit is contained in:
Retro_Guy 2024-01-02 05:07:22 -07:00
parent 9013d73f2a
commit efae299d16
1 changed files with 25 additions and 10 deletions

View File

@ -87,12 +87,7 @@ if (is_file($sem)) {
unlink($sem);
$maxfirstrequest = 500;
}
if (filemtime($spooldir . '/' . $config_name . '-thread-timer') + 600 < time()) {
$timer = true;
touch($spooldir . '/' . $config_name . '-thread-timer');
} else {
$timer = false;
}
# Check for groups file, create if necessary
// only do remote server groups if necessary
if ($CONFIG['remote_server'] != '') {
@ -142,10 +137,30 @@ if ($CONFIG['remote_server'] != '') {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Retrieving articles for: " . $name[0] . "...", FILE_APPEND);
echo "\nRetrieving articles for: " . $name[0] . "...";
get_articles($ns, $name[0]);
if ($enable_rslight == 1) {
if (filemtime($spooldir . '/' . $name[0] . '-thread-timer') + 600 < time()) {
if (! $ns2) {
$ns2 = nntp_open();
}
if (! $ns2) {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Failed to connect to " . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'], FILE_APPEND);
// exit();
} else {
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Updating threads for: " . $name[0] . "...", FILE_APPEND);
thread_load_newsserver($ns2, $name[0], 0);
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Threads updated for: " . $name[0], FILE_APPEND);
// nntp_close($ns2);
}
touch($spooldir . '/' . $name[0] . '-thread-timer');
}
}
}
if ($ns2) {
nntp_close($ns2);
}
nntp_close($ns);
}
unlink($lockfile);
echo "\nSpoolnews Done\n";