Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildmaster/deletion-links.php16
-rw-r--r--lib/helper.php16
-rw-r--r--packages/pkginfo.php16
3 files changed, 9 insertions, 39 deletions
diff --git a/buildmaster/deletion-links.php b/buildmaster/deletion-links.php
index f474dc5..6d21bda 100644
--- a/buildmaster/deletion-links.php
+++ b/buildmaster/deletion-links.php
@@ -15,15 +15,8 @@ if (isset($_GET["pkgname"]))
else
$filter = "";
-$memcache = new Memcache;
-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 = apcu_fetch('available_upstream_packages', $apcu_success);
+if ($apcu_success == false) {
$available_upstream_packages = explode(
"\n",
shell_exec(
@@ -32,11 +25,8 @@ if ($available_upstream_packages === false) {
"| sort -u"
)
);
- if ($memcache_available)
- $memcache -> set('available_upstream_packages',$available_upstream_packages,0,1800);
+ apcu_store('available_upstream_packages', $available_upstream_packages, 1800);
}
-if ($memcache_available)
- $memcache -> close();
mysql_run_query(
"CREATE TEMPORARY TABLE `available` (" .
diff --git a/lib/helper.php b/lib/helper.php
index a9dba64..73b97e8 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -86,25 +86,15 @@ function format_time_duration($val) {
function git_url($repository,$type,$commit,$path,$line = null,$commit_is_hash = null) {
global $git_available;
if (!isset($git_available)) {
- $memcache = new Memcache;
- 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 = apcu_fetch('git_available', $apcu_success);
+ if ($apcu_success == false) {
$git_available =
preg_match(
"/ 200 OK$/",
get_headers("https://git.archlinux32.org/archlinux32/packages")[0]
);
- if ($memcache_available)
- $memcache -> set('git_available',$git_available,0,120);
+ apcu_store('git_available', $git_available, 120);
};
- 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 6cb3bab..86f7100 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -25,14 +25,7 @@ require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
require_once BASE . "/lib/style.php";
- $memcache = new Memcache;
- if ($memcache -> connect('localhost', 11211)) {
- $memcache_available = true;
- $pkgapi_reachable = $memcache -> get('pkgapi_reachable');
- } else {
- $memcache_available = false;
- $pkgapi_reachable = false;
- }
+ $pkgapi_reachable = apcu_fetch('pkgapi_reachable', $apcu_success);
$tld = explode('.', $_SERVER['HTTP_HOST']);
end($tld);
$tld = current($tld);
@@ -43,16 +36,13 @@ require_once BASE . "/lib/style.php";
$protocol = 'https';
else
$protocol = 'http';
- if ($pkgapi_reachable === false) {
+ if ($apcu_success == false) {
if (site_is_reachable($protocol . '://pkgapi.archlinux32.' . $tld . '/'))
$pkgapi_reachable = 'YES';
else
$pkgapi_reachable = 'NO';
- if ($memcache_available)
- $memcache -> set('pkgapi_reachable', $pkgapi_reachable, 0, 300);
+ apcu_store('pkgapi_reachable', $pkgapi_reachable, 300);
}
- if ($memcache_available)
- $memcache -> close();
if ($pkgapi_reachable == 'YES')
$skip_json_checks = false;
else