stop warning for lack of referer / user-agent - not having those is now pretty normal

This commit is contained in:
Shish 2020-03-27 19:42:46 +00:00
parent c16e3fd939
commit 85662575c5

View file

@ -551,18 +551,9 @@ class CommentList extends Extension
'website' => '',
'body' => $text,
'permalink' => '',
];
# akismet breaks if there's no referrer in the environment; so if there
# isn't, supply one manually
if (!isset($_SERVER['HTTP_REFERER'])) {
$comment['referrer'] = 'none';
log_warning("comment", "User '{$user->name}' commented with no referrer: $text");
}
if (!isset($_SERVER['HTTP_USER_AGENT'])) {
$comment['user_agent'] = 'none';
log_warning("comment", "User '{$user->name}' commented with no user-agent: $text");
}
'referrer' => $_SERVER['HTTP_REFERER'] ?? 'none',
'user_agent' => $_SERVER['HTTP_USER_AGENT'] ?? 'none',
];
$akismet = new Akismet(
$_SERVER['SERVER_NAME'],