From 49c99900749e65ebd989fac7cc688de185786ae0 Mon Sep 17 00:00:00 2001 From: Jure Kajzer Date: Tue, 19 Oct 2010 06:25:12 +0000 Subject: [PATCH] * fixed r74949 remarks * modified version lookup, added 9iR1 as minimum version for installation. --- includes/db/DatabaseOracle.php | 16 ++++++++++------ includes/installer/Installer.i18n.php | 2 +- includes/installer/OracleInstaller.php | 7 ++++--- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/includes/db/DatabaseOracle.php b/includes/db/DatabaseOracle.php index 3fbbd6583a..e43613da05 100644 --- a/includes/db/DatabaseOracle.php +++ b/includes/db/DatabaseOracle.php @@ -238,13 +238,13 @@ class DatabaseOracle extends DatabaseBase { // changed internal variables functions // mServer now holds the TNS endpoint // mDBname is schema name if different from username - if ($server == null || $server == false) { + if ( !$server ) { // backward compatibillity (server used to be null and TNS was supplied in dbname) $this->mServer = $dbName; $this->mDBname = $user; } else { $this->mServer = $server; - if ( $dbName == null || $dbName == false ) { + if ( !$dbName ) { $this->mDBname = $user; } else { $this->mDBname = $dbName; @@ -851,7 +851,12 @@ class DatabaseOracle extends DatabaseBase { * @return string Version information from the database */ function getServerVersion() { - return oci_server_version( $this->mConn ); + //better version number, fallback on driver + $rset = $this->doQuery( 'SELECT version FROM product_component_version WHERE UPPER(product) LIKE \'ORACLE DATABASE%\'' ); + if ( !( $row = $rset->fetchRow() ) ) { + return oci_server_version( $this->mConn ); + } + return $row['version']; } /** @@ -1047,11 +1052,10 @@ class DatabaseOracle extends DatabaseBase { function selectDB( $db ) { if ( $db == null || $db == $this->mUser ) { return true; } - $sql = 'ALTER SESSION SET CURRENT_SCHEMA='.strtoupper($db); - $stmt = oci_parse( $this->mConn, 'ALTER SESSION SET CURRENT_SCHEMA='.strtoupper($db) ); + $sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper($db); + $stmt = oci_parse( $this->mConn, $sql ); if ( !oci_execute( $stmt ) ) { $e = oci_error( $stmt ); -// wfDebugDieBacktrace(print_r($e, true)); if ( $e['code'] != '1435' ) { $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ ); } diff --git a/includes/installer/Installer.i18n.php b/includes/installer/Installer.i18n.php index 99bf31a106..55d9bb2ab4 100644 --- a/includes/installer/Installer.i18n.php +++ b/includes/installer/Installer.i18n.php @@ -178,7 +178,7 @@ If you are using shared web hosting, your hosting provider should give you the c If you are installing on a Windows server and using MySQL, using "localhost" may not work for the server name. If it does not, try "127.0.0.1" for the local IP address.', 'config-db-host-oracle' => 'Database TNS:', - #'config-db-host-oracle-help' => 'TODO!:', // Re-enable this message when the help text is ready + 'config-db-host-oracle-help' => 'Enter a valid [http://download.oracle.com/docs/cd/B28359_01/network.111/b28317/tnsnames.htm Local Connect Name]; a tnsnames.ora file must be visible to this installation.
If you are using client libraries 10g or newer you can also use the [http://download.oracle.com/docs/cd/E11882_01/network.112/e10836/naming.htm Easy Connect] naming method.', 'config-db-wiki-settings' => 'Identify this wiki', 'config-db-name' => 'Database name:', 'config-db-name-help' => 'Choose a name that identifies your wiki. diff --git a/includes/installer/OracleInstaller.php b/includes/installer/OracleInstaller.php index 028f28d7b7..8eb00bd3dc 100644 --- a/includes/installer/OracleInstaller.php +++ b/includes/installer/OracleInstaller.php @@ -28,6 +28,8 @@ class OracleInstaller extends DatabaseInstaller { '_OracleUseSysdba' => true ); + public $minimumVersion = '9.0.1'; // 9iR1 + public function getName() { return 'oracle'; } @@ -100,13 +102,12 @@ class OracleInstaller extends DatabaseInstaller { } $conn = $status->value; -/* // Check version $version = $conn->getServerVersion(); if ( version_compare( $version, $this->minimumVersion ) < 0 ) { - return Status::newFatal( 'config-mysql-old', $this->minimumVersion, $version ); + return Status::newFatal( 'config-oracle-old', $this->minimumVersion, $version ); } -*/ + return $status; } -- 2.20.1