summaryrefslogtreecommitdiff
path: root/packages/pkginfo.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-12-10 11:23:29 +0100
committerErich Eckner <git@eckner.net>2018-12-10 11:23:29 +0100
commit8c15ec987324f7fdc5a1935c8db5417e8d16c621 (patch)
treeb97b16a07be5cbd7de13ea3a7ced6c0331dfe598 /packages/pkginfo.php
parent40e8a209189913461203722ae0c6789f887907b9 (diff)
downloadarchweb32-8c15ec987324f7fdc5a1935c8db5417e8d16c621.tar.xz
packages/pkginfo.php: adopt to new location and output format of pkgapi
Diffstat (limited to 'packages/pkginfo.php')
-rw-r--r--packages/pkginfo.php23
1 files changed, 12 insertions, 11 deletions
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index 3a3fc2e..d6d04fb 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -5,17 +5,17 @@ require_once BASE . "/lib/helper.php";
require_once BASE . "/lib/mysql.php";
require_once BASE . "/lib/style.php";
- if ($_GET["arch"] == "i486")
- $skip_json_checks = true;
- else
- $skip_json_checks = false;
-
if (!$skip_json_checks) {
$memcache = new Memcache;
$memcache -> connect('localhost', 11211) or die ('Memcached Connection Error');
$pkgapi_reachable = $memcache -> get('pkgapi_reachable');
+ $tld = array_pop((explode('.', $_SERVER['HTTP_HOST'])));
+ if (array_key_exists('HTTPS', $_SERVER) && ($_SERVER['HTTPS'] == 'on'))
+ $protocol = 'https';
+ else
+ $protocol = 'http';
if ($pkgapi_reachable === false) {
- if (site_is_reachable('https://pkgapi.arch32.tyzoid.com/package/'))
+ if (site_is_reachable($protocol . '://pkgapi.archlinux32.' . $tld . '/'))
$pkgapi_reachable = 'YES';
else
$pkgapi_reachable = 'NO';
@@ -28,18 +28,19 @@ require_once BASE . "/lib/style.php";
if (!$skip_json_checks) {
$json_content = json_decode(
file_get_contents(
- "https://pkgapi.arch32.tyzoid.com/package/" .
- urlencode ($_GET["repo"].":".$_GET["pkgname"])
+ $protocol . '://pkgapi.archlinux32.' . $tld . '/' .
+ urlencode($_GET["arch"]) . '/' .
+ urlencode($_GET["repo"]) . '/' .
+ urlencode($_GET["pkgname"])
),
true
);
- if (!isset($json_content["package"])) {
+ if (!isset($json_content["Name"])) {
//throw_http_error(404, "Package Not Found In Sync Database");
unset($json_content);
$skip_json_checks = true;
- } else
- $json_content = $json_content["package"];
+ };
}
$mysql_result = mysql_run_query(