Skip to content

Commit

Permalink
MDL-10930 added mysqli support into installer; it needs install files…
Browse files Browse the repository at this point in the history
… refresh
  • Loading branch information
skodak committed Aug 21, 2007
1 parent 39dc779 commit e102e78
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
19 changes: 17 additions & 2 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,13 @@
}
}

if ($INSTALL['dbtype'] == 'mysqli') { /// Check MySQLi extension is present
if (!extension_loaded('mysqli')) {
$errormsg = get_string('mysqliextensionisnotpresentinphp', 'install');
$nextstage = DATABASE;
}
}

if ($INSTALL['dbtype'] == 'postgres7') { /// Check PostgreSQL extension is present
if (!extension_loaded('pgsql')) {
$errormsg = get_string('pgsqlextensionisnotpresentinphp', 'install');
Expand Down Expand Up @@ -317,7 +324,7 @@
}
}

if (empty($INSTALL['prefix']) && $INSTALL['dbtype'] != 'mysql') { // All DBs but MySQL require prefix (reserv. words)
if (empty($INSTALL['prefix']) && $INSTALL['dbtype'] != 'mysql' && $INSTALL['dbtype'] != 'mysqli') { // All DBs but MySQL require prefix (reserv. words)
$errormsg = get_string('dbwrongprefix', 'install');
$nextstage = DATABASE;
}
Expand All @@ -343,6 +350,7 @@
if ($dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'])) {
switch ($INSTALL['dbtype']) { /// Try to create a database
case 'mysql':
case 'mysqli':
if ($db->Execute("CREATE DATABASE {$INSTALL['dbname']};")) {
$dbconnected = $db->Connect($INSTALL['dbhost'],$INSTALL['dbuser'],$INSTALL['dbpass'],$INSTALL['dbname']);
} else {
Expand All @@ -358,6 +366,7 @@
$encoding = '';
switch ($INSTALL['dbtype']) {
case 'mysql':
case 'mysqli':
/// Get MySQL character_set_database value
$rs = $db->Execute("SHOW VARIABLES LIKE 'character_set_database'");
if ($rs && $rs->RecordCount() > 0) {
Expand Down Expand Up @@ -589,6 +598,8 @@
echo '<script type="text/javascript" defer="defer">window.onload=toggledbinfo;</script>';
echo '<div id="mysql" name="mysql">' . get_string('databasesettingssub_mysql', 'install') . '</div>';

echo '<div id="mysqli" name="mysqli">' . get_string('databasesettingssub_mysqli', 'install') . '</div>';

echo '<div id="postgres7" name="postgres7">' . get_string('databasesettingssub_postgres7', 'install') . '</div>';

echo '<div id="mssql" name="mssql">' . get_string('databasesettingssub_mssql', 'install');
Expand Down Expand Up @@ -793,6 +804,7 @@ function form_table($nextstage = WELCOME, $formaction = "install.php") {
<td class="td_left"><p><?php print_string('dbtype', 'install') ?></p></td>
<td class="td_right">
<?php choose_from_menu (array('mysql' => get_string('mysql', 'install'),
'mysqli' => get_string('mysqli', 'install'),
'oci8po' => get_string('oci8po', 'install'),
'postgres7' => get_string('postgres7', 'install'),
'mssql' => get_string('mssql', 'install'),
Expand Down Expand Up @@ -1201,7 +1213,7 @@ function css_styles() {
padding:0px;
margin:0px;
}
#mysql, #postgres7, #mssql, #mssql_n, #odbc_mssql, #oci8po {
#mysql, #mysqli, #postgres7, #mssql, #mssql_n, #odbc_mssql, #oci8po {
display: none;
}

Expand All @@ -1225,6 +1237,7 @@ function toggledbinfo() {
if (document.getElementById) {
//Hide all the divs
document.getElementById('mysql').style.display = '';
document.getElementById('mysqli').style.display = '';
document.getElementById('postgres7').style.display = '';
document.getElementById('mssql').style.display = '';
document.getElementById('mssql_n').style.display = '';
Expand All @@ -1236,6 +1249,7 @@ function toggledbinfo() {
//This is the way old msie versions work
//Hide all the divs
document.all['mysql'].style.display = '';
document.all['mysqli'].style.display = '';
document.all['postgres7'].style.display = '';
document.all['mssql'].style.display = '';
document.all['mssql_n'].style.display = '';
Expand All @@ -1247,6 +1261,7 @@ function toggledbinfo() {
//This is the way nn4 works
//Hide all the divs
document.layers['mysql'].style.display = '';
document.layers['mysqli'].style.display = '';
document.layers['postgres7'].style.display = '';
document.layers['mssql'].style.display = '';
document.layers['mssql_n'].style.display = '';
Expand Down
3 changes: 3 additions & 0 deletions install/stringnames.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ databasesettingssub
databasesettingssub_mssql
databasesettingssub_mssql_n
databasesettingssub_mysql
databasesettingssub_mysqli
databasesettingssub_oci8po
databasesettingssub_odbc_mssql
databasesettingssub_postgres7
Expand Down Expand Up @@ -97,9 +98,11 @@ mssql
mssql_n
mssqlextensionisnotpresentinphp
mysql
mysqli
mysql416bypassed
mysql416required
mysqlextensionisnotpresentinphp
mysqliextensionisnotpresentinphp
name
next
oci8po
Expand Down
8 changes: 8 additions & 0 deletions lang/en_utf8/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@
<b>User:</b> your database username<br />
<b>Password:</b> your database password<br />
<b>Tables Prefix:</b> prefix to use for all table names (optional)';
$string['databasesettingssub_mysqli'] = '<b>Type:</b> Improved MySQL<br />
<b>Host:</b> eg localhost or db.isp.com<br />
<b>Name:</b> database name, eg moodle<br />
<b>User:</b> your database username<br />
<b>Password:</b> your database password<br />
<b>Tables Prefix:</b> prefix to use for all table names (optional)';
$string['databasesettingssub_oci8po'] = '<b>Type:</b> Oracle<br />
<b>Host:</b> not used, must be left blank<br />
<b>Name:</b> given name of the tnsnames.ora connection<br />
Expand Down Expand Up @@ -232,7 +238,9 @@
$string['mssql_n'] = 'SQL*Server with UTF-8 support (mssql_n)';
$string['mssqlextensionisnotpresentinphp'] = 'PHP has not been properly configured with the MSSQL extension so that it can communicate with SQL*Server. Please check your php.ini file or recompile PHP.';
$string['mysql'] = 'MySQL (mysql)';
$string['mysqli'] = 'Improved MySQL (mysqli)';
$string['mysqlextensionisnotpresentinphp'] = 'PHP has not been properly configured with the MySQL extension so that it can communicate with MySQL. Please check your php.ini file or recompile PHP.';
$string['mysqliextensionisnotpresentinphp'] = 'PHP has not been properly configured with the MySQLi extension so that it can communicate with MySQL. Please check your php.ini file or recompile PHP. MySQLi extension is not available for PHP 4.';
$string['oci8po'] = 'Oracle (oci8po)';
$string['ociextensionisnotpresentinphp'] = 'PHP has not been properly configured with the OCI8 extension so that it can communicate with Oracle. Please check your php.ini file or recompile PHP.';
$string['odbc_mssql'] = 'SQL*Server over ODBC (odbc_mssql)';
Expand Down

0 comments on commit e102e78

Please sign in to comment.