r18631 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r18630‎ | r18631 | r18632 >
Date:11:59, 29 December 2006
Author:robchurch
Status:old
Tags:
Comment:
(bug 6449) Throw a more definitive error message when installation fails due to an invalid database name
Modified paths:
  • /trunk/phase3/RELEASE-NOTES (modified) (history)
  • /trunk/phase3/config/index.php (modified) (history)

Diff [purge]

Index: trunk/phase3/config/index.php
@@ -793,11 +793,16 @@
794794 print "<li>Database <tt>" . htmlspecialchars( $wgDBname ) . "</tt> exists</li>\n";
795795 } else {
796796 $err = mysql_errno();
797 - if ( $err != 1049 ) {
798 - print "<ul><li>Error selecting database $wgDBname: $err " .
799 - htmlspecialchars( mysql_error() ) . "</li></ul>";
 797+ $databaseSafe = htmlspecialchars( $wgDBname );
 798+ if( $err == 1102 /* Invalid database name */ ) {
 799+ print "<ul><li><strong>{$databaseSafe}</strong> is not a valid database name.</li></ul>";
800800 continue;
 801+ } elseif( $err != 1049 /* Database doesn't exist */ ) {
 802+ print "<ul><li>Error selecting database <strong>{$databaseSafe}</strong>: {$err} ";
 803+ print htmlspecialchars( mysql_error() ) . "</li></ul>";
 804+ continue;
801805 }
 806+ print "<li>Attempting to create database...</li>";
802807 $res = $wgDatabase->query( "CREATE DATABASE `$wgDBname`" );
803808 if( !$res ) {
804809 print "<li>Couldn't create database <tt>" .
Index: trunk/phase3/RELEASE-NOTES
@@ -425,6 +425,8 @@
426426 Linux systems with at least some versions of PHP
427427 * (bug 5908) Allow overriding the default category sort key for all items on
428428 a page using {{DEFAULTSORT}}
 429+* (bug 6449) Throw a more definitive error message when installation fails
 430+ due to an invalid database name
429431
430432 == Languages updated ==
431433