Merge "Revert "Declare visibility for class properties in MySQLMasterPos""
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Fri, 3 Jan 2014 18:12:02 +0000 (18:12 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Fri, 3 Jan 2014 18:12:02 +0000 (18:12 +0000)
1  2 
includes/db/DatabaseMysqlBase.php

@@@ -49,7 -49,7 +49,7 @@@ abstract class DatabaseMysqlBase extend
         * @throws DBConnectionError
         */
        function open( $server, $user, $password, $dbName ) {
 -              global $wgAllDBsAreLocalhost, $wgDBmysql5, $wgSQLMode;
 +              global $wgAllDBsAreLocalhost, $wgSQLMode;
                wfProfileIn( __METHOD__ );
  
                # Debugging hack -- fake cluster
@@@ -95,7 -95,7 +95,7 @@@
  
                        wfProfileOut( __METHOD__ );
  
 -                      return $this->reportConnectionError( $error );
 +                      $this->reportConnectionError( $error );
                }
  
                if ( $dbName != '' ) {
  
                                wfProfileOut( __METHOD__ );
  
 -                              return $this->reportConnectionError( "Error selecting database $dbName" );
 +                              $this->reportConnectionError( "Error selecting database $dbName" );
                        }
                }
  
 -              // Tell the server we're communicating with it in UTF-8.
 -              // This may engage various charset conversions.
 -              if ( $wgDBmysql5 ) {
 -                      $this->mysqlSetCharset( 'utf8' );
 -              } else {
 -                      $this->mysqlSetCharset( 'binary' );
 +              // Tell the server what we're communicating with
 +              if ( !$this->connectInitCharset() ) {
 +                      $this->reportConnectionError( "Error setting character set" );
                }
 +
                // Set SQL mode, default is turning them all off, can be overridden or skipped with null
                if ( is_string( $wgSQLMode ) ) {
                        $mode = $this->addQuotes( $wgSQLMode );
                        if ( !$success ) {
                                wfLogDBError( "Error setting sql_mode to $mode on server {$this->mServer}" );
                                wfProfileOut( __METHOD__ );
 -                              return $this->reportConnectionError( "Error setting sql_mode to $mode" );
 +                              $this->reportConnectionError( "Error setting sql_mode to $mode" );
                        }
                }
  
                return true;
        }
  
 +      /**
 +       * Set the character set information right after connection
 +       * @return bool
 +       */
 +      protected function connectInitCharset() {
 +              global $wgDBmysql5;
 +
 +              if ( $wgDBmysql5 ) {
 +                      // Tell the server we're communicating with it in UTF-8.
 +                      // This may engage various charset conversions.
 +                      return $this->mysqlSetCharset( 'utf8' );
 +              } else {
 +                      return $this->mysqlSetCharset( 'binary' );
 +              }
 +      }
 +
        /**
         * Open a connection to a MySQL server
         *
@@@ -1217,11 -1203,7 +1217,7 @@@ class MySQLField implements Field 
  }
  
  class MySQLMasterPos implements DBMasterPos {
-       /** @var string */
-       private $file;
-       /** @var int */
-       private $pos;
+       var $file, $pos;
  
        function __construct( $file, $pos ) {
                $this->file = $file;