Documentation addition/tweaks
[lhc/web/wiklou.git] / includes / Block.php
index f4e14b2..162188c 100644 (file)
@@ -24,7 +24,7 @@ class Block {
        const EB_RANGE_ONLY = 4;
 
        function __construct( $address = '', $user = 0, $by = 0, $reason = '',
-               $timestamp = '' , $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
+               $timestamp = 0, $auto = 0, $expiry = '', $anonOnly = 0, $createAccount = 0, $enableAutoblock = 0,
                $hideName = 0, $blockEmail = 0, $allowUsertalk = 0, $byName = false )
        {
                $this->mId = 0;
@@ -161,7 +161,7 @@ class Block {
                wfDebug( "Block::load: '$address', '$user', $killExpired\n" );
 
                $options = array();
-               $db =& $this->getDBOptions( $options );
+               $db = $this->getDBOptions( $options );
 
                if ( 0 == $user && $address === '' ) {
                        # Invalid user specification, not blocked
@@ -299,7 +299,7 @@ class Block {
                $range = substr( $iaddr, 0, 4 );
 
                $options = array();
-               $db =& $this->getDBOptions( $options );
+               $db = $this->getDBOptions( $options );
                $conds = array(
                        'ipb_range_start' . $db->buildLike( $range, $db->anyString() ),
                        "ipb_range_start <= '$iaddr'",
@@ -531,7 +531,7 @@ class Block {
                                # No results, don't autoblock anything
                                wfDebug( "No IP found to retroactively autoblock\n" );
                        } else {
-                               while ( $row = $dbr->fetchObject( $res ) ) {
+                               foreach ( $res as $row ) {
                                        if ( $row->rc_ip ) {
                                                $this->doAutoblock( $row->rc_ip );
                                        }
@@ -815,7 +815,7 @@ class Block {
                        // IPv6
                        if ( IP::isIPv6( $range ) && $parts[1] >= 64 && $parts[1] <= 128 ) {
                                $bits = $parts[1];
-                               $ipint = IP::toUnsigned6( $parts[0] );
+                               $ipint = IP::toUnsigned( $parts[0] );
                                # Native 32 bit functions WON'T work here!!!
                                # Convert to a padded binary number
                                $network = wfBaseConvert( $ipint, 10, 2, 128 );
@@ -849,15 +849,12 @@ class Block {
 
        /**
         * Get a value to insert into expiry field of the database when infinite expiry
-        * is desired. In principle this could be DBMS-dependant, but currently all
-        * supported DBMS's support the string "infinity", so we just use that.
+        * is desired
         *
         * @return String
         */
        public static function infinity() {
-               # This is a special keyword for timestamps in PostgreSQL, and
-               # works with CHAR(14) as well because "i" sorts after all numbers.
-               return 'infinity';
+               return wfGetDB( DB_SLAVE )->getInfinity();
        }
 
        /**