* (bug 1130) Reorder old title checks; use title null instead of empty
[lhc/web/wiklou.git] / includes / Block.php
index 7ab2583..f97cabc 100644 (file)
@@ -63,6 +63,7 @@ class Block
         */
        function load( $address = '', $user = 0, $killExpired = true ) 
        {
+               global $wgDBmysql4 ;
                $fname = 'Block::load';
                wfDebug( "Block::load: '$address', '$user', $killExpired\n" );
 
@@ -83,7 +84,7 @@ class Block
                        $sql = "SELECT * FROM $ipblocks WHERE ipb_user={$user} $options";
                } elseif ($user=="") {
                        $sql = "SELECT * FROM $ipblocks WHERE ipb_address='" . $db->strencode( $address ) . "' $options";
-               } elseif ( $options=='' ) {
+               } elseif ( $options=='' && $wgDBmysql4 ) {
                        # If there are no optiones (e.g. FOR UPDATE), use a UNION
                        # so that the query can make efficient use of indices
                        $sql = "SELECT * FROM $ipblocks WHERE ipb_address='" . $db->strencode( $address ) .
@@ -198,6 +199,9 @@ class Block
        function delete() 
        {
                $fname = 'Block::delete';
+               if (wfReadOnly()) {
+                       return;
+               }
                $dbw =& wfGetDB( DB_MASTER );
 
                if ( $this->mAddress == '' ) {