diff --git a/lang/en/install.php b/lang/en/install.php index 9d064809a6d..a0771134319 100644 --- a/lang/en/install.php +++ b/lang/en/install.php @@ -144,6 +144,7 @@ $string['inputdatadirectory'] = 'Data directory:'; $string['inputwebadress'] = 'Web address :'; $string['inputwebdirectory'] = 'Moodle directory:'; $string['installation'] = 'Installation'; +$string['invaliddbprefix'] = 'Invalid prefix. The prefix can only consist of lower case letters and underscore.'; $string['langdownloaderror'] = 'Unfortunately the language "{$a}" could not be downloaded. The installation process will continue in English.'; $string['langdownloadok'] = 'The language "{$a}" was installed successfully. The installation process will continue in this language.'; $string['memorylimit'] = 'Memory limit'; diff --git a/lib/installlib.php b/lib/installlib.php index e8a4bc988ca..5144936a42c 100644 --- a/lib/installlib.php +++ b/lib/installlib.php @@ -179,6 +179,9 @@ function install_helpbutton($url, $title='') { * @return string */ function install_db_validate($database, $dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions) { + if (!preg_match('/^[a-z_]*$/', $prefix)) { + return get_string('invaliddbprefix', 'install'); + } try { try { $database->connect($dbhost, $dbuser, $dbpass, $dbname, $prefix, $dboptions);