diff options
author | Erich Eckner <git@eckner.net> | 2018-08-02 08:53:35 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-08-02 08:53:35 +0200 |
commit | 6f4acf5ae6af98ba1b6b28a5047c9b15f6b60949 (patch) | |
tree | e54743f95b881800f502dd99ebf06a6e9a9c732a | |
parent | dd3508783ae3a7f6e6ba2314e5efb274bfe9181e (diff) | |
download | archweb32-6f4acf5ae6af98ba1b6b28a5047c9b15f6b60949.tar.xz |
buildmaster/deletion-links.php: put list of available packages into memcached
-rw-r--r-- | buildmaster/deletion-links.php | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/buildmaster/deletion-links.php b/buildmaster/deletion-links.php index f3a0aef..09b2424 100644 --- a/buildmaster/deletion-links.php +++ b/buildmaster/deletion-links.php @@ -10,10 +10,20 @@ if (isset($_GET["show_all"])) else $available_filter = ""; -$available = explode( - "\n", - shell_exec("find /var/lib/pacman/ -name '*.db' -exec tar -tzf {} \; | sed -n 's,-[^-]\+-[^-]\+/$,,;T;p' | sort -u") -); +$memcache = new Memcache; +$memcache->connect('localhost', 11211) or die ('Memcached Connection Error'); +$available_upstream_packages = $memcache->get('available_upstream_packages'); +if ($available_upstream_packages === false) { + $available_upstream_packages = explode( + "\n", + shell_exec( + "find /var/lib/pacman/ -name '*.db' -exec tar -tzf {} \; " . + "| sed -n 's,-[^-]\+-[^-]\+/$,,;T;p' " . + "| sort -u" + ) + ); + $memcache->set('available_upstream_packages',$available_upstream_packages,0,1800); +} mysql_run_query( "CREATE TEMPORARY TABLE `available` (" . @@ -24,7 +34,7 @@ mysql_run_query( mysql_run_query( "INSERT INTO `available` (`pkgname`) VALUES (\"" . - implode(array_map("base64_encode", $available), "\"),(\"") . + implode(array_map("base64_encode", $available_upstream_packages), "\"),(\"") . "\")" ); |