Allow disabling remote push in overrides.inc.php.
This commit is contained in:
parent
82ec577987
commit
8ff85b54e7
|
@ -81,6 +81,10 @@ return [
|
||||||
// for a SECTION. Comma separated list ex: 'rocksolid,section3,section5',
|
// for a SECTION. Comma separated list ex: 'rocksolid,section3,section5',
|
||||||
'insert_disable' => 'sectionONE, sectionTWO',
|
'insert_disable' => 'sectionONE, sectionTWO',
|
||||||
|
|
||||||
|
// Disable pushing articles to remote server for these sections
|
||||||
|
// (replace 'testsection...' with your choice of sections)
|
||||||
|
'disable_remote_push' => array("testsectionone", "testsectiontwo"),
|
||||||
|
|
||||||
// Disable posting attachments by section
|
// Disable posting attachments by section
|
||||||
// List section names to disable:
|
// List section names to disable:
|
||||||
// array("sectionONE", "sectionTWO", "sectionETC"),
|
// array("sectionONE", "sectionTWO", "sectionETC"),
|
||||||
|
|
|
@ -144,7 +144,18 @@ foreach ($menulist as $menu) {
|
||||||
}
|
}
|
||||||
$menuitem = explode(':', $menu);
|
$menuitem = explode(':', $menu);
|
||||||
chdir("../" . $menuitem[0]);
|
chdir("../" . $menuitem[0]);
|
||||||
if ($CONFIG['remote_server'] !== '') {
|
|
||||||
|
$this_config_name = $menuitem[0];
|
||||||
|
if(file_exists($config_dir.$this_config_name.'.inc.php')) {
|
||||||
|
$config_file = $config_dir.$this_config_name.'.inc.php';
|
||||||
|
} else {
|
||||||
|
$config_file = $config_dir.'rslight.inc.php';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this_CONFIG = include($config_file);
|
||||||
|
file_put_contents($debug_log, "\n" . format_log_date() . " Using " . $config_file . " for " . $menuitem[0], FILE_APPEND);
|
||||||
|
|
||||||
|
if ($this_CONFIG['remote_server'] !== '') {
|
||||||
# Send articles
|
# Send articles
|
||||||
echo "Sending articles\n";
|
echo "Sending articles\n";
|
||||||
echo exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/send.php");
|
echo exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/send.php");
|
||||||
|
@ -153,6 +164,8 @@ foreach ($menulist as $menu) {
|
||||||
exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/spoolnews.php");
|
exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/spoolnews.php");
|
||||||
echo "\nRefreshed spoolnews\n";
|
echo "\nRefreshed spoolnews\n";
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
file_put_contents($debug_log, "\n" . format_log_date() . " Remote disabled for " . $menuitem[0] . " (no remote server)", FILE_APPEND);
|
||||||
}
|
}
|
||||||
# Expire articles
|
# Expire articles
|
||||||
exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/expire.php");
|
exec($CONFIG['php_exec'] . " " . $config_dir . "/scripts/expire.php");
|
||||||
|
|
|
@ -54,7 +54,7 @@ echo "\nSend Done\r\n";
|
||||||
|
|
||||||
function post_articles($ns, $spooldir)
|
function post_articles($ns, $spooldir)
|
||||||
{
|
{
|
||||||
global $logfile, $config_name;
|
global $CONFIG, $OVERRIDES, $logfile, $debug_log, $config_name;
|
||||||
$outgoing_dir = $spooldir . "/" . $config_name . "/outgoing/";
|
$outgoing_dir = $spooldir . "/" . $config_name . "/outgoing/";
|
||||||
$fail_dir = $outgoing_dir . '/failed/';
|
$fail_dir = $outgoing_dir . '/failed/';
|
||||||
|
|
||||||
|
@ -66,6 +66,16 @@ function post_articles($ns, $spooldir)
|
||||||
return "No messages to send\r\n";
|
return "No messages to send\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check overrides.inc.php if this section is disabled for remote push
|
||||||
|
if (isset($OVERRIDES['disable_remote_push'])) {
|
||||||
|
foreach ($OVERRIDES['disable_remote_push'] as $disable) {
|
||||||
|
if ($config_name == $disable) {
|
||||||
|
file_put_contents($debug_log, "\n" . format_log_date() . " Remote push disabled for " . $config_name . " by override", FILE_APPEND);
|
||||||
|
return "Remote push disabled for this section: " . $config_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$messages = scandir($outgoing_dir);
|
$messages = scandir($outgoing_dir);
|
||||||
foreach ($messages as $message) {
|
foreach ($messages as $message) {
|
||||||
if (! is_file($outgoing_dir . $message)) {
|
if (! is_file($outgoing_dir . $message)) {
|
||||||
|
|
|
@ -447,6 +447,7 @@ function get_articles($ns, $group)
|
||||||
$bytes = $bytes + ($lines * 2);
|
$bytes = $bytes + ($lines * 2);
|
||||||
|
|
||||||
// Prefer Injection-Date to Date header
|
// Prefer Injection-Date to Date header
|
||||||
|
// Some newsreaders (PiaoHong) produce a Date header that php does not like
|
||||||
if (isset($injectiondate)) {
|
if (isset($injectiondate)) {
|
||||||
$artdate = $injectiondate;
|
$artdate = $injectiondate;
|
||||||
file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Used Injection-Date " . $artdate . " for: " . $mid[1], FILE_APPEND);
|
file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Used Injection-Date " . $artdate . " for: " . $mid[1], FILE_APPEND);
|
||||||
|
@ -464,7 +465,7 @@ function get_articles($ns, $group)
|
||||||
$dates_used[$article_date] = true;
|
$dates_used[$article_date] = true;
|
||||||
|
|
||||||
// Don't spool article if $banned or fails integrity test
|
// Don't spool article if $banned or fails integrity test
|
||||||
$integrity = check_article_integrity(file($articleHandle));
|
$integrity = check_article_integrity(file($articleHandle), $artdate);
|
||||||
if (($banned !== false) || ($integrity !== false)) {
|
if (($banned !== false) || ($integrity !== false)) {
|
||||||
unlink($articleHandle);
|
unlink($articleHandle);
|
||||||
if ($integrity) {
|
if ($integrity) {
|
||||||
|
|
Loading…
Reference in New Issue