Last modified: 2011-06-23 00:38:48 UTC
It would be nice if MediaWiki could correctly sort IPv4 addresses (e.g. 10.1.203.40) in sortable tables. Currently, wikibits.js identifies them as numerics and refuses to sort them correctly. Prepending a "&" to force a text search doesn't help unless the IP addresses are uglified to include leading zeros (e.g. 010.001.203.040). I've attached a patch that adds the ability to automatically identify and sort IPv4 addresses. It's my first MediaWiki contribution, so please review it carefully.
Created attachment 5724 [details] Wikibits patch that adds the ability for sortable wikitables to sort IPv4 addresses
Created attachment 5725 [details] updated patch that handles whitespace to left or right of IP address
(In reply to comment #2) > Created an attachment (id=5725) [details] > updated patch that handles whitespace to left or right of IP address A fix for this problem would be very helpful - we use lots of IP addresses in sortable tables with MW and they have the exact problems described here. Unfortunately I am not a programmer so I can't review the code.
FWIW, this patch has been in operations at our facility for about a year now with no problems.
Does the patch still apply cleanly? (For the lazy ones of us here ;))
(In reply to comment #5) > Does the patch still apply cleanly? (For the lazy ones of us here ;)) Oh God no. Hasn't applied cleanly since 1.12. That'll teach me to upload patches here instead of just committing them to trunk.
Removing patch and needs-review Gonna need manually remaking...
Created attachment 6989 [details] updated for compatibility with development version
applies cleanly to 1.16-svn
Do not mark bugs fixed until the patch has been applied.
Very True I'll see if i can apply and test it in a little bit for you :)
Why does ts_parseIP() have an "octetlist" var (and not "quadlist"). Also, it probably could use a for loop to reduce the duplication.
(In reply to comment #12) > Why does ts_parseIP() have an "octetlist" var (and not "quadlist"). ts_parseIP() has an "octetlist" because it contains a list of octets. Why are they "octets" and not "quads"? Because the specification for the Internet Protocol calls these items "octets". See RFC 791 (Postel, 1981). Why does the RFC refer to them as "octets" instad of "bytes"? Because the term "octet" denotes to 8 bits, whereas "byte" refers to an undefined group of bits (usually 8 bits, but 6,7,or 10 on some computer architectures.) This is an important distinction for a networking protocol whose goal is to enable communications between systems regardless of processing architecture.
"octet" makes sense on the bit level, though this patch doesn't operate on that level. It's just exploding the dotted-quad notation and padding the integers. The use of "octet" just seemed a bit odd. Probably just personal preference :)
Fixed in r86088
r86088 is seriously broken and may get reverted; reopening. Needs unit tests (see initial basic unit tests in r90595 which show up errors; will also need tests for the particular case this bug is about.)
Test cases and a fix for single-digit octets added in r90637. Needs merge to 1.18 branch, marked in CR. Re-resolving fixed.