Patch for Bug #28669, “Scream bloody murder when user chooses MyISAM and InnoDB is...
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 20 May 2011 18:26:59 +0000 (18:26 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 20 May 2011 18:26:59 +0000 (18:26 +0000)
From William Demchick

CREDITS
includes/installer/Installer.i18n.php
includes/installer/MysqlInstaller.php

diff --git a/CREDITS b/CREDITS
index df73c8e..741308e 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -148,6 +148,7 @@ following names for their contribution to the product.
 * Umherirrender
 * Ville Stadista
 * Vitaliy Filippov
+* William Demchick
 * Yuvaraj Pandian T
 * Zachary Hauri
 
index 524e1b3..6aad7dc 100644 (file)
@@ -317,6 +317,15 @@ The account you specify here must already exist.',
        'config-mysql-engine'             => 'Storage engine:',
        'config-mysql-innodb'             => 'InnoDB',
        'config-mysql-myisam'             => 'MyISAM',
+       'config-mysql-myisam-dep'         => "'''Warning''': You have selected MyISAM.  MyISAM is not recommended for use with MediaWiki, because:
+* it barely supports concurrency due to table locking
+* it is more prone to corruption than other engines
+* the MediaWiki codebase does not always handle MyISAM as it should
+* probably other reasons...
+
+If your MySQL installation supports InnoDB, it is highly recommended that you choose that instead.
+If your MySQL installation does not support InnoDB, maybe its time for an upgrade.
+",
        'config-mysql-engine-help'        => "'''InnoDB''' is almost always the best option, since it has good concurrency support.
 
 '''MyISAM''' may be faster in single-user or read-only installations.
index a5a2a3e..1555104 100644 (file)
@@ -318,13 +318,33 @@ class MysqlInstaller extends DatabaseInstaller {
                if ( !in_array( $this->getVar( '_MysqlEngine' ), $engines ) ) {
                        $this->setVar( '_MysqlEngine', reset( $engines ) );
                }
+
+               $s .= Xml::openElement( 'div', array(
+                       'id' => 'dbMyisamWarning'
+               ));
+               $s .= $this->parent->getWarningBox( wfMsg( 'config-mysql-myisam-dep' ) );
+               $s .= Xml::closeElement( 'div' );
+
+               if( $this->getVar( '_MysqlEngine' ) != 'MyISAM' ) {
+                       $s .= Xml::openElement( 'script', array( 'type' => 'text/javascript' ) );
+                       $s .= '$(\'#dbMyisamWarning\').hide();';
+                       $s .= Xml::closeElement( 'script' );
+               }
+
                if ( count( $engines ) >= 2 ) {
                        $s .= $this->getRadioSet( array(
                                'var' => '_MysqlEngine',
                                'label' => 'config-mysql-engine',
                                'itemLabelPrefix' => 'config-mysql-',
-                               'values' => $engines
-                       ));
+                               'values' => $engines,
+                               'itemAttribs' => array(
+                                       'MyISAM' => array(
+                                               'class' => 'showHideRadio',
+                                               'rel'   => 'dbMyisamWarning'),
+                                       'InnoDB' => array(
+                                               'class' => 'hideShowRadio',
+                                               'rel'   => 'dbMyisamWarning')
+                       )));
                        $s .= $this->parent->getHelpBox( 'config-mysql-engine-help' );
                }