[aur-general] AurJson - orphan packages
Gergely Imreh
imrehg at gmail.com
Mon Sep 14 10:46:15 EDT 2009
2009/9/14 Pierre Chapuis <catwell at archlinux.us>:
> Le Sun, 13 Sep 2009 18:23:02 +0200,
> Pierre Chapuis <catwell at archlinux.us> a écrit :
>
>> Hi,
>>
>> I was wondering if there's a way to know if a package is orphan using the AurJson interface.
>>
>> If that's not the case, I think I will find a feature request for something like:
>>
>> "Uploader":"pseudonym"
>>
>> in "info/results", with "pseudonym" set as "orphan" if the package is orphan (I hope nobody has taken the pseudonym "orphan" on AUR...).
>>
>> Does that look fine to you?
>
> Of course I meant: "I will file a feature request"...
>
> Another possibility might be to add a boolean like OutOfDate, but the solution I proposed would also enable scripts to find the uploader of a package, which might be useful later. As far as I'm concerned, I don't really care since I only want to know if the package is orphan...
I'm CC-ing this to the aur-dev, as I think it belongs there.
The following patch adds the Orphan field to the aurjson output. For
username we would need to hit the database once more (maybe, have to
think more SQL for that), but the Orphan-ness is quite straightforward
to evaluate. So let's just do that first.
This patch, however, might clash with one patch I sent in a few days
ago [1], since that one hasn't been applied to the repo, yet. Anyway,
neither of those are hard to see where they should go...
Any comments?
Cheers,
Greg
[1] http://mailman.archlinux.org/pipermail/aur-dev/2009-September/000868.html
>From 2aba57717cac80f643886b25900c8d7ad14e9198 Mon Sep 17 00:00:00 2001
From: Gergely Imreh <imrehg at gmail.com>
Date: Mon, 14 Sep 2009 22:28:58 +0800
Subject: [PATCH] aurjson: add "Orphan" boolean field to JSON output
Signed-off-by: Gergely Imreh <imrehg at gmail.com>
---
web/lib/aurjson.class.php | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/web/lib/aurjson.class.php b/web/lib/aurjson.class.php
index 29fc424..85a3b89 100644
--- a/web/lib/aurjson.class.php
+++ b/web/lib/aurjson.class.php
@@ -19,8 +19,9 @@ include_once("aur.inc");
class AurJSON {
private $dbh = false;
private $exposed_methods = array('search','info');
- private $fields = array('ID','Name','Version','CategoryID','Description',
- 'LocationID', 'URL','URLPath','License','NumVotes','OutOfDate');
+ private $fields = array('ID','Name','Version','MaintainerUID','CategoryID',
+ 'Description','LocationID', 'URL','URLPath','License','NumVotes',
+ 'OutOfDate');
/**
* Handles post data, and routes the request.
@@ -139,6 +140,8 @@ class AurJSON {
if ( $result && (mysql_num_rows($result) > 0) ) {
$row = mysql_fetch_assoc($result);
mysql_free_result($result);
+ $row['Orphan'] = ($row['MaintainerUID'] == "0" ? "1" : "0");
+ unset($row['MaintainerUID']);
return $this->json_results('info', $row);
}
else {
--
1.6.4.2
More information about the aur-general
mailing list