(bug 25969) Allow hyphens in db name/prefix. Lots of duplication here :(
authorChad Horohoe <demon@users.mediawiki.org>
Thu, 6 Jan 2011 22:43:46 +0000 (22:43 +0000)
committerChad Horohoe <demon@users.mediawiki.org>
Thu, 6 Jan 2011 22:43:46 +0000 (22:43 +0000)
includes/installer/Installer.i18n.php
includes/installer/MysqlInstaller.php

index 39468f2..c99a614 100644 (file)
@@ -234,9 +234,9 @@ If you do not see the database system you are trying to use listed below, then f
        'config-invalid-db-server-oracle' => 'Invalid database TNS "$1".
 Use only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_) and dots (.).',
        'config-invalid-db-name'          => 'Invalid database name "$1".
-Use only ASCII letters (a-z, A-Z), numbers (0-9) and underscores (_).',
+Use only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_) and hyphens (-).',
        'config-invalid-db-prefix'        => 'Invalid database prefix "$1".
-Use only ASCII letters (a-z, A-Z), numbers (0-9) and underscores (_).',
+Use only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_) and hyphens (-).',
        'config-connection-error'         => '$1.
 
 Check the host, username and password below and try again.',
index 5f963a2..82734f2 100644 (file)
@@ -76,10 +76,10 @@ class MysqlInstaller extends DatabaseInstaller {
                $status = Status::newGood();
                if ( !strlen( $newValues['wgDBname'] ) ) {
                        $status->fatal( 'config-missing-db-name' );
-               } elseif ( !preg_match( '/^[a-zA-Z0-9_]+$/', $newValues['wgDBname'] ) ) {
+               } elseif ( !preg_match( '/^[a-z0-9_-]+$/i', $newValues['wgDBname'] ) ) {
                        $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
                }
-               if ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBprefix'] ) ) {
+               if ( !preg_match( '/^[a-z0-9_-]*$/i', $newValues['wgDBprefix'] ) ) {
                        $status->fatal( 'config-invalid-db-prefix', $newValues['wgDBprefix'] );
                }
                if ( !$status->isOK() ) {