Localisation updates from http://translatewiki.net.
[lhc/web/wiklou.git] / includes / installer / MysqlInstaller.php
index 43587ca..f66f15f 100644 (file)
@@ -2,6 +2,21 @@
 /**
  * MySQL-specific installer.
  *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
  * @file
  * @ingroup Deployment
  */
@@ -32,7 +47,7 @@ class MysqlInstaller extends DatabaseInstaller {
 
        public $supportedEngines = array( 'InnoDB', 'MyISAM' );
 
-       public $minimumVersion = '4.0.14';
+       public $minimumVersion = '5.0.2';
 
        public $webUserPrivs = array(
                'DELETE',
@@ -74,7 +89,7 @@ class MysqlInstaller extends DatabaseInstaller {
                return
                        $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
                        Html::openElement( 'fieldset' ) .
-                       Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .
+                       Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
                        $this->getTextBox( 'wgDBname', 'config-db-name', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-name-help' ) ) .
                        $this->getTextBox( 'wgDBprefix', 'config-db-prefix', array( 'dir' => 'ltr' ), $this->parent->getHelpBox( 'config-db-prefix-help' ) ) .
                        Html::closeElement( 'fieldset' ) .
@@ -164,7 +179,7 @@ class MysqlInstaller extends DatabaseInstaller {
                $conn->selectDB( $this->getVar( 'wgDBname' ) );
 
                # Determine existing default character set
-               if ( $conn->tableExists( "revision" ) ) {
+               if ( $conn->tableExists( "revision", __METHOD__ ) ) {
                        $revision = $conn->buildLike( $this->getVar( 'wgDBprefix' ) . 'revision' );
                        $res = $conn->query( "SHOW TABLE STATUS $revision", __METHOD__ );
                        $row = $conn->fetchObject( $res );
@@ -174,7 +189,7 @@ class MysqlInstaller extends DatabaseInstaller {
                                $existingEngine = false;
                        } else {
                                if ( preg_match( '/^latin1/', $row->Collation ) ) {
-                                       $existingSchema = 'mysql4';
+                                       $existingSchema = 'latin1';
                                } elseif ( preg_match( '/^utf8/', $row->Collation ) ) {
                                        $existingSchema = 'utf8';
                                } elseif ( preg_match( '/^binary/', $row->Collation ) ) {
@@ -213,22 +228,13 @@ class MysqlInstaller extends DatabaseInstaller {
         * @return array
         */
        public function getEngines() {
-               $engines = array( 'InnoDB', 'MyISAM' );
                $status = $this->getConnection();
-               if ( !$status->isOK() ) {
-                       return $engines;
-               }
+
                /**
                 * @var $conn DatabaseBase
                 */
                $conn = $status->value;
 
-               $version = $conn->getServerVersion();
-               if ( version_compare( $version, "4.1.2", "<" ) ) {
-                       // No SHOW ENGINES in this version
-                       return $engines;
-               }
-
                $engines = array();
                $res = $conn->query( 'SHOW ENGINES', __METHOD__ );
                foreach ( $res as $row ) {
@@ -246,16 +252,7 @@ class MysqlInstaller extends DatabaseInstaller {
         * @return array
         */
        public function getCharsets() {
-               $status = $this->getConnection();
-               $mysql5 = array( 'binary', 'utf8' );
-               $mysql4 = array( 'mysql4' );
-               if ( !$status->isOK() ) {
-                       return $mysql5;
-               }
-               if ( version_compare( $status->value->getServerVersion(), '4.1.0', '>=' ) ) {
-                       return $mysql5;
-               }
-               return $mysql4;
+               return array( 'binary', 'utf8' );
        }
 
        /**
@@ -273,11 +270,6 @@ class MysqlInstaller extends DatabaseInstaller {
                 */
                $conn = $status->value;
 
-               // Check version, need INFORMATION_SCHEMA and CREATE USER
-               if ( version_compare( $conn->getServerVersion(), '5.0.2', '<' ) ) {
-                       return false;
-               }
-
                // Get current account name
                $currentName = $conn->selectField( '', 'CURRENT_USER()', '', __METHOD__ );
                $parts = explode( '@', $currentName );
@@ -359,7 +351,7 @@ class MysqlInstaller extends DatabaseInstaller {
                $s .= Xml::openElement( 'div', array(
                        'id' => 'dbMyisamWarning'
                ));
-               $s .= $this->parent->getWarningBox( wfMsg( 'config-mysql-myisam-dep' ) );
+               $s .= $this->parent->getWarningBox( wfMessage( 'config-mysql-myisam-dep' )->text() );
                $s .= Xml::closeElement( 'div' );
 
                if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
@@ -537,21 +529,21 @@ class MysqlInstaller extends DatabaseInstaller {
                                $fullName = $this->buildFullUserName( $dbUser, $host );
                                if( !$this->userDefinitelyExists( $dbUser, $host ) ) {
                                        try{
-                                               $this->db->begin();
+                                               $this->db->begin( __METHOD__ );
                                                $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
-                                               $this->db->commit();
+                                               $this->db->commit( __METHOD__ );
                                                $grantableNames[] = $fullName;
                                        } catch( DBQueryError $dqe ) {
                                                if( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
                                                        // User (probably) already exists
-                                                       $this->db->rollback();
+                                                       $this->db->rollback( __METHOD__ );
                                                        $status->warning( 'config-install-user-alreadyexists', $dbUser );
                                                        $grantableNames[] = $fullName;
                                                        break;
                                                } else {
                                                        // If we couldn't create for some bizzare reason and the
                                                        // user probably doesn't exist, skip the grant
-                                                       $this->db->rollback();
+                                                       $this->db->rollback( __METHOD__ );
                                                        $status->warning( 'config-install-user-create-failed', $dbUser, $dqe->getText() );
                                                }
                                        }
@@ -567,11 +559,11 @@ class MysqlInstaller extends DatabaseInstaller {
                $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
                foreach( $grantableNames as $name ) {
                        try {
-                               $this->db->begin();
+                               $this->db->begin( __METHOD__ );
                                $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ );
-                               $this->db->commit();
+                               $this->db->commit( __METHOD__ );
                        } catch( DBQueryError $dqe ) {
-                               $this->db->rollback();
+                               $this->db->rollback( __METHOD__ );
                                $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() );
                        }
                }
@@ -649,7 +641,7 @@ class MysqlInstaller extends DatabaseInstaller {
 # MySQL table options to use during installation or update
 \$wgDBTableOptions   = \"{$tblOpts}\";
 
-# Experimental charset support for MySQL 4.1/5.0.
+# Experimental charset support for MySQL 5.0.
 \$wgDBmysql5 = {$dbmysql5};";
        }
 }