From e86c3b3a66e8f62c3c97ea6b15c29c80c999d1c6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 7 Dec 2018 10:47:43 +0100 Subject: packages/pkginfo.php: use site_is_reachable() to check if "https://pkgapi.arch32.tyzoid.com/package/" is reachable - abort fast if not --- packages/pkginfo.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'packages') diff --git a/packages/pkginfo.php b/packages/pkginfo.php index 1dea3ab..3a3fc2e 100644 --- a/packages/pkginfo.php +++ b/packages/pkginfo.php @@ -10,6 +10,21 @@ require_once BASE . "/lib/style.php"; else $skip_json_checks = false; + if (!$skip_json_checks) { + $memcache = new Memcache; + $memcache -> connect('localhost', 11211) or die ('Memcached Connection Error'); + $pkgapi_reachable = $memcache -> get('pkgapi_reachable'); + if ($pkgapi_reachable === false) { + if (site_is_reachable('https://pkgapi.arch32.tyzoid.com/package/')) + $pkgapi_reachable = 'YES'; + else + $pkgapi_reachable = 'NO'; + $memcache -> set('pkgapi_reachable', $pkgapi_reachable, 0, 300); + } + if ($pkgapi_reachable == 'NO') + $skip_json_checks = true; + } + if (!$skip_json_checks) { $json_content = json_decode( file_get_contents( -- cgit v1.2.3-70-g09d2