summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-08 11:16:30 +0100
committerErich Eckner <git@eckner.net>2018-11-08 11:16:30 +0100
commit570e97c96c555dea939e10bab79613600e327ea4 (patch)
treed5e5f75292008a4e81057329e48efca476aa811a
parent3e2387ab42cb42bda60940449641c49bd0e09e35 (diff)
downloadarchweb32-570e97c96c555dea939e10bab79613600e327ea4.tar.xz
packages/pkginfo.php: fix empty output and warnings on unavailable json
-rw-r--r--packages/pkginfo.php39
1 files changed, 20 insertions, 19 deletions
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index b283b17..3e8af4d 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -193,16 +193,16 @@ require_once BASE . "/lib/style.php";
"mysql: " . implode(", ",$dep_it) . "<br>\n" .
"json: " . implode(", ",$js_dep)
);
- }
- foreach ($dependencies as $key => $dep) {
- if ($dep["dependency_type"]!="run") {
- $dependencies[$key]["json"]="not required";
- continue;
+ foreach ($dependencies as $key => $dep) {
+ if ($dep["dependency_type"]!="run") {
+ $dependencies[$key]["json"]="not required";
+ continue;
+ }
+ foreach ($js_dep as $js)
+ if ($js == preg_replace("/[<=>].*$/","",$dep["install_target"]))
+ $dependencies[$key]["json"]=$js;
}
- foreach ($js_dep as $js)
- if ($js == preg_replace("/[<=>].*$/","",$dep["install_target"]))
- $dependencies[$key]["json"]=$js;
}
// query dependent packages
@@ -409,8 +409,8 @@ if (count($elsewhere)>0) {
<meta itemprop="name" content="<?php print $content["pkgname"]; ?>"/>
<meta itemprop="version" content="<?php print $content["version"]; ?>"/>
<meta itemprop="softwareVersion" content="<?php print $content["version"]; ?>"/>
- <meta itemprop="fileSize" content="<?php print $content["Download Size"]; ?>"/>
- <meta itemprop="dateCreated" content="<?php print $content["Build Date"]; ?>"/>
+ <meta itemprop="fileSize" content="<?php print if_unset($content, "Download Size", "0"); ?>"/>
+ <meta itemprop="dateCreated" content="<?php print if_unset($content,"Build Date","0"); ?>"/>
<meta itemprop="datePublished" content="<?php print $content["last_moved"]; ?>"/>
<meta itemprop="operatingSystem" content="Arch Linux 32"/>
<table id="pkginfo">
@@ -435,7 +435,7 @@ if (count($elsewhere)>0) {
Description:
</th>
<td class="wrap" itemprop="description">
- <?php print $content["Description"]."\n"; ?>
+ <?php print if_unset($content, "Description", "<font color=\"#ff0000\">not found in pkg-api</font>")."\n"; ?>
</td>
</tr>
<tr>
@@ -443,7 +443,7 @@ if (count($elsewhere)>0) {
Upstream URL:
</th>
<td>
- <a itemprop="url" href="<?php print $content["URL"]; ?>" title="Visit the website for <?php print $content["pkgname"]; ?>"><?php print $content["URL"]; ?></a>
+ <a itemprop="url" href="<?php print if_unset($content, "URL", ""); ?>" title="Visit the website for <?php print $content["pkgname"]; ?>"><?php print if_unset($content, "URL", "<font color=\"#ff0000\">not found in pkg-api</font>"); ?></a>
</td>
</tr>
<tr>
@@ -452,10 +452,11 @@ if (count($elsewhere)>0) {
</th>
<td class="wrap">
<?php
- if (is_array($content["Licenses"]))
- print implode(", ",$content["Licenses"]);
+ $licenses = if_unset($content, "Licenses", "<font color=\"#ff0000\">not found in pkg-api</font>");
+ if (is_array($licenses))
+ print implode(", ",$licenses);
else
- print $content["Licenses"];
+ print $licenses;
print "\n";
?>
</td>
@@ -465,7 +466,7 @@ if (count($elsewhere)>0) {
Package Size:
</th>
<td>
- <?php print $content["Download Size"]."\n"; ?>
+ <?php print if_unset($content, "Download Size", "<font color=\"#ff0000\">not found in pkg-api</font>")."\n"; ?>
</td>
</tr>
<tr>
@@ -473,7 +474,7 @@ if (count($elsewhere)>0) {
Installed Size:
</th>
<td>
- <?php print $content["Installed Size"]."\n"; ?>
+ <?php print if_unset($content, "Installed Size", "<font color=\"#ff0000\">not found in pkg-api</font>")."\n"; ?>
</td>
</tr>
<tr>
@@ -481,7 +482,7 @@ if (count($elsewhere)>0) {
Build Date:
</th>
<td>
- <?php print $content["Build Date"]."\n"; ?>
+ <?php print if_unset($content, "Build Date", "<font color=\"#ff0000\">not found in pkg-api</font>")."\n"; ?>
</td>
</tr>
<tr>
@@ -503,7 +504,7 @@ if (count($elsewhere)>0) {
<?php
foreach ($dependencies as $dep) {
print " <li>\n";
- if (!isset ($dep["json"]))
+ if (!$skip_json_checks && !isset ($dep["json"]))
print " (in database only)\n";
if (count($dep["deps"]) == 0) {
print " <font color=\"#ff0000\">not satisfiable dependency: \"" . $dep["install_target"] . $dep["version"] . "\"</font>\n";