Added code to set TotChecks and OkChecks

This commit is contained in:
pezcurrel 2022-12-30 18:12:07 +01:00
parent b9392a0c25
commit b40e474e76

View file

@ -529,17 +529,24 @@ if (!is_null($idata['IsMastodon'])) $idata['IsMastodon']=b2i($idata['IsMastodon'
if (is_null($oidata)) {
$query='INSERT INTO Instances SET ';
$idata['InsertTS']=$now;
$idata['TotChecks']=1;
if ($instanswered) {
$idata['FirstSeen']=$now;
$idata['LastOkCheckTS']=$now;
$idata['OkChecks']=1;
} else {
$idata['Thumb']='unavailable';
$idata['AdmAvatar']='unavailable';
$idata['OkChecks']=0;
}
} else {
$query='UPDATE Instances SET ';
($instanswered && is_null($oidata['FirstSeen'])) ? $idata['FirstSeen']=$now : $idata['FirstSeen']=$oidata['FirstSeen'];
($instanswered) ? $idata['LastOkCheckTS']=$now : $idata['LastOkCheckTS']=$oidata['LastOkCheckTS'];
$idata['TotChecks']=$oidata['TotChecks']+1;
$idata['OkChecks']=$oidata['OkChecks'];
if ($instanswered) $idata['OkChecks']++;
$idata['Priority']=$oidata['Priority'];
$idata['Visible']=$oidata['Visible'];
$idata['Noxious']=$oidata['Noxious'];