Fix introduced bug with Xref mods. More fixes to come (less critical).
This commit is contained in:
parent
6d1823ed35
commit
a064a028fd
|
@ -28,10 +28,10 @@ if ($CONFIG['remote_server'] != '') {
|
||||||
$remote_groupfile = $spooldir . "/" . $config_name . "/" . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'] . ".txt";
|
$remote_groupfile = $spooldir . "/" . $config_name . "/" . $CONFIG['remote_server'] . ":" . $CONFIG['remote_port'] . ".txt";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(isset($OVERRIDES['save_nocem_messages']) && $OVERRIDES['save_nocem_messages'] == true) {
|
if (isset($OVERRIDES['save_nocem_messages']) && $OVERRIDES['save_nocem_messages'] == true) {
|
||||||
$save_nocem_messages = true;
|
$save_nocem_messages = true;
|
||||||
$nocem_dir = $spooldir."/saved_nocem";
|
$nocem_dir = $spooldir . "/saved_nocem";
|
||||||
@mkdir($nocem_dir.'/done', 0755, true);
|
@mkdir($nocem_dir . '/done', 0755, true);
|
||||||
} else {
|
} else {
|
||||||
$save_nocem_messages = false;
|
$save_nocem_messages = false;
|
||||||
}
|
}
|
||||||
|
@ -70,6 +70,7 @@ if (posix_getsid($pid) === false || ! is_file($lockfile)) {
|
||||||
file_put_contents($lockfile, getmypid()); // create lockfile
|
file_put_contents($lockfile, getmypid()); // create lockfile
|
||||||
} else {
|
} else {
|
||||||
print "Spoolnews currently running\n";
|
print "Spoolnews currently running\n";
|
||||||
|
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Spoolnews currently running...", FILE_APPEND);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,9 +140,11 @@ if ($CONFIG['remote_server'] != '') {
|
||||||
|
|
||||||
if ($enable_rslight == 1) {
|
if ($enable_rslight == 1) {
|
||||||
if ($timer) {
|
if ($timer) {
|
||||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Updating threads for: " . $name[0] . "...", FILE_APPEND);
|
if ($ns) {
|
||||||
echo 'Use ns2: ' . $ns2 . "\n";
|
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Updating threads for: " . $name[0] . "...", FILE_APPEND);
|
||||||
thread_load_newsserver($ns2, $name[0], 0);
|
echo 'Use ns2: ' . $ns2 . "\n";
|
||||||
|
thread_load_newsserver($ns2, $name[0], 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -283,6 +286,8 @@ function get_articles($ns, $group)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$articleHandle = $grouppath . "/" . $local;
|
$articleHandle = $grouppath . "/" . $local;
|
||||||
|
unlink($articleHandle);
|
||||||
|
unset($references);
|
||||||
$response = line_read($ns);
|
$response = line_read($ns);
|
||||||
$lines = 0;
|
$lines = 0;
|
||||||
$bytes = 0;
|
$bytes = 0;
|
||||||
|
@ -293,28 +298,11 @@ function get_articles($ns, $group)
|
||||||
while (strcmp($response, ".") != 0) {
|
while (strcmp($response, ".") != 0) {
|
||||||
$is_xref = false;
|
$is_xref = false;
|
||||||
$bytes = $bytes + mb_strlen($response, '8bit');
|
$bytes = $bytes + mb_strlen($response, '8bit');
|
||||||
if (trim($response) == "" || $lines > 0) {
|
if (trim($response) == "" && $lines > 0) {
|
||||||
// Create Xref: header
|
if ($is_header == 1) {
|
||||||
$current_article['xref'] = "Xref: " . $CONFIG['pathhost'];
|
|
||||||
foreach ($allgroups as $agroup) {
|
|
||||||
$agroup = trim($agroup);
|
|
||||||
if ((! testGroup($agroup)) || $agroup == '') {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if ($group == $agroup) {
|
|
||||||
$artnum = $local;
|
|
||||||
} else {
|
|
||||||
$artnum = get_next_article_number($agroup);
|
|
||||||
}
|
|
||||||
if ($artnum > 0) {
|
|
||||||
$current_article['xref'] .= ' ' . $agroup . ':' . $artnum;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($is_header != 0) {
|
|
||||||
file_put_contents($articleHandle, $current_article['xref'] . "\n", FILE_APPEND);
|
file_put_contents($articleHandle, $current_article['xref'] . "\n", FILE_APPEND);
|
||||||
}
|
}
|
||||||
$is_header = 0;
|
$is_header = 0;
|
||||||
$lines ++;
|
|
||||||
}
|
}
|
||||||
if ($is_header == 1) {
|
if ($is_header == 1) {
|
||||||
$response = str_replace("\t", " ", $response);
|
$response = str_replace("\t", " ", $response);
|
||||||
|
@ -357,6 +345,22 @@ function get_articles($ns, $group)
|
||||||
// Identify each group name for xref
|
// Identify each group name for xref
|
||||||
$groupnames = explode("Newsgroups: ", $response);
|
$groupnames = explode("Newsgroups: ", $response);
|
||||||
$allgroups = preg_split("/\ |\,/", $groupnames[1]);
|
$allgroups = preg_split("/\ |\,/", $groupnames[1]);
|
||||||
|
// Create Xref: header
|
||||||
|
$current_article['xref'] = "Xref: " . $CONFIG['pathhost'];
|
||||||
|
foreach ($allgroups as $agroup) {
|
||||||
|
$agroup = trim($agroup);
|
||||||
|
if ((! testGroup($agroup)) || $agroup == '') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ($group == $agroup) {
|
||||||
|
$artnum = $local;
|
||||||
|
} else {
|
||||||
|
$artnum = get_next_article_number($agroup);
|
||||||
|
}
|
||||||
|
if ($artnum > 0) {
|
||||||
|
$current_article['xref'] .= ' ' . $agroup . ':' . $artnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
$ref = 0;
|
$ref = 0;
|
||||||
}
|
}
|
||||||
if (stripos($response, "Xref: ") === 0) {
|
if (stripos($response, "Xref: ") === 0) {
|
||||||
|
@ -395,6 +399,7 @@ function get_articles($ns, $group)
|
||||||
// continue;
|
// continue;
|
||||||
}
|
}
|
||||||
$response = str_replace("\n", "", str_replace("\r", "", $response));
|
$response = str_replace("\n", "", str_replace("\r", "", $response));
|
||||||
|
$lines ++;
|
||||||
}
|
}
|
||||||
file_put_contents($articleHandle, $response . "\n", FILE_APPEND);
|
file_put_contents($articleHandle, $response . "\n", FILE_APPEND);
|
||||||
$lines = $lines - 1;
|
$lines = $lines - 1;
|
||||||
|
@ -408,11 +413,11 @@ function get_articles($ns, $group)
|
||||||
if ((strpos($CONFIG['nocem_groups'], $group) !== false) && ($CONFIG['enable_nocem'] == true)) {
|
if ((strpos($CONFIG['nocem_groups'], $group) !== false) && ($CONFIG['enable_nocem'] == true)) {
|
||||||
if (strpos($subject[1], $nocem_check) !== false) {
|
if (strpos($subject[1], $nocem_check) !== false) {
|
||||||
$is_from = address_decode($from[1], 'nowhere');
|
$is_from = address_decode($from[1], 'nowhere');
|
||||||
$nocem_file = tempnam($spooldir . "/nocem", $is_from[0]['mailbox'] . "@" . $is_from[0]['host'] . "[".date("Y.m.d.H.i.s")."]");
|
$nocem_file = tempnam($spooldir . "/nocem", $is_from[0]['mailbox'] . "@" . $is_from[0]['host'] . "[" . date("Y.m.d.H.i.s") . "]");
|
||||||
copy($grouppath . "/" . $local, $nocem_file);
|
copy($grouppath . "/" . $local, $nocem_file);
|
||||||
chmod($nocem_file, 0644);
|
chmod($nocem_file, 0644);
|
||||||
if($save_nocem_messages == true) {
|
if ($save_nocem_messages == true) {
|
||||||
$saved_nocem_file = tempnam($nocem_dir, $is_from[0]['mailbox'] . "@" . $is_from[0]['host'] . "[".date("Y.m.d.H.i.s")."]-");
|
$saved_nocem_file = tempnam($nocem_dir, $is_from[0]['mailbox'] . "@" . $is_from[0]['host'] . "[" . date("Y.m.d.H.i.s") . "]-");
|
||||||
copy($grouppath . "/" . $local, $saved_nocem_file);
|
copy($grouppath . "/" . $local, $saved_nocem_file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue