diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2015-06-25 08:54:15 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2015-06-27 13:04:03 +0200 |
commit | 5a050552e89e25ad0e5b079ff6f03ba9250f13d8 (patch) | |
tree | 5efaa624f9cdc8eca5d052186165fa948db75159 /web/lib | |
parent | d1c331613d3b2c9a996dbb7afe0067e37e4bcd76 (diff) | |
download | aur-5a050552e89e25ad0e5b079ff6f03ba9250f13d8.tar.gz aur-5a050552e89e25ad0e5b079ff6f03ba9250f13d8.tar.xz |
Add the popularity field to the RPC interface
Implements FS#45422.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/aurjson.class.php | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php index c896b042..7b77da46 100644 --- a/web/lib/aurjson.class.php +++ b/web/lib/aurjson.class.php @@ -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 " . |