diff --git a/install.php b/install.php index 64f74d02541..66005c94808 100644 --- a/install.php +++ b/install.php @@ -140,7 +140,9 @@ $INSTALL['version'] = $version; $INSTALL['release'] = $release; /// Have the $db object ready because we are going to use it often +define ('ADODB_ASSOC_CASE', 0); //Use lowercase fieldnames for ADODB_FETCH_ASSOC $db = &ADONewConnection($INSTALL['dbtype']); +$db->SetFetchMode(ADODB_FETCH_ASSOC); /// guess the www root if ($INSTALL['wwwroot'] == '') { @@ -280,6 +282,50 @@ if ($INSTALL['stage'] == DATABASE) { } } + if ($INSTALL['dbtype'] == 'postgres7') { /// Check PostgreSQL extension is present + if (!extension_loaded('pgsql')) { + $errormsg = get_string('pgsqlextensionisnotpresentinphp', 'install'); + $nextstage = DATABASE; + } + } + + if ($INSTALL['dbtype'] == 'mssql') { /// Check MSSQL extension is present + if (!extension_loaded('mssql')) { + $errormsg = get_string('mssqlextensionisnotpresentinphp', 'install'); + $nextstage = DATABASE; + } + } + + if ($INSTALL['dbtype'] == 'odbc_mssql') { /// Check ODBC extension is present + if (!extension_loaded('odbc')) { + $errormsg = get_string('odbcextensionisnotpresentinphp', 'install'); + $nextstage = DATABASE; + } + } + + if ($INSTALL['dbtype'] == 'oci8po') { /// Check OCI extension is present + if (!extension_loaded('oci8')) { + $errormsg = get_string('ociextensionisnotpresentinphp', 'install'); + $nextstage = DATABASE; + } + } + + if (empty($INSTALL['prefix']) && $INSTALL['dbtype'] != 'mysql') { // All DBs but MySQL require prefix (reserv. words) + $errormsg = get_string('dbwrongprefix', 'install'); + $nextstage = DATABASE; + } + + if ($INSTALL['dbtype'] == 'oci8po' && strlen($INSTALL['prefix']) > 2) { // Oracle max prefix = 2cc (30cc limit) + $errormsg = get_string('dbwrongprefix', 'install'); + $nextstage = DATABASE; + } + + if ($INSTALL['dbtype'] == 'oci8po' && !empty($INSTALL['dbhost'])) { // Oracle host must be blank (tnsnames.ora has it) + $errormsg = get_string('dbwronghostserver', 'install'); + $nextstage = DATABASE; + } + + if (empty($errormsg)) { error_reporting(0); // Hide errors @@ -354,6 +400,26 @@ if ($INSTALL['stage'] == DATABASE) { } } break; + case 'oci8po': + ///Get Oracle NLS_CHARACTERSET value + $rs = $db->Execute("SELECT value FROM nls_database_parameters WHERE parameter = 'NLS_CHARACTERSET'"); + if ($rs && $rs->RecordCount() > 0) { + $encoding = $rs->fields['value']; + if (strtoupper($encoding) != 'AL32UTF8') { + $errormsg = get_string('dbwrongencoding', 'install', $encoding); + $nextstage = DATABASE; + $INSTALL['dbencodingtestresults'] = false; + } else { + $INSTALL['dbencodingtestresults'] = true; + } + } + /// Get client NLS_LANG environment variable + if (strpos(getenv('NLS_LANG'), 'AL32UTF8') === false) { // Oracle client must be correct UTF8 + $errormsg = get_string('dbwrongnlslang', 'install', $encoding); + $nextstage = DATABASE; + $INSTALL['dbencodingtestresults'] = false; + } + break; } } } @@ -534,6 +600,7 @@ if ($nextstage == SAVE) {
';
+ echo '
';
+ echo get_string('moodledocslink', 'install') . '
';
+ echo '
';
+ echo get_string('moodledocslink', 'install') . '
';
+ echo '
';
+ echo get_string('moodledocslink', 'install') . '
' . $substagetext[$nextstage] . '
'; + } + } + ?>