Commit 5a050552 authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Add the popularity field to the RPC interface



Implements FS#45422.

Signed-off-by: Lukas Fleischer's avatarLukas Fleischer <lfleischer@archlinux.org>
parent d1c33161
......@@ -33,6 +33,14 @@ class AurJSON {
'Users.UserName AS Maintainer',
'SubmittedTS AS FirstSubmitted', 'ModifiedTS AS LastModified'
);
private static $fields_v4 = array(
'Packages.ID', 'Packages.Name',
'PackageBases.ID AS PackageBaseID',
'PackageBases.Name AS PackageBase', 'Version',
'Description', 'URL', 'NumVotes', 'Popularity',
'OutOfDateTS AS OutOfDate', 'Users.UserName AS Maintainer',
'SubmittedTS AS FirstSubmitted', 'ModifiedTS AS LastModified'
);
private static $numeric_fields = array(
'ID', 'PackageBaseID', 'NumVotes', 'OutOfDate',
'FirstSubmitted', 'LastModified'
......@@ -211,7 +219,11 @@ class AurJSON {
"GROUP BY Packages.ID " .
"LIMIT $max_results";
} elseif ($this->version >= 2) {
$fields = implode(',', self::$fields_v2);
if ($this->version == 2 || $this->version == 3) {
$fields = implode(',', self::$fields_v2);
} else if ($this->version == 4) {
$fields = implode(',', self::$fields_v4);
}
$query = "SELECT {$fields} " .
"FROM Packages LEFT JOIN PackageBases " .
"ON PackageBases.ID = Packages.PackageBaseID " .
......
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