FS#28839 - Query package details by name (w/ patch)

Attached to Project: AUR web interface
Opened by Dario Giovannetti (kynikos) - Friday, 09 March 2012, 12:38 GMT
Last edited by Lukas Fleischer (lfleischer) - Sunday, 04 November 2012, 11:46 GMT
Task Type Feature Request
Category Backend
Status Closed
Assigned To Lukas Fleischer (lfleischer)
Architecture All
Severity Medium
Priority Normal
Reported Version 1.9.1
Due in Version 2.0.0
Due Date Undecided
Percent Complete 100%
Votes 5
Private No

Details

Currently package-detail pages are retrieved only with "packages.php?ID=#".

Here I provide two possible patches that could enable querying by package name: the first one just adds an elseif in packages.php, the second one rewrites an if block avoiding some duplication of code.

A new GET variable is introduced, "NAME", and this way package details could be queried also with "packages.php?NAME=pkgname". If "NAME" conflicts with an existing variable, possible alternatives are "PNAME", "PKGNAME", "pkgname" and so on.

This request is the result of the discussion in https://wiki.archlinux.org/index.php/User_talk:Det#Templates%20vs%20 links.
This task depends upon

Closed by  Lukas Fleischer (lfleischer)
Sunday, 04 November 2012, 11:46 GMT
Reason for closing:  Implemented
Additional comments about closing:  Implemented in 2.0.0.
Comment by Dario Giovannetti (kynikos) - Friday, 09 March 2012, 12:51 GMT
Ah note that the patches use `urldecode($_GET['NAME'])`, so names should be obviously url-encoded in the string. This is already supported by https://wiki.archlinux.org/index.php/Template:AUR
Comment by Dario Giovannetti (kynikos) - Friday, 09 March 2012, 13:09 GMT Comment by Lukas Fleischer (lfleischer) - Wednesday, 21 March 2012, 09:28 GMT
This has been suggested a couple of times. Sounds like a good idea. I'll have a look at your patches later.
Comment by Dario Giovannetti (kynikos) - Wednesday, 21 March 2012, 11:17 GMT
Thanks Lukas, however by looking at the patches again I've realized that my editor turned the tabbed indentation to spaced, so if I'm not too late I'm attaching the patches revisited to retain tabs (patch 2 looks also much simpler).
Comment by Dario Giovannetti (kynikos) - Wednesday, 21 March 2012, 16:57 GMT
I've taken the time to revise those patches again: they won't work, so now I hope I've found a safe solution for implementing this feature, I'm attaching it, it's even simpler than the others and doesn't rewrite anything, just adds 3 lines.
It's based on the idea that, sooner or later in the code, $_GET['ID'] must be set unless we want to rewrite the whole project, since that variable is required by many functions; so, let's choose sooner and set it immediately from $_GET['NAME'] :)
By the way I've also checked more accurately if "NAME" is already used and couldn't find anything, so IMHO the name is ok (unless you don't like it for other reasons). I couldn't find a file or a comment where GET variables are listed with descriptions, but if you're keeping one and want a patch also for that I'll prepare it.
Comment by Lukas Fleischer (lfleischer) - Thursday, 22 March 2012, 07:42 GMT
Why do you urldecode() at all? "$_GET[]" is implicitly URL-decoded.
Comment by Dario Giovannetti (kynikos) - Thursday, 22 March 2012, 10:25 GMT
Lol so true, I forgot that, that's why you're the AUR developer here :P Here's the revised patch.
Comment by Lukas Fleischer (lfleischer) - Thursday, 22 March 2012, 14:02 GMT
Don't worry. I failed even harder. This is a dupe of  FS#21600  and I already posted patches for this to aur-dev [1] about one and a half years ago. No idea why I never merged them into master.

[1] http://mailman.archlinux.org/pipermail/aur-dev/2010-November/001356.html
Comment by Lukas Fleischer (lfleischer) - Thursday, 22 March 2012, 14:52 GMT
Resubmitted these patches to aur-dev [1].

[1] http://mailman.archlinux.org/pipermail/aur-dev/2012-March/001994.html
Comment by Lukas Fleischer (lfleischer) - Thursday, 12 July 2012, 06:04 GMT
  • Field changed: Due in Version (Undecided → 2.0.0)
Implemented in master (commits e9d8e9b8c074421d15103fd66112dea78800e72a and cf2f66751238a5c956c69d3852df74c8e9bbbe52).

Loading...