[core] add PetalBot to the list of bots
This commit is contained in:
parent
bd3c6647af
commit
d4c17598fb
2 changed files with 13 additions and 7 deletions
|
@ -166,6 +166,18 @@ function is_trusted_proxy(): bool
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function is_bot(): bool
|
||||||
|
{
|
||||||
|
$ua = $_SERVER["HTTP_USER_AGENT"] ?? "No UA";
|
||||||
|
return (
|
||||||
|
str_contains($ua, "Googlebot")
|
||||||
|
|| str_contains($ua, "YandexBot")
|
||||||
|
|| str_contains($ua, "bingbot")
|
||||||
|
|| str_contains($ua, "msnbot")
|
||||||
|
|| str_contains($ua, "PetalBot")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get real IP if behind a reverse proxy
|
* Get real IP if behind a reverse proxy
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -45,15 +45,9 @@ class Index extends Extension
|
||||||
|
|
||||||
$fast_page_limit = 500;
|
$fast_page_limit = 500;
|
||||||
|
|
||||||
$ua = $_SERVER["HTTP_USER_AGENT"] ?? "No UA";
|
|
||||||
if (
|
if (
|
||||||
SPEED_HAX
|
SPEED_HAX
|
||||||
&& (
|
&& is_bot()
|
||||||
str_contains($ua, "Googlebot")
|
|
||||||
|| str_contains($ua, "YandexBot")
|
|
||||||
|| str_contains($ua, "bingbot")
|
|
||||||
|| str_contains($ua, "msnbot")
|
|
||||||
)
|
|
||||||
&& (
|
&& (
|
||||||
$count_search_terms > 1
|
$count_search_terms > 1
|
||||||
|| ($count_search_terms == 1 && $search_terms[0][0] == "-")
|
|| ($count_search_terms == 1 && $search_terms[0][0] == "-")
|
||||||
|
|
Reference in a new issue