Add a version number and user-agent string to ForeignAPIRepo.
[lhc/web/wiklou.git] / includes / Block.php
index f4e14b2..7c1b5d5 100644 (file)
@@ -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 );
                                        }
@@ -857,6 +857,16 @@ class Block {
        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.
+
+                       # BEGIN DatabaseMssql hack
+                       # Since MSSQL doesn't recognize the infinity keyword, set date manually.
+                       # TO-DO: Refactor for better DB portability and remove magic date
+                       $dbr = wfGetDB( DB_SLAVE );
+                       if ( $dbr->getType() == 'mssql' ) {
+                               return '3000-01-31 00:00:00.000';
+                       }
+                       # End DatabaseMssql hack
+
                return 'infinity';
        }