diff --git a/db/pull.php b/db/pull.php index 321d1f5b082549a2667eb79579dc1ec4e15f1109..769ff8a1afea5c032232fc1e36d848debc00dac8 100644 --- a/db/pull.php +++ b/db/pull.php @@ -14,8 +14,8 @@ if (!in_array(PHP_SAPI, ['cgi-fcgi', 'cli'])) { } } +use DetectLanguage\DetectLanguage; use GeoIp2\Database\Reader; -use \DetectLanguage\DetectLanguage; use Poduptime\PodStatus; use RedBeanPHP\R; @@ -36,7 +36,7 @@ $sqldebug && R::fancyDebug(true); DetectLanguage::setApiKey(c('dlkey')); -$hour = date("H"); +$hour = date('H'); try { // Setup GeoIP Database @@ -100,7 +100,7 @@ foreach ($pods as $pod) { $link = "https://{$domain}/nodeinfo/1.0"; extract(_curl("https://{$domain}/.well-known/nodeinfo")); - $outputwellknown = $curl_body; + $outputwellknown = $curl_body; if ($outputwellknown !== false) { $info = json_decode($outputwellknown, true); @@ -128,7 +128,7 @@ foreach ($pods as $pod) { $jsonssl = ($outputssl ? json_decode($outputssl) : null); if ($jsonssl !== null) { - $version = $jsonssl->software->version ?? 0; + $version = $jsonssl->software->version ?? 0; preg_match_all('((?:\d(.|-)?)+(\.)\d+\.*)', $version, $sversion); $shortversion = $sversion[0][0] ?? '0.0.0.0'; $signup = ($jsonssl->openRegistrations ?? false) === true; @@ -254,15 +254,13 @@ foreach ($pods as $pod) { $d = new DOMDocument; libxml_use_internal_errors(true); extract(_curl("https://{$domain}/")); - $outputbody = $curl_body; + $outputbody = $curl_body; ($outputbody ? $d->loadHTML($outputbody) : $d->loadHTML('')); $hs = ''; - for($type=1; $type<6; $type++) - { - $h_es = $d->getElementsByTagName('h'.$type); - foreach($h_es as $h) - { + for ($type = 1; $type < 6; $type++) { + $h_es = $d->getElementsByTagName('h' . $type); + foreach ($h_es as $h) { if (strpos($h->textContent, 'JavaScript') === false) { $hs .= $h->textContent . ' '; } @@ -274,7 +272,7 @@ foreach ($pods as $pod) { } elseif ($hs) { $detectedlanguage = $language; } else { - $score -= 1; + $score -= 1; $detectedlanguage = null; } @@ -373,7 +371,7 @@ foreach ($pods as $pod) { if ($score > 100) { $score = 100; } elseif ($score < 0) { - $score = 0; + $score = 0; $status = PodStatus::SYSTEM_DELETED; } $weightedscore = ($uptime + $score - (10 - $weight)) / 2; @@ -478,7 +476,7 @@ function _curl($url) 'curl_error' => curl_error($chss), 'curl_info' => curl_getinfo($chss, CURLINFO_CERTINFO), 'curl_conntime' => curl_getinfo($chss, CURLINFO_CONNECT_TIME), - 'curl_nstime' => curl_getinfo($chss, CURLINFO_NAMELOOKUP_TIME) + 'curl_nstime' => curl_getinfo($chss, CURLINFO_NAMELOOKUP_TIME), ]; curl_close($chss); }