r76735 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76734‎ | r76735 | r76736 >
Date:23:20, 15 November 2010
Author:aaron
Status:ok
Tags:
Comment:
Removed weird unused "IPv4toIPv6" function
Modified paths:
  • /trunk/phase3/includes/IP.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/IP.php
@@ -121,35 +121,6 @@
122122 }
123123
124124 /**
125 - * Given an IP address in dotted-quad notation, returns an IPv6 octet.
126 - * See http://www.answers.com/topic/ipv4-compatible-address
127 - * IPs with the first 92 bits as zeros are reserved from IPv6
128 - * @param string $ip quad-dotted IP address.
129 - * @return string IPv4 address
130 - */
131 - public static function IPv4toIPv6( $ip ) {
132 - if ( !self::isIPv4( $ip ) ) {
133 - throw new MWException( "IPv4toIPv6() called on a non-IPv4 address." );
134 - }
135 - // IPv4 address with CIDR
136 - if ( strpos( $ip, '/' ) !== false ) {
137 - $parts = explode( '/', $ip, 2 );
138 - if ( count( $parts ) != 2 ) {
139 - return false;
140 - }
141 - list( $network, $bits ) = $parts;
142 - $network = self::toUnsigned( $network );
143 - if ( $network !== false && is_numeric( $bits ) && $bits >= 0 && $bits <= 32 ) {
144 - $bits += 96;
145 - return self::toOctet( $network ) . "/$bits";
146 - } else {
147 - return false;
148 - }
149 - }
150 - return self::toOctet( self::toUnsigned( $ip ) );
151 - }
152 -
153 - /**
154125 * Convert an IP into a nice standard form.
155126 * IPv6 addresses in octet notation are expanded to 8 words.
156127 * IPv4 addresses are just trimmed.

Status & tagging log