Page MenuHomePhabricator

Add IP range support to list=usercontribs API
Closed, ResolvedPublic5 Estimated Story Points

Event Timeline

kaldari triaged this task as Medium priority.Oct 3 2017, 10:55 PM
kaldari set the point value for this task to 5.
MaxSem subscribed.

I've been playing around with this recently. A new parameter is needed certainly, say, iprange. Then just fork and modify the $userIter of userprefix parameter (in ApiQueryUserContribs::execute) and that's it, imho. Desired $userIter should yield IP addresses selected from ip_changes, with condition ipc_hex BETWEEN <start> AND <end> and group by ip_hex. The rest is similar to other parameters, so ApiQueryUserContribs::prepareQuery won't be affected.

Change 664503 had a related patch set uploaded (by WhitePhosphorus; owner: WhitePhosphorus):
[mediawiki/core@master] API: Add IP range support to list=usercontribs

https://gerrit.wikimedia.org/r/664503

Test wiki created on Patch demo by WhitePhosphorus using patch(es) linked to this task:
https://patchdemo.wmflabs.org/wikis/44a24ab4aa/w/

Change 664503 merged by jenkins-bot:

[mediawiki/core@master] API: Add IP range support to list=usercontribs

https://gerrit.wikimedia.org/r/664503

🥳 Working on the beta cluster, and there were no glaring errors

{
    "batchcomplete": "",
    "query": {
        "usercontribs": [
            {
                "userid": 0,
                "user": "91.64.227.99",
                "pageid": 274472,
                "revid": 546199,
                "parentid": 545105,
                "ns": 0,
                "title": "Op\u00e9ra de Monte-Carlo",
                "timestamp": "2022-05-05T10:56:37Z",
                "top": "",
                "comment": "",
                "size": 86
            },
            {
                "userid": 0,
                "user": "91.64.227.99",
                "pageid": 274471,
                "revid": 546112,
                "parentid": 546111,
                "ns": 0,
                "title": "Monaco",
                "timestamp": "2022-05-04T10:32:38Z",
                "top": "",
                "comment": "",
                "size": 93
            },
            {
                "userid": 0,
                "user": "91.64.227.99",
                "pageid": 274471,
                "revid": 546111,
                "parentid": 545104,
                "ns": 0,
                "title": "Monaco",
                "timestamp": "2022-05-04T09:50:55Z",
                "comment": "",
                "size": 93
            },
            {
                "userid": 0,
                "user": "91.64.109.97",
                "pageid": 183051,
                "revid": 535031,
                "parentid": 508312,
                "ns": 2,
                "title": "User:Fisch-WMDE/Test",
                "timestamp": "2022-01-21T08:22:33Z",
                "top": "",
                "comment": "",
                "size": 304
            },
            {
                "userid": 0,
                "user": "91.64.63.9",
                "pageid": 183051,
                "revid": 417567,
                "parentid": 416620,
                "ns": 2,
                "title": "User:Fisch-WMDE/Test",
                "timestamp": "2020-03-25T12:16:08Z",
                "comment": "",
                "size": 16
            },
            {
                "userid": 0,
                "user": "91.64.63.9",
                "pageid": 183051,
                "revid": 416620,
                "parentid": 416619,
                "ns": 2,
                "title": "User:Fisch-WMDE/Test",
                "timestamp": "2020-03-17T12:41:31Z",
                "comment": "",
                "size": 18
            },
            {
                "userid": 0,
                "user": "91.64.63.9",
                "pageid": 183051,
                "revid": 416619,
                "parentid": 416616,
                "ns": 2,
                "title": "User:Fisch-WMDE/Test",
                "timestamp": "2020-03-17T12:39:10Z",
                "comment": "",
                "size": 18
            },
            {
                "userid": 0,
                "user": "91.64.63.9",
                "pageid": 183051,
                "revid": 416616,
                "parentid": 415411,
                "ns": 2,
                "title": "User:Fisch-WMDE/Test",
                "timestamp": "2020-03-17T11:27:21Z",
                "comment": "",
                "size": 18
            },
            {
                "userid": 0,
                "user": "91.64.63.9",
                "pageid": 184595,
                "revid": 415925,
                "parentid": 392159,
                "ns": 2,
                "title": "User:Fisch-WMDE",
                "timestamp": "2020-03-11T14:02:47Z",
                "comment": "",
                "size": 218
            },
            {
                "userid": 0,
                "user": "91.64.30.187",
                "pageid": 29238,
                "revid": 496766,
                "parentid": 118330,
                "ns": 10,
                "title": "Template:This is a ludicrously long title for a template to have so that it shows up with an ellipsis instead in the search interface",
                "timestamp": "2021-06-18T09:33:01Z",
                "top": "",
                "comment": "Adding a long description to test that as well.",
                "size": 557
            },
            {
                "userid": 0,
                "user": "91.64.30.29",
                "pageid": 85593,
                "revid": 511889,
                "parentid": 201032,
                "ns": 0,
                "title": "Selenium Echo mention test 0.764427149542747",
                "timestamp": "2021-10-26T08:35:24Z",
                "top": "",
                "comment": "",
                "size": 160
            }
        ]
    }
}

Thanks @TheresNoTime for testing and code reviewing :) API docs will be automatically updated when this is deployed on MediaWiki.org, then I will edit the Parameter history section.

Test wiki on Patch demo by WhitePhosphorus using patch(es) linked to this task was deleted:

https://patchdemo.wmflabs.org/wikis/44a24ab4aa/w/

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy