summaryrefslogtreecommitdiff
path: root/packages/pkginfo.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-12-07 10:47:43 +0100
committerErich Eckner <git@eckner.net>2018-12-07 10:47:43 +0100
commite86c3b3a66e8f62c3c97ea6b15c29c80c999d1c6 (patch)
tree9d6a8f8bfbc64c9e076366b247c6a718e768e31a /packages/pkginfo.php
parent2fc12361785c7e874c25d6e79f73b76300fc0cbe (diff)
downloadarchweb32-e86c3b3a66e8f62c3c97ea6b15c29c80c999d1c6.tar.xz
packages/pkginfo.php: use site_is_reachable() to check if "https://pkgapi.arch32.tyzoid.com/package/" is reachable - abort fast if not
Diffstat (limited to 'packages/pkginfo.php')
-rw-r--r--packages/pkginfo.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index 1dea3ab..3a3fc2e 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -11,6 +11,21 @@ require_once BASE . "/lib/style.php";
$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(
"https://pkgapi.arch32.tyzoid.com/package/" .