(bug 6449) Throw a more definitive error message when installation fails due to an...
authorRob Church <robchurch@users.mediawiki.org>
Fri, 29 Dec 2006 11:59:47 +0000 (11:59 +0000)
committerRob Church <robchurch@users.mediawiki.org>
Fri, 29 Dec 2006 11:59:47 +0000 (11:59 +0000)
RELEASE-NOTES
config/index.php

index 4afa164..bc5a592 100644 (file)
@@ -425,6 +425,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   Linux systems with at least some versions of PHP
 * (bug 5908) Allow overriding the default category sort key for all items on
   a page using {{DEFAULTSORT}}
+* (bug 6449) Throw a more definitive error message when installation fails
+  due to an invalid database name
 
 == Languages updated ==
 
index 26aa3ec..830b1e4 100644 (file)
@@ -793,11 +793,16 @@ if( $conf->posted && ( 0 == count( $errs ) ) ) {
                                print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
                        } else {
                                $err = mysql_errno();
-                               if ( $err != 1049 ) {
-                                       print "<ul><li>Error selecting database $wgDBname: $err " .
-                                               htmlspecialchars( mysql_error() ) . "</li></ul>";
+                               $databaseSafe = htmlspecialchars( $wgDBname );
+                               if( $err == 1102 /* Invalid database name */ ) {
+                                       print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
+                                       continue;
+                               } elseif( $err != 1049 /* Database doesn't exist */ ) {
+                                       print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
+                                       print htmlspecialchars( mysql_error() ) . "</li></ul>";
                                        continue;
                                }
+                               print "<li>Attempting to create database...</li>";
                                $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
                                if( !$res ) {
                                        print "<li>Couldn't create database <tt>" .