Removed condition “FirstSeen IS NOT NULL” from all the queries since now it’s implied in “LastOkCheckTS>=$graceline”

This commit is contained in:
pezcurrel 2023-01-06 18:01:01 +01:00
parent b31dc0ca8f
commit 74ad6943e7

View file

@ -119,7 +119,7 @@ function presub() {
$link=mysqli_connect($conf['db_host'],$conf['db_user_name'],$conf['db_user_password'],$conf['db_name'],$conf['db_port'],$conf['db_socket']) or muorimeglio(_('Couldnt connect to database: ').mysqli_connect_error().' ['.mysqli_connect_errno().']',false);
mysqli_set_charset($link,'utf8mb4');
$res=mysqli_query($link,'SELECT COUNT(ID) AS tinsts, SUM(UserCount) AS tusers, SUM(StatusCount) AS tstatuses, SUM(ActiveUsersMonth) AS tactusers FROM Instances WHERE Instances.IsMastodon=1 AND Instances.FirstSeen IS NOT NULL AND Instances.LastOkCheckTS>='.$graceline) or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$res=mysqli_query($link,'SELECT COUNT(ID) AS tinsts, SUM(UserCount) AS tusers, SUM(StatusCount) AS tstatuses, SUM(ActiveUsersMonth) AS tactusers FROM Instances WHERE Instances.IsMastodon=1 AND Instances.LastOkCheckTS>='.$graceline) or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$row=mysqli_fetch_assoc($res);
echo(_('<div id="help" class="helpd"><p class="intro">This search engine for Mastodon instances is based on a database that gets updated by our crawler every night (CET). Instances are considered new for 30 days after they are discovered. When an instance has not responded to our daily checks for more than 30 days its no longer considered in statistics and searches and it gets checked only on the first of the month, rather than daily, until it possibly responds again. “Random ordering” of results varies daily.</p><p class="intro">Default search criteria reflect our fondness for a decentralized and egalitarian Fediverse and our attempt to exclude instances accepting fascist, racist, sexist, ableist or sovereignist contents by marking them as noxious.</p></div>').N);
printf(_('<p class="introe">We currently count <span class="statd">%s</span> Mastodon instances, with <span class="statd">%s</span> users (<span class="statd">%s</span> active during last month) and <span class="statd">%s</span> published statuses.</p>').N, fnum($row['tinsts'],0,$dlang), fnum($row['tusers'],0,$dlang), fnum($row['tactusers'],0,$dlang), fnum($row['tstatuses'],0,$dlang));
@ -235,7 +235,7 @@ echo('<form method="get" id="searchf" class="sdbox" onsubmit="presub();">
<select id="lang" name="lang" class="sselect">
<option value="0"'.$selected.'>'._('Irrelevant').'</option>'.N);
$res=mysqli_query($link,'SELECT Languages.ID AS Lid, CONCAT(Name'.$dlanguc.', \' [\', Code, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID LEFT JOIN Instances ON Instances.ID=InstOurLangs.InstID WHERE Instances.LastOkCheckTS>='.$graceline.' AND Instances.IsMastodon=1 AND InstOurLangs.Pos=1 GROUP BY Languages.ID ORDER BY Name'.$dlanguc.' ASC') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$res=mysqli_query($link,'SELECT Languages.ID AS Lid, CONCAT(Name'.$dlanguc.', \' [\', Code, \'] (\', COUNT(Languages.ID), \')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID LEFT JOIN Instances ON Instances.ID=InstOurLangs.InstID WHERE Instances.IsMastodon=1 AND Instances.LastOkCheckTS>='.$graceline.' AND InstOurLangs.Pos=1 GROUP BY Languages.ID ORDER BY Name'.$dlanguc.' ASC') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
while ($row=mysqli_fetch_assoc($res)) {
($_GET['lang']==$row['Lid']) ? $selected=' selected' : $selected='';
@ -324,7 +324,7 @@ swhelp();
$joins=array();
$wheres=array();
$wheres[]='Instances.LastOkCheckTS>='.$graceline.' AND Instances.IsMastodon=1 AND Instances.FirstSeen IS NOT NULL';
$wheres[]='Instances.IsMastodon=1 AND Instances.LastOkCheckTS>='.$graceline;
if ($_GET['exnox']==1) $wheres[]='Instances.Noxious=0';
if ($_GET['exregc']==1) $wheres[]='Instances.RegOpen=1';
if ($_GET['exappr']==1) $wheres[]='Instances.RegReqApproval=0';