Last modified: 2007-06-17 08:51:13 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T12275, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 10275 - Allow namespace narrowing of selection in prop=links
Allow namespace narrowing of selection in prop=links
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Nobody - You can work on this!
: patch, patch-need-review
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-06-15 15:18 UTC by Danny B.
Modified: 2007-06-17 08:51 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Implements filtering by namespace for prop=links and prop=templatelinks (1.82 KB, patch)
2007-06-16 17:31 UTC, Roan Kattouw
Details

Description Danny B. 2007-06-15 15:18:00 UTC
Please add new feature to allow to choose namespace(s) of links on such page.

Eg. get all links to Help ns only on Wikipedia:Foo page.

Thanks
Comment 1 Danny B. 2007-06-15 15:41:35 UTC
Some examples of possible code:

api.php? ... &plnamespaces=10 -- show only links to the pages in namespace 10

api.php? ... &plnamespaces=1|3|5|7|9|11 show only links to all talks

etc...
Comment 2 Roan Kattouw 2007-06-16 13:08:58 UTC
I'll work on it some time this weekend, patch should be ready by Monday (possibly earlier if I have time).
Comment 3 Roan Kattouw 2007-06-16 17:31:40 UTC
Created attachment 3791 [details]
Implements filtering by namespace for prop=links and prop=templatelinks

Miraculously, I've actually found time to do this today. The attached patch (tested and found to work) implements a plnamespace parameter just like you asked for. Because prop=links and prop=templatelinks share code, prop=templatelinks now also has a tlnamespace parameter which does exactly the same thing. Help text from the patched version:

* prop=links (pl) *
  Returns all links from the given page(s)
Parameters:
  plnamespace    - Show links in this namespace(s) only
                   Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Examples:
  Get links from the [[Main Page]]:
    api.php?action=query&prop=links&titles=Main%20Page
  Get information about the link pages in the [[Main Page]]:
    api.php?action=query&generator=links&titles=Main%20Page&prop=info
  Get links from the Main Page in the User and Template namespaces:
    api.php?action=query&prop=links&titles=Main%20Page&plnamespace=2|10
Generator:
  This module may be used as a generator

* prop=templates (tl) *
  Returns all templates from the given page(s)
Parameters:
  tlnamespace    - Show templates in this namespace(s) only
                   Values (separate with '|'): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15
Examples:
  Get templates from the [[Main Page]]:
    api.php?action=query&prop=templates&titles=Main%20Page
  Get information about the template pages in the [[Main Page]]:
    api.php?action=query&generator=templates&titles=Main%20Page&prop=info
  Get templates from the Main Page in the User and Template namespaces:
    api.php?action=query&prop=templates&titles=Main%20Page&tlnamespace=2|10
Generator:
  This module may be used as a generator

It may take some time for this patch to be accepted into the code, but if you really want to try it you can of course set up your own test wiki and apply this patch to it.

Hope this helps,

Roan Kattouw
Comment 4 Yuri Astrakhan 2007-06-17 08:51:13 UTC
Fixed in 23044

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links