diff options
Diffstat (limited to 'web/lib/aurjson.class.php')
-rw-r--r-- | web/lib/aurjson.class.php | 18 |
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) { |