Skip to content

Commit

Permalink
Merged from MOODLE_19_STABLE. Under MySQL, create the db on install i…
Browse files Browse the repository at this point in the history
…f possible. MDL-9609
  • Loading branch information
stronk7 committed Dec 29, 2007
1 parent 98965c0 commit 2a6d7f5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,12 @@
error_reporting(0); // Hide errors

if (! $dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname'])) {
/// The following doesn't seem to work but we're working on it
/// If you come up with a solution for creating a database in MySQL
/// feel free to put it in and let us know - see MDL-9609
if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
$db->database = ''; // reset database name cached by ADODB. Trick from MDL-9609
if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) { /// Try to connect without DB
switch ($INSTALL['dbtype']) { /// Try to create a database
case 'mysql':
case 'mysqli':
if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) {
if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']} DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;")) {
$dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']);
} else {
$errormsg = get_string('dbcreationerror', 'install');
Expand Down

0 comments on commit 2a6d7f5

Please sign in to comment.