* fixed r74949 remarks
authorJure Kajzer <freakolowsky@users.mediawiki.org>
Tue, 19 Oct 2010 06:25:12 +0000 (06:25 +0000)
committerJure Kajzer <freakolowsky@users.mediawiki.org>
Tue, 19 Oct 2010 06:25:12 +0000 (06:25 +0000)
* modified version lookup, added 9iR1 as minimum version for installation.

includes/db/DatabaseOracle.php
includes/installer/Installer.i18n.php
includes/installer/OracleInstaller.php

index 3fbbd65..e43613d 100644 (file)
@@ -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__ );
                        }
index 99bf31a..55d9bb2 100644 (file)
@@ -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.<br />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.
index 028f28d..8eb00bd 100644 (file)
@@ -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;
        }