On Jun 21, 2011 9:29 AM, "Ryan Chan" ryanchan404@gmail.com 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
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?revis... [3] http://toolserver.org/~krinkle/wikimedia-svn-search/view.php?id=226&hash...
2011/6/21 Brion Vibber brion@wikimedia.org
On Jun 21, 2011 9:29 AM, "Ryan Chan" ryanchan404@gmail.com 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 Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
wikitech-l@lists.wikimedia.org