index : website | |
Archlinux32 website - obsolete | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-02-13 08:34:10 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-02-13 08:34:10 +0100 |
commit | f5175dca32467dbfecfc1d058b99e7b0a19b9764 (patch) | |
tree | c2929084babb8ff3854318adf2131a75fef16ae7 /lib/helper.php | |
parent | c8e86055394702bd8e257f78ff9a4a787116253d (diff) |
-rw-r--r-- | lib/helper.php | 15 |
diff --git a/lib/helper.php b/lib/helper.php index e10f46c..a9dba64 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -87,17 +87,24 @@ function git_url($repository,$type,$commit,$path,$line = null,$commit_is_hash = global $git_available; if (!isset($git_available)) { $memcache = new Memcache; - $memcache -> connect('localhost', 11211) or die ('Memcached Connection Error'); - $git_available = $memcache -> get('git_available'); + if ($memcache -> connect('localhost', 11211)) { + $git_available = $memcache -> get('git_available'); + $memcache_available = true; + } else { + $git_available = false; + $memcache_available = false; + } if ($git_available === false) { $git_available = preg_match( "/ 200 OK$/", get_headers("https://git.archlinux32.org/archlinux32/packages")[0] ); - $memcache -> set('git_available',$git_available,0,120); + if ($memcache_available) + $memcache -> set('git_available',$git_available,0,120); }; - $memcache -> close(); + if ($memcache_available) + $memcache -> close(); $git_available = $git_available == 1; } if (!isset($commit_is_hash)) |