Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-02-13 08:34:10 +0100
committerErich Eckner <git@eckner.net>2019-02-13 08:34:10 +0100
commitf5175dca32467dbfecfc1d058b99e7b0a19b9764 (patch)
treec2929084babb8ff3854318adf2131a75fef16ae7
parentc8e86055394702bd8e257f78ff9a4a787116253d (diff)
buildmaster/deletion-links.php,lib/helper.php,packages/pkginfo.php: do not fail if memcache is unavailable
-rw-r--r--buildmaster/deletion-links.php15
-rw-r--r--lib/helper.php15
-rw-r--r--packages/pkginfo.php15
3 files changed, 33 insertions, 12 deletions
diff --git a/buildmaster/deletion-links.php b/buildmaster/deletion-links.php
index 9f55c89..f474dc5 100644
--- a/buildmaster/deletion-links.php
+++ b/buildmaster/deletion-links.php
@@ -16,8 +16,13 @@ else
$filter = "";
$memcache = new Memcache;
-$memcache -> connect('localhost', 11211) or die ('Memcached Connection Error');
-$available_upstream_packages = $memcache -> get('available_upstream_packages');
+if ($memcache -> connect('localhost', 11211)) {
+ $memcache_available = true;
+ $available_upstream_packages = $memcache -> get('available_upstream_packages');
+} else {
+ $memcache_available = false;
+ $available_upstream_packages = false;
+}
if ($available_upstream_packages === false) {
$available_upstream_packages = explode(
"\n",
@@ -27,9 +32,11 @@ if ($available_upstream_packages === false) {
"| sort -u"
)
);
- $memcache -> set('available_upstream_packages',$available_upstream_packages,0,1800);
+ if ($memcache_available)
+ $memcache -> set('available_upstream_packages',$available_upstream_packages,0,1800);
}
-$memcache -> close();
+if ($memcache_available)
+ $memcache -> close();
mysql_run_query(
"CREATE TEMPORARY TABLE `available` (" .
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))
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