1
0
mirror of https://github.com/moodle/moodle.git synced 2025-04-24 09:55:33 +02:00

MDL-43189 core: Validate db prefix during installation

This commit is contained in:
Shamim Rezaie 2019-07-08 15:58:56 +10:00 committed by Jake Dallimore
parent e04a73ccc0
commit 6def9cd253
2 changed files with 4 additions and 0 deletions

@ -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';

@ -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);