Fixed behavior of Title::invalidateCache.
[lhc/web/wiklou.git] / includes / installer / MysqlInstaller.php
index 06821f8..e0bf3d7 100644 (file)
@@ -86,8 +86,7 @@ class MysqlInstaller extends DatabaseInstaller {
         * @return string
         */
        public function getConnectForm() {
-               return
-                       $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+               return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
                        Html::openElement( 'fieldset' ) .
                        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' ) ) .
@@ -153,7 +152,6 @@ class MysqlInstaller extends DatabaseInstaller {
                                $this->getVar( '_InstallUser' ),
                                $this->getVar( '_InstallPassword' ),
                                false,
-                               false,
                                0,
                                $this->getVar( 'wgDBprefix' )
                        );
@@ -351,10 +349,14 @@ class MysqlInstaller extends DatabaseInstaller {
                $s .= Xml::openElement( 'div', array(
                        'id' => 'dbMyisamWarning'
                ));
-               $s .= $this->parent->getWarningBox( wfMessage( 'config-mysql-myisam-dep' )->text() );
+               $myisamWarning = 'config-mysql-myisam-dep';
+               if ( count( $engines ) === 1 ) {
+                       $myisamWarning = 'config-mysql-only-myisam-dep';
+               }
+               $s .= $this->parent->getWarningBox( wfMessage( $myisamWarning )->text() );
                $s .= Xml::closeElement( 'div' );
 
-               if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
+               if ( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
                        $s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) );
                        $s .= '$(\'#dbMyisamWarning\').hide();';
                        $s .= Xml::closeElement( 'script' );
@@ -372,10 +374,12 @@ class MysqlInstaller extends DatabaseInstaller {
                                'itemAttribs' => array(
                                        'MyISAM' => array(
                                                'class' => 'showHideRadio',
-                                               'rel'   => 'dbMyisamWarning'),
+                                               'rel' => 'dbMyisamWarning'
+                                       ),
                                        'InnoDB' => array(
                                                'class' => 'hideShowRadio',
-                                               'rel'   => 'dbMyisamWarning')
+                                               'rel' => 'dbMyisamWarning'
+                                       )
                        )));
                        $s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
                }
@@ -430,7 +434,6 @@ class MysqlInstaller extends DatabaseInstaller {
                                        $this->getVar( 'wgDBuser' ),
                                        $this->getVar( 'wgDBpassword' ),
                                        false,
-                                       false,
                                        0,
                                        $this->getVar( 'wgDBprefix' )
                                );
@@ -471,7 +474,7 @@ class MysqlInstaller extends DatabaseInstaller {
                }
                $conn = $status->value;
                $dbName = $this->getVar( 'wgDBname' );
-               if( !$conn->selectDB( $dbName ) ) {
+               if ( !$conn->selectDB( $dbName ) ) {
                        $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
                        $conn->selectDB( $dbName );
                }
@@ -484,7 +487,7 @@ class MysqlInstaller extends DatabaseInstaller {
         */
        public function setupUser() {
                $dbUser = $this->getVar( 'wgDBuser' );
-               if( $dbUser == $this->getVar( '_InstallUser' ) ) {
+               if ( $dbUser == $this->getVar( '_InstallUser' ) ) {
                        return Status::newGood();
                }
                $status = $this->getConnection();
@@ -507,7 +510,6 @@ class MysqlInstaller extends DatabaseInstaller {
                                        $dbUser,
                                        $password,
                                        false,
-                                       false,
                                        0,
                                        $this->getVar( 'wgDBprefix' )
                                );
@@ -521,7 +523,7 @@ class MysqlInstaller extends DatabaseInstaller {
                        $tryToCreate = false;
                }
 
-               if( $tryToCreate ) {
+               if ( $tryToCreate ) {
                        $createHostList = array(
                                $server,
                                'localhost',
@@ -532,16 +534,16 @@ class MysqlInstaller extends DatabaseInstaller {
                        $createHostList = array_unique( $createHostList );
                        $escPass = $this->db->addQuotes( $password );
 
-                       foreach( $createHostList as $host ) {
+                       foreach ( $createHostList as $host ) {
                                $fullName = $this->buildFullUserName( $dbUser, $host );
-                               if( !$this->userDefinitelyExists( $dbUser, $host ) ) {
-                                       try{
+                               if ( !$this->userDefinitelyExists( $dbUser, $host ) ) {
+                                       try {
                                                $this->db->begin( __METHOD__ );
                                                $this->db->query( "CREATE USER $fullName IDENTIFIED BY $escPass", __METHOD__ );
                                                $this->db->commit( __METHOD__ );
                                                $grantableNames[] = $fullName;
-                                       } catch( DBQueryError $dqe ) {
-                                               if( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
+                                       } catch ( DBQueryError $dqe ) {
+                                               if ( $this->db->lastErrno() == 1396 /* ER_CANNOT_USER */ ) {
                                                        // User (probably) already exists
                                                        $this->db->rollback( __METHOD__ );
                                                        $status->warning( 'config-install-user-alreadyexists', $dbUser );
@@ -564,12 +566,12 @@ class MysqlInstaller extends DatabaseInstaller {
 
                // Try to grant to all the users we know exist or we were able to create
                $dbAllTables = $this->db->addIdentifierQuotes( $dbName ) . '.*';
-               foreach( $grantableNames as $name ) {
+               foreach ( $grantableNames as $name ) {
                        try {
                                $this->db->begin( __METHOD__ );
                                $this->db->query( "GRANT ALL PRIVILEGES ON $dbAllTables TO $name", __METHOD__ );
                                $this->db->commit( __METHOD__ );
-                       } catch( DBQueryError $dqe ) {
+                       } catch ( DBQueryError $dqe ) {
                                $this->db->rollback( __METHOD__ );
                                $status->fatal( 'config-install-user-grant-failed', $dbUser, $dqe->getText() );
                        }
@@ -600,7 +602,7 @@ class MysqlInstaller extends DatabaseInstaller {
                        $res = $this->db->selectRow( 'mysql.user', array( 'Host', 'User' ),
                                array( 'Host' => $host, 'User' => $user ), __METHOD__ );
                        return (bool)$res;
-               } catch( DBQueryError $dqe ) {
+               } catch ( DBQueryError $dqe ) {
                        return false;
                }