Removed weird unused "IPv4toIPv6" function
authorAaron Schulz <aaron@users.mediawiki.org>
Mon, 15 Nov 2010 23:20:23 +0000 (23:20 +0000)
committerAaron Schulz <aaron@users.mediawiki.org>
Mon, 15 Nov 2010 23:20:23 +0000 (23:20 +0000)
includes/IP.php

index 5b4450e..006e6e5 100644 (file)
@@ -120,35 +120,6 @@ class IP {
                        || preg_match( '/^' . RE_IP_BLOCK . '$/', $ipblock ) );
        }
 
-       /**
-        * Given an IP address in dotted-quad notation, returns an IPv6 octet.
-        * See http://www.answers.com/topic/ipv4-compatible-address
-        * IPs with the first 92 bits as zeros are reserved from IPv6
-        * @param string $ip quad-dotted IP address.
-        * @return string IPv4 address
-        */
-       public static function IPv4toIPv6( $ip ) {
-               if ( !self::isIPv4( $ip ) ) {
-                       throw new MWException( "IPv4toIPv6() called on a non-IPv4 address." );
-               }
-               // IPv4 address with CIDR
-               if ( strpos( $ip, '/' ) !== false ) {
-                       $parts = explode( '/', $ip, 2 );
-                       if ( count( $parts ) != 2 ) {
-                               return false;
-                       }
-                       list( $network, $bits ) = $parts;
-                       $network = self::toUnsigned( $network );
-                       if ( $network !== false && is_numeric( $bits ) && $bits >= 0 && $bits <= 32 ) {
-                               $bits += 96;
-                               return self::toOctet( $network ) . "/$bits";
-                       } else {
-                               return false;
-                       }
-               }
-               return self::toOctet( self::toUnsigned( $ip ) );
-       }
-
        /**
         * Convert an IP into a nice standard form.
         * IPv6 addresses in octet notation are expanded to 8 words.