* (bug 7312) Don't emit SET NAMES utf8 if connection failed
authorBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Sep 2006 15:27:04 +0000 (15:27 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Wed, 13 Sep 2006 15:27:04 +0000 (15:27 +0000)
RELEASE-NOTES
includes/Database.php

index d78a158..6ed8a09 100644 (file)
@@ -198,6 +198,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 6216) The immobile namespace message does not mention the source page
 * (bug 7299) Normalize username filter on Special:Newpages
 * (bug 7306) RTL text in an LTR wiki breaks appearance of Special:Recentchanges
+* (bug 7312) Don't emit SET NAMES utf8 if connection failed
 
 
 == Languages updated ==
index 0c1d6df..afd0806 100644 (file)
@@ -516,17 +516,17 @@ class Database {
                        $success = (bool)$this->mConn;
                }
 
-               if ( !$success ) {
+               if ( $success ) {
+                       global $wgDBmysql5;
+                       if( $wgDBmysql5 ) {
+                               // Tell the server we're communicating with it in UTF-8.
+                               // This may engage various charset conversions.
+                               $this->query( 'SET NAMES utf8' );
+                       }
+               } else {
                        $this->reportConnectionError();
                }
 
-               global $wgDBmysql5;
-               if( $wgDBmysql5 ) {
-                       // Tell the server we're communicating with it in UTF-8.
-                       // This may engage various charset conversions.
-                       $this->query( 'SET NAMES utf8' );
-               }
-
                $this->mOpened = $success;
                wfProfileOut( __METHOD__ );
                return $success;