Added regexps check before adding an inst to “Instances” and “Peers” tables

This commit is contained in:
pezcurrel 2023-12-27 21:55:33 +01:00
parent 738fa8c864
commit 943c65b2ba

View file

@ -289,9 +289,10 @@ function crawl(&$list,$id) {
} }
} }
} }
if (!ckexarr($inst)) {
$responded=false; $responded=false;
lecho(1,'trying to load «'.$inst.s instance info...'.N); lecho(1,'trying to load «'.$inst.s instance info...'.N);
$instinfo=gurl('https://'.$inst.'/api/v1/instance/peers',$opts['timeout'],$opts['curltimeout']); $instinfo=gurl('https://'.$inst.'/api/v1/instance',$opts['timeout'],$opts['curltimeout']);
if ($instinfo['cont']===false) { if ($instinfo['cont']===false) {
lecho(2,'could not load «'.$inst.s instance info: '.$instinfo['emsg'].'.'.N); lecho(2,'could not load «'.$inst.s instance info: '.$instinfo['emsg'].'.'.N);
} else { } else {
@ -322,6 +323,9 @@ function crawl(&$list,$id) {
if ($responded) $query.=', LastOkCheckTS='.$now; if ($responded) $query.=', LastOkCheckTS='.$now;
myq($link,$query); myq($link,$query);
} }
} else {
lecho(2,'ignoring instance «'.$inst.'» because it matches an exclusion regexp: wont add it to «Instances» and «Peers» tables.'.N);
}
} }
unset($list); unset($list);
if (count($nlist)>0) { if (count($nlist)>0) {