summaryrefslogtreecommitdiffstats
path: root/web/lib/aurjson.class.php
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-02-09 21:49:57 +0100
committerLukas Fleischer <lfleischer@archlinux.org>2016-02-09 21:54:39 +0100
commit9d7d1be731eea243587a046774a650576521bcbb (patch)
treea053852d96a9dc5286e54bef1504e659860d9ec4 /web/lib/aurjson.class.php
parentdc41a5afa5dbbfbca4a711b9059c4b7dc8cbeb72 (diff)
downloadaur-9d7d1be731eea243587a046774a650576521bcbb.tar.gz
aur-9d7d1be731eea243587a046774a650576521bcbb.tar.xz
aurjson: Add package base keywords
Expose package base keywords through the RPC interface (version 5). Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib/aurjson.class.php')
-rw-r--r--web/lib/aurjson.class.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index 51a7c64d..7f9b5f2e 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -175,10 +175,11 @@ class AurJSON {
* Get extended package details (for info and multiinfo queries).
*
* @param $pkgid The ID of the package to retrieve details for.
+ * @param $base_id The ID of the package base to retrieve details for.
*
* @return array An array containing package details.
*/
- private function get_extended_fields($pkgid) {
+ private function get_extended_fields($pkgid, $base_id) {
$query = "SELECT DependencyTypes.Name AS Type, " .
"PackageDepends.DepName AS Name, " .
"PackageDepends.DepCondition AS Cond " .
@@ -224,6 +225,19 @@ class AurJSON {
$data[$type][] = $row['Name'] . $row['Cond'];
}
+ if ($this->version >= 5) {
+ $query = "SELECT Keyword FROM PackageKeywords " .
+ "WHERE PackageBaseID = " . intval($base_id) . " " .
+ "ORDER BY Keyword ASC";
+ $result = $this->dbh->query($query);
+
+ if (!$result) {
+ return null;
+ }
+
+ $data['Keywords'] = $result->fetchAll(PDO::FETCH_COLUMN, 0);
+ }
+
return $data;
}
@@ -300,7 +314,7 @@ class AurJSON {
}
if ($this->version >= 2 && ($type == 'info' || $type == 'multiinfo')) {
- $row = array_merge($row, $this->get_extended_fields($row['ID']));
+ $row = array_merge($row, $this->get_extended_fields($row['ID'], $row['PackageBaseID']));
}
if ($this->version < 3) {