Refined query for Threads stats

This commit is contained in:
pezcurrel 2023-12-25 13:04:54 +01:00
parent 72c2a9ea17
commit 6259a63552

View file

@ -146,11 +146,11 @@ function presub() {
$row=mysqli_fetch_assoc($res);
$metastats['unknown']=['instances'=>$row['Unknown'], 'users'=>nulltozero($row['UnknownU'])];
$res=mysqli_query($link,'SELECT COUNT(Instances.ID) AS Suspending, SUM(Instances.UserCount) AS SuspendingU FROM Instances LEFT JOIN InstBlocks ON InstBlocks.InstID=Instances.ID WHERE Instances.IsMastodon=1 AND Instances.BlockListAvailable=1 AND Instances.LastOkCheckTS>='.$graceline.' AND (InstBlocks.Domain="threads.net" OR InstBlocks.Domain="www.threads.net") AND InstBlocks.Severity="suspend"') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$res=mysqli_query($link,'SELECT COUNT(Instances.ID) AS Suspending, SUM(Instances.UserCount) AS SuspendingU FROM Instances LEFT JOIN InstBlocks ON InstBlocks.InstID=Instances.ID WHERE Instances.IsMastodon=1 AND Instances.BlockListAvailable=1 AND Instances.LastOkCheckTS>='.$graceline.' AND (InstBlocks.Domain LIKE "%.threads.net" OR InstBlocks.Domain="threads.net") AND InstBlocks.Severity="suspend"') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$row=mysqli_fetch_assoc($res);
$metastats['suspending']=['instances'=>$row['Suspending'], 'users'=>nulltozero($row['SuspendingU'])];
$res=mysqli_query($link,'SELECT COUNT(Instances.ID) AS Silencing, SUM(Instances.UserCount) AS SilencingU FROM Instances LEFT JOIN InstBlocks ON InstBlocks.InstID=Instances.ID WHERE Instances.IsMastodon=1 AND Instances.BlockListAvailable=1 AND Instances.LastOkCheckTS>='.$graceline.' AND (InstBlocks.Domain="threads.net" OR InstBlocks.Domain="www.threads.net") AND InstBlocks.Severity="silence"') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$res=mysqli_query($link,'SELECT COUNT(Instances.ID) AS Silencing, SUM(Instances.UserCount) AS SilencingU FROM Instances LEFT JOIN InstBlocks ON InstBlocks.InstID=Instances.ID WHERE Instances.IsMastodon=1 AND Instances.BlockListAvailable=1 AND Instances.LastOkCheckTS>='.$graceline.' AND (InstBlocks.Domain LIKE "%.threads.net" OR InstBlocks.Domain="threads.net") AND InstBlocks.Severity="silence"') or muorimeglio(__LINE__.': '.mysqli_error($link),true);
$row=mysqli_fetch_assoc($res);
$metastats['silencing']=['instances'=>$row['Silencing'], 'users'=>nulltozero($row['SilencingU'])];