mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
aurjson: Add package base keywords
Expose package base keywords through the RPC interface (version 5). Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
dc41a5afa5
commit
9d7d1be731
1 changed files with 16 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Reference in a new issue