Page MenuHomePhabricator

Bring the CIDR calculator to MediaWiki core
Open, MediumPublic

Description

The CIDR calculator, which is part of the CheckUser extension now, should be brought to the MediaWiki core. It is very useful for calculating ranges when one wants to conduct a range block.

Event Timeline

I am not sure. My intention is not to make CheckUser part of core. Instead, I want just the particular JavaScript module to be part of core..

MusikAnimal added a project: Community-Tech.

I will claim this only because it will be bundled in with T145912, exposing it for general admin use on Special:Contribs (or RangeContribs, to be determined). We might also want it at Special:Block, though.

Or actually, maybe we should merge with T150193?

Perhaps merge; not sure in which direction. I believe the CIDR tool should be part of core, with no regard to if and and when we create Special:RangeContributions or not.

Perhaps merge; not sure in which direction. I believe the CIDR tool should be part of core, with no regard to if and and when we create Special:RangeContributions or not.

They are related since the tool will be surfaced on Special:RangeContributions, whether in core or not.

I'd say let's not merge this either way until we have consensus to move the module into core.

I'm not sure about the priority on this one, but it's something that I would like to see. Makes rangeblocks easier to calculate for admins who are not checkusers.

I'm not sure about the priority on this one, but it's something that I would like to see. Makes rangeblocks easier to calculate for admins who are not checkusers.

Hasn't been triaged, but we were planning on bundling it in with T145912. Until then I can't think of a good place to put it, maybe Special:Block? I just hate we are (indirectly) encouraging range blocks when there is no way to check the ranges.

Until we find a good home for this calculator, you could link to an external tool in a MediaWiki system message, such as MediaWiki:Blockiptext, which will show up at Special:Block. On the English Wikipedia we are linking to several different tools but in my opinion the best one is http://nativeforeigner.com/calc/. Hope this helps.

Users global account is locked, and thus they are unable to log in here and comment on this.

Change 414174 had a related patch set uploaded (by Huji; owner: Huji):
[mediawiki/core@master] Bring the CIDR calculator to MediaWiki core

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

Huji triaged this task as Lowest priority.

@Legoktm I like your idea of turning this into a widget. Can you please give me an example of another widget I can model it after?

Cyberpower678 raised the priority of this task from Lowest to Medium.Apr 17 2019, 8:44 PM
Cyberpower678 subscribed.

Boldly raising the priority to Normal as this is HIGHLY useful and needed, especially with IPv6

Removing task assignee due to inactivity, as this open task has been assigned to the same person for more than two years (see the emails sent to the task assignee on Oct27 and Nov23). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be welcome.
(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

Changes to make the CIDR calculator in Special:CheckUser to use OOUI mean that it might be more feasible to move to core?

My understanding of OOUI is limited, but I guess we now can convert it into a class that extends \OOUI\Widget? If so, then how can we create a multi-component widget? I was thinking that the output should be a FieldLayout that contains a MultilineTextInputWidget (in which we enter the IPs) and a disabled TextInputWidget beneath it (in which the CIDR is shown) followed by perhaps another widget (perhaps a LabelWidget) in which we show the size of the CIDR range.

That's what https://gerrit.wikimedia.org/r/c/mediawiki/extensions/CheckUser/+/803372 basically does, but instead using a modified OOUIHtmlForm class that allowed me to not have it wrapped as a form but use the useful constructor. I didn't disable the text area as it wasn't disabled in the previous layout, but doing so makes sense. In theory it could be made to a Widget as that would increase portability but I'm not so sure about Widgets as I've not used them so far.

Also, the calculator doesn't seem to work well on Firefox for any large ranges and perhaps a review of the JS code may be needed to make it work more reliably? If a too large range is calcuated it gives me a strange output as the range and also a ! for the number of IPs affected.

Can you provide an example of a "very large range" so I can test it in Firefox?

That is by design, and not specific to Firefox.
The maximum range this tool gives you is /16 for IPv4 and /32 for IPv6
If your input spans a wider range, it'll show an error.

Although this may be intended and I see know this is the case via comments, this error isn't helpful or descriptive (hence why I thought it was a bug). Perhaps a more descriptive error can be used to say "this is too wide" to remove confusion like the one I had with the message. That's out of scope of this task so I'll create a new one for that.