Add a version number and user-agent string to ForeignAPIRepo.
[lhc/web/wiklou.git] / includes / Block.php
index 59ec8c0..7c1b5d5 100644 (file)
@@ -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 );
                                        }
@@ -861,8 +861,8 @@ class Block {
                        # 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
-                       $dbw = wfGetDB( DB_MASTER );
-                       if ( $dbw instanceof DatabaseMssql ) {
+                       $dbr = wfGetDB( DB_SLAVE );
+                       if ( $dbr->getType() == 'mssql' ) {
                                return '3000-01-31 00:00:00.000';
                        }
                        # End DatabaseMssql hack