r17928 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r17927‎ | r17928 | r17929 >
Date:16:27, 25 November 2006
Author:tstarling
Status:old
Tags:
Comment:
Removed wfRangeStartEnd() and wfIsAddressInRange() -- avoid proliferation of global functions.
Modified paths:
  • /trunk/phase3/includes/GlobalFunctions.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/GlobalFunctions.php
@@ -2040,37 +2040,6 @@
20412041 }
20422042 }
20432043
2044 -/**
2045 - * Get the start and end of a range.
2046 - * @param $range The range to get the start and end for.
2047 - * @return array An array with the first element as the start of the range, as a long, and the second element as the end of the range, also as a long.
2048 - *
2049 - */
2050 -function wfRangeStartEnd( $range ) {
2051 - list( $network, $bits ) = wfParseCIDR( $range );
2052 - if ( $network !== false ) {
2053 - $start = sprintf( '%08X', $network );
2054 - $end = sprintf( '%08X', $network + (1 << (32 - $bits)) - 1 );
2055 - return array($start, $end);
2056 - }
2057 - return false;
2058 -}
2059 -
2060 -/**
2061 - * Determine if a given integer IPv4 address is in a given CIDR network
2062 - * @param $addr The address to check against the given range.
2063 - * @param $range The range to check the given address against.
2064 - * @return bool Whether or not the given address is in the given range.
2065 - */
2066 -function wfIsAddressInRange( $addr, $range ) {
2067 - $unsignedIP = IP::toUnsigned($addr);
2068 - $startend = wfRangeStartEnd($range);
2069 - $start = $startend[0];
2070 - $end = $startend[1];
2071 -
2072 - return (($unsignedIP >= $start) && ($unsignedIP <= $end));
2073 -}
2074 -
20752044 /*
20762045 * Get a Database object
20772046 * @param integer $db Index of the connection to get. May be DB_MASTER for the