Commit 9d7d1be7 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

aurjson: Add package base keywords



Expose package base keywords through the RPC interface (version 5).

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent dc41a5af
......@@ -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) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment