From f5175dca32467dbfecfc1d058b99e7b0a19b9764 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 13 Feb 2019 08:34:10 +0100 Subject: buildmaster/deletion-links.php,lib/helper.php,packages/pkginfo.php: do not fail if memcache is unavailable --- packages/pkginfo.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'packages/pkginfo.php') diff --git a/packages/pkginfo.php b/packages/pkginfo.php index 7609d11..6cb3bab 100644 --- a/packages/pkginfo.php +++ b/packages/pkginfo.php @@ -26,8 +26,13 @@ require_once BASE . "/lib/mysql.php"; require_once BASE . "/lib/style.php"; $memcache = new Memcache; - $memcache -> connect('localhost', 11211) or die ('Memcached Connection Error'); - $pkgapi_reachable = $memcache -> get('pkgapi_reachable'); + if ($memcache -> connect('localhost', 11211)) { + $memcache_available = true; + $pkgapi_reachable = $memcache -> get('pkgapi_reachable'); + } else { + $memcache_available = false; + $pkgapi_reachable = false; + } $tld = explode('.', $_SERVER['HTTP_HOST']); end($tld); $tld = current($tld); @@ -43,9 +48,11 @@ require_once BASE . "/lib/style.php"; $pkgapi_reachable = 'YES'; else $pkgapi_reachable = 'NO'; - $memcache -> set('pkgapi_reachable', $pkgapi_reachable, 0, 300); + if ($memcache_available) + $memcache -> set('pkgapi_reachable', $pkgapi_reachable, 0, 300); } - $memcache -> close(); + if ($memcache_available) + $memcache -> close(); if ($pkgapi_reachable == 'YES') $skip_json_checks = false; else -- cgit v1.2.3-70-g09d2