#!/usr/bin/php . */ define('N',"\n"); define('SNAME',basename(__FILE__)); define('LIBDP','/../site/mustard/include'); require(__DIR__.LIBDP.'/parsetime.php'); require(__DIR__.LIBDP.'/gurl.php'); require(__DIR__.LIBDP.'/tables.php'); require(__DIR__.LIBDP.'/mb_ucfirst.php'); require(__DIR__.LIBDP.'/ghs.php'); require(__DIR__.LIBDP.'/ght.php'); require(__DIR__.'/lib/vendor/autoload.php'); use LanguageDetection\Language; use function mysqli_real_escape_string as myesc; (strtoupper(substr(PHP_OS,0,3))==='WIN') ? $iswin=true : $iswin=false; declare(ticks=1); if (function_exists('pcntl_signal')) { function signalHandler($signal) { echo(N); mexit('received signal «'.$signal.'», shutting down.'.N,0); } pcntl_signal(SIGTERM,'signalHandler');// Termination ('kill' was called) pcntl_signal(SIGHUP,'signalHandler');// Terminal log-out pcntl_signal(SIGINT,'signalHandler');// Interrupted (Ctrl-C is pressed) } $opts=[ 'hostname'=>null, 'timeout'=>10, 'deadline'=>60*24*60*60,// if an instance has not been responding for more than this value of seconds, declare it dead 'oldline'=>30*24*60*60,// if an instance has been new for a period longer than this amount, it's no longer new 'ldtoots'=>40,// number of toots to check with the automatic language detection function 'setnew'=>true, 'dryrun'=>false, 'jsonwrite'=>false, 'fetchusers'=>false, 'udiratts'=>5, 'udirfailst'=>90, 'logminmsglev'=>1, 'tuiminmsglev'=>1 ]; $msglevs=['debug', 'info', 'warning', 'error', 'none']; $ghtsa=[[' day',' days'],[' hour',' hours'],[' minute',' minutes'],[' second',' seconds']]; $help='SYNOPSIS '.SNAME.' [options] DESCRIPTION This script tries to fetch info about the fediverse instance at the given hostname and insert or update them in mastostart’s database. OPTIONS -N, --dontsetnew If this option is set, the script won’t mark a new instance as new. This can be useful for a first run. -D, --deadline