Better logging to analyze unwanted messages from Diaspora

This commit is contained in:
Michael 2017-02-11 23:37:15 +00:00
parent a4dcd8be55
commit e5e6f4fd19

View file

@ -318,21 +318,22 @@ class Diaspora {
dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DIASPORA),
dbesc($msg["author"]) dbesc($msg["author"])
); );
if (dbm::is_result($r)) { if (dbm::is_result($r)) {
foreach ($r as $rr) { foreach ($r as $rr) {
logger("delivering to: ".$rr["username"]); logger("delivering to: ".$rr["username"]);
self::dispatch($rr,$msg); self::dispatch($rr,$msg);
} }
} else { } else {
logger("No subscribers for ".$msg["author"]." ".print_r($msg, true), LOGGER_DEBUG); $social_relay = (bool)Config::get('system', 'relay_subscribe', false);
}
$social_relay = (bool)Config::get('system', 'relay_subscribe', false); // Use a dummy importer to import the data for the public copy
if ($social_relay) {
// Use a dummy importer to import the data for the public copy $importer = array("uid" => 0, "page-flags" => PAGE_FREELOVE);
if (dbm::is_result($r) OR $social_relay) { $message_id = self::dispatch($importer,$msg);
$importer = array("uid" => 0, "page-flags" => PAGE_FREELOVE); } else {
$message_id = self::dispatch($importer,$msg); logger("Unwanted message from ".$msg["author"]." send by ".$_SERVER["REMOTE_ADDR"]." with ".$_SERVER["HTTP_USER_AGENT"].": ".print_r($msg, true), LOGGER_DEBUG);
}
} }
return $message_id; return $message_id;