Page MenuHomePhabricator

Migrate usage of Database::select to SelectQueryBuilder in IPInfo
Closed, ResolvedPublic5 Estimated Story Points

Description

Now that T243051: A query builder for MediaWiki core is done, this extension should migrate away from IDatabase::select() to SelectQueryBuilder.

It would improve readability of the code, avoids mistakes by passing the wrong order of arguments, etc.

For more information check T243051 and its documentation.

Note that query builder is a different paradigm and changes should not be one-to-one. For example, avoid using joinConds().

AC

Event Timeline

STran set the point value for this task to 5.

Change 826981 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):

[mediawiki/extensions/IPInfo@master] Migrate usage of Database::select to SelectQueryBuilder in IPInfo

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

Testing notes

We probably just need to do some basic regression testing of IPInfo.

  1. It can be tested on beta (e.g. https://en.wikipedia.beta.wmflabs.org).
  2. Give your user the "checkuser" right (via https://en.wikipedia.beta.wmflabs.org/wiki/Special:UserRights/<you user>).
  3. Enable IPInfo via Special:Preferences (enable it in the beta preferences tab and then in the "User profile" tab check the two checkboxes under "IP Information").
  4. Open the IPInfo "popup" by clicking on the (i) icon on pages like:
    1. https://en.wikipedia.beta.wmflabs.org/wiki/Special:RecentChanges?userExpLevel=unregistered&limit=500&days=30&enhanced=1&urlversion=2
    2. https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:Log&logid=994, https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:Log&logid=250504 (other examples here)
    3. https://en.wikipedia.beta.wmflabs.org/wiki/0.5848547048459241?action=history (other examples here)
  5. On the above links, click an IP address to get to the Special:Contributions for that IP. Expand the IPInfo "infobox".
  6. Both the popup and infobox have a section for "Contributions" (i.e. edits that IP has made). You can check that this is correct by comparing it to the number of edits which are listed in the Special:Contributions for the IP.
  7. After doing the above, go to https://en.wikipedia.beta.wmflabs.org/wiki/Special:Log?type=ipinfo.
    1. If you looked at the IPInfo popup for an IP, you should see one log entry of the form <your user> viewed IP Information popup for <ip>.
    2. If you looked at the IPInfo infobox for an IP, you should see one log entry of the form <your user> viewed IP Information infobox for <ip>.
    3. If you did both, you should see both the log entries in A and B for the IP address.
    4. You should not see more than two log entries per IP address.
    5. There can be a delay in the log entries appearing. If they do not appear straight away, wait a few minutes.

Change 833900 had a related patch set uploaded (by TsepoThoabala; author: TsepoThoabala):

[mediawiki/extensions/IPInfo@master] Migrate usage of Database::select to SelectQueryBuilder in IPInfo

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

Change 826981 abandoned by TsepoThoabala:

[mediawiki/extensions/IPInfo@master] Migrate usage of Database::select to SelectQueryBuilder in IPInfo

Reason:

Had complicated merge conflicts created https://gerrit.wikimedia.org/r/c/mediawiki/extensions/IPInfo/+/833900

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

Change 833900 merged by jenkins-bot:

[mediawiki/extensions/IPInfo@master] Migrate usage of Database::select to SelectQueryBuilder in IPInfo

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

Regression testing (Steps 4 & 7) has passed in Beta as seen in the screenshots. Moving ticket to Done.

T312426_IPInfo_Contributions_PASS.png (502×1 px, 266 KB)

T312426_IPInfo_PASS.png (875×3 px, 149 KB)

OS: Chrome
Env: Beta

Testing notes

We probably just need to do some basic regression testing of IPInfo.

  1. It can be tested on beta (e.g. https://en.wikipedia.beta.wmflabs.org).
  2. Give your user the "checkuser" right (via https://en.wikipedia.beta.wmflabs.org/wiki/Special:UserRights/<you user>).
  3. Enable IPInfo via Special:Preferences (enable it in the beta preferences tab and then in the "User profile" tab check the two checkboxes under "IP Information").
  4. Open the IPInfo "popup" by clicking on the (i) icon on pages like:
    1. https://en.wikipedia.beta.wmflabs.org/wiki/Special:RecentChanges?userExpLevel=unregistered&limit=500&days=30&enhanced=1&urlversion=2
    2. https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:Log&logid=994, https://en.wikipedia.beta.wmflabs.org/w/index.php?title=Special:Log&logid=250504 (other examples here)
    3. https://en.wikipedia.beta.wmflabs.org/wiki/0.5848547048459241?action=history (other examples here)
  5. On the above links, click an IP address to get to the Special:Contributions for that IP. Expand the IPInfo "infobox".
  6. Both the popup and infobox have a section for "Contributions" (i.e. edits that IP has made). You can check that this is correct by comparing it to the number of edits which are listed in the Special:Contributions for the IP.
  7. After doing the above, go to https://en.wikipedia.beta.wmflabs.org/wiki/Special:Log?type=ipinfo.
    1. If you looked at the IPInfo popup for an IP, you should see one log entry of the form <your user> viewed IP Information popup for <ip>.
    2. If you looked at the IPInfo infobox for an IP, you should see one log entry of the form <your user> viewed IP Information infobox for <ip>.
    3. If you did both, you should see both the log entries in A and B for the IP address.
    4. You should not see more than two log entries per IP address.
    5. There can be a delay in the log entries appearing. If they do not appear straight away, wait a few minutes.