[aur-dev] [PATCH] add subitter, first submitted and last modified to json output

elij elij.mx at gmail.com
Tue May 10 16:54:25 EDT 2011


On Tue, May 10, 2011 at 1:20 PM, kachelaqa <kachelaqa at gmail.com> wrote:
> this patch is a follow up to my earlier feature request (FS#24183).

Does anyone really care who the original submitter was?
I think maintainer makes sense, but submitter?

So, while I disagree with adding submitter, I think that adding last
modified is a good idea.

> ---
>  web/lib/aurjson.class.php |   11 +++++++----
>  1 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
> index 50cf6d0..2269edc 100644
> --- a/web/lib/aurjson.class.php
> +++ b/web/lib/aurjson.class.php
> @@ -19,7 +19,7 @@ class AurJSON {
>     );
>     private static $fields = array(
>         'Packages.ID', 'Name', 'Version', 'CategoryID',
> -        'Description', 'URL', 'License',
> +        'Description', 'URL', 'License', 'SubmittedTS', 'ModifiedTS',
>         'NumVotes', '(OutOfDateTS IS NOT NULL) AS OutOfDate'
>     );
>
> @@ -85,9 +85,12 @@ class AurJSON {
>
>     private function process_query($type, $where_condition) {
>         $fields = implode(',', self::$fields);
> -        $query = "SELECT Users.Username as Maintainer, {$fields} " .
> -            "FROM Packages LEFT JOIN Users " .
> -            "ON Packages.MaintainerUID = Users.ID " .
> +        $query = "SELECT {$fields}, " .
> +            "mUsers.Username AS Maintainer, " .
> +            "sUsers.Username AS Submitter " .
> +            "FROM Packages " .
> +            "LEFT JOIN Users AS mUsers ON Packages.MaintainerUID =
> mUsers.ID " .
> +            "LEFT JOIN Users AS sUsers ON Packages.SubmitterUID = sUsers.ID
> " .

Does this need to be a left join?
I could see the need for a left join on maintainer, due to a a package
not having a maintainer, but do we have any packages without a
submitter?

If not, then an inner join would probably be faster, since it wouldn't
have to _basically_ do the inner join and THEN try to find any null
columns and add those too.

>             "WHERE ${where_condition}";
>         $result = db_query($query, $this->dbh);
>
> --
> 1.7.5.1
>


More information about the aur-dev mailing list