Changed notifications “levels”, removed “eecho”es when “notify” is used since it “eecho”es by itself
This commit is contained in:
parent
c84a838fbd
commit
e194bd597f
1 changed files with 10 additions and 12 deletions
|
@ -213,7 +213,7 @@ function truncs($str,$tab,$col,$ctx) {
|
|||
$size=$tables[$tab][$col];
|
||||
$len=mb_strlen($str,'UTF-8');
|
||||
if ($len>$size) {
|
||||
notify($ctx.': had to truncate to '.$size.' characters the value to be inserted into «'.$col.'» column in «'.$tab.'» table because it was too long ('.$len.' characters).',2);
|
||||
notify($ctx.': had to truncate to '.$size.' characters the value to be inserted into «'.$col.'» column in «'.$tab.'» table because it was too long ('.$len.' characters).',3);
|
||||
$str=mb_substr($str,0,$size-1,'UTF-8').'…';
|
||||
}
|
||||
return($str);
|
||||
|
@ -225,10 +225,10 @@ function truncn($num,$tab,$col,$ctx) {
|
|||
$tab=strtolower($tab);
|
||||
if (is_numeric($num)) {
|
||||
if ($num>$tables[$tab][$col]['max']) {
|
||||
notify($ctx.': had to ceil «'.$num.'» to «'.$tables[$tab][$col]['max'].'», ie the maximum value it can have in column «'.$col.'» of table «'.$tab.'».',2);
|
||||
notify($ctx.': had to ceil «'.$num.'» to «'.$tables[$tab][$col]['max'].'», ie the maximum value it can have in column «'.$col.'» of table «'.$tab.'».',3);
|
||||
$num=$tables[$tab][$col]['max'];
|
||||
} elseif ($num<$tables[$tab][$col]['min']) {
|
||||
notify($ctx.': had to floor «'.$num.'» to «'.$tables[$tab][$col]['min'].'», ie the minimum value it can have in column «'.$col.'» of table «'.$tab.'»).',2);
|
||||
notify($ctx.': had to floor «'.$num.'» to «'.$tables[$tab][$col]['min'].'», ie the minimum value it can have in column «'.$col.'» of table «'.$tab.'»).',3);
|
||||
$num=$tables[$tab][$col]['min'];
|
||||
}
|
||||
} else {
|
||||
|
@ -358,8 +358,9 @@ function subarimp($glue,$key,&$arr) {
|
|||
}
|
||||
|
||||
function notify($msg,$sev) {
|
||||
// notify "Severity" should be called "Importance"; anyway, it is to be thought of as "$lev" param of function "eecho": 0=debug, 1=info, 2=warning, 3=error
|
||||
global $link, $tables, $iswin, $opts;
|
||||
eecho(1,'*notification*: '.strip_tags($msg).N);
|
||||
eecho($sev,'*notification*: '.strip_tags($msg).N);
|
||||
$tab='Notifications';
|
||||
if ($iswin) $tab='notifications';
|
||||
if (!$opts['dryrun']) mysqli_query($link,'INSERT INTO Notifications (ID, Notification, Severity, Microtime, Seen, Deleted) VALUES (NULL, \''.myesc($link,mb_substr($msg,0,$tables[$tab]['Notification'],'UTF-8')).'\', '.$sev.', \''.microtime(true).'\', 0, 0)')
|
||||
|
@ -642,7 +643,7 @@ while ($i<$cinsts) {
|
|||
if (mysqli_num_rows($res)<1) {
|
||||
if (!$opts['dryrun']) mysqli_query($link,'INSERT INTO Platforms (Name) VALUES (\''.myesc($link,truncs($info['x-nodeinfo']['software']['name'],'Platforms','Name','«'.$info['uri'].'»')).'\')')
|
||||
or mexit(__LINE__.': '.mysqli_error($link).N,3);
|
||||
notify('New software found: «'.$info['uri'].'» runs on «'.$info['x-nodeinfo']['software']['name'].'»; i added it to the table of known softwares. It would be good to check whether it is a Mastodon derivate and how compatible it is, to decide whether to consider instances using it as Mastodon instances.',1);
|
||||
notify('New software found: «'.$info['uri'].'» runs on «'.$info['x-nodeinfo']['software']['name'].'»; i added it to the table of known softwares. It would be good to check whether it is a Mastodon derivate and how compatible it is, to decide whether to consider instances using it as Mastodon instances.',2);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -715,7 +716,7 @@ while ($i<$cinsts) {
|
|||
if ($now-$rrow['Time']>$opts['deadline']) {
|
||||
if (!$opts['dryrun']) mysqli_query($link,'UPDATE Instances SET Dead=1 WHERE ID='.$row['ID'])
|
||||
or mexit(__LINE__.': '.mysqli_error($link).N,3);
|
||||
notify('Instance «<a href="viewinst.php?id='.$row['ID'].'">'.$row['URI'].'</a>» is dead!',1);
|
||||
notify('Instance «<a href="viewinst.php?id='.$row['ID'].'">'.$row['URI'].'</a>» is dead!',2);
|
||||
}
|
||||
} else {
|
||||
eecho(2,'«'.$host.'» exists in the database but there’s no data about it in InstChecks! I’ll remedy.'.N);
|
||||
|
@ -733,8 +734,7 @@ while ($i<$cinsts) {
|
|||
$instid=0;
|
||||
}
|
||||
} else {
|
||||
eecho(3,'table «Instances» has «'.$nrows.'» entries for instance «'.$host.'»!'.N);
|
||||
notify('Instance «'.$row['URI'].'» has «'.$nrows.'» entries in «Instances» table!',1);
|
||||
notify('Instance «'.$row['URI'].'» has «'.$nrows.'» entries in «Instances» table!',3);
|
||||
}
|
||||
} else {
|
||||
|
||||
|
@ -863,8 +863,7 @@ while ($i<$cinsts) {
|
|||
$instrow['New']=1;
|
||||
if ($now-$oldinstrow['FirstSeen']>$opts['oldline']) {
|
||||
$instrow['New']=0;
|
||||
eecho(1,'«'.$row['URI'].'» is no longer new.'.N);
|
||||
notify('Instance «<a href="viewinst.php?id='.$row['ID'].'">'.$row['URI'].'</a>» is no longer new.',1);
|
||||
notify('Instance «<a href="viewinst.php?id='.$row['ID'].'">'.$row['URI'].'</a>» is no longer new.',2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -984,8 +983,7 @@ while ($i<$cinsts) {
|
|||
notify('New instance «<a href="viewinst.php?id='.$instid.'">'.$instrow['URI'].'</a>» is suitable!',1);
|
||||
|
||||
} else {
|
||||
eecho(3,'table «Instances» has «'.$nrows.'» entries for instance «'.$host.'»!'.N);
|
||||
notify('Instance «'.$row['URI'].'» has «'.$nrows.'» entries in «Instances» table!',1);
|
||||
notify('Instance «'.$row['URI'].'» has «'.$nrows.'» entries in «Instances» table!',3);
|
||||
}
|
||||
|
||||
if (array_key_exists('x-activity',$info) && is_array($info['x-activity'])) {
|
||||
|
|
Loading…
Reference in a new issue