MediaWiki indeed doesn't store IP-addresses directly. This is for a few
reasons, one of which is sorting them from MySQL for block ranges.

It uses ip2long [1] for IPv4 addresses and a base conversion of raw HEX for
IPv6 [2].

See also the source of MediaWiki's IP.php class [3]

--
Krinkle

[1] http://php.net/manual/en/function.ip2long.php
[2]
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/includes/IP.php?revision=90105&view=markup#l432
[3]
http://toolserver.org/~krinkle/wikimedia-svn-search/view.php?id=226&hash=38471efbd5e492c5e6bfe61bb44f83e1

2011/6/21 Brion Vibber <[email protected]>

> On Jun 21, 2011 9:29 AM, "Ryan Chan" <[email protected]> wrote:
> >
> > According to this:
> > http://www.mediawiki.org/wiki/Manual:User_newtalk_table, IP was stored
> > using varchar(40) .
> >
> > But seems 45 should be the safe instead of 39?
> >
> >
> http://stackoverflow.com/questions/4982701/best-way-to-store-ip-in-database
>
> The 45-char version is for the dotted-quad variant of an ipv4 mixed
> address.
> I think we're normalizing to the canonical grouped hex form with elided
> zeroes so that format wouldn't get stored.
>
> -- brion
> _______________________________________________
> Wikitech-l mailing list
> [email protected]
> https://lists.wikimedia.org/mailman/listinfo/wikitech-l
>
_______________________________________________
Wikitech-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikitech-l

Reply via email to