Merge "Make wfForeignMemcKey consistent with wfMemcKey"
[lhc/web/wiklou.git] / includes / db / DatabaseOracle.php
index 4fa2397..2ccc056 100644 (file)
@@ -249,6 +249,7 @@ class DatabaseOracle extends DatabaseBase {
         * @return DatabaseBase|null
         */
        function open( $server, $user, $password, $dbName ) {
+               global $wgDBOracleDRCP;
                if ( !function_exists( 'oci_connect' ) ) {
                        throw new DBConnectionError( $this, "Oracle functions missing, have you compiled PHP with the --with-oci8 option?\n (Note: if you recently installed PHP, you may need to restart your webserver and database)\n" );
                }
@@ -276,9 +277,16 @@ class DatabaseOracle extends DatabaseBase {
                        return;
                }
 
+               if ( $wgDBOracleDRCP ) {
+                       $this->setFlag( DBO_PERSISTENT );
+               }
+
                $session_mode = $this->mFlags & DBO_SYSDBA ? OCI_SYSDBA : OCI_DEFAULT;
+
                wfSuppressWarnings();
-               if ( $this->mFlags & DBO_DEFAULT ) {
+               if ( $this->mFlags & DBO_PERSISTENT ) {
+                       $this->mConn = oci_pconnect( $this->mUser, $this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
+               } else if ( $this->mFlags & DBO_DEFAULT ) {
                        $this->mConn = oci_new_connect( $this->mUser, $this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
                } else {
                        $this->mConn = oci_connect( $this->mUser, $this->mPassword, $this->mServer, $this->defaultCharset, $session_mode );
@@ -333,7 +341,7 @@ class DatabaseOracle extends DatabaseBase {
                $union_unique = ( preg_match( '/\/\* UNION_UNIQUE \*\/ /', $sql ) != 0 );
                // EXPLAIN syntax in Oracle is EXPLAIN PLAN FOR and it return nothing
                // you have to select data from plan table after explain
-               $explain_id = date( 'dmYHis' );
+               $explain_id = MWTimestamp::getLocalInstance()->format( 'dmYHis' );
 
                $sql = preg_replace( '/^EXPLAIN /', 'EXPLAIN PLAN SET STATEMENT_ID = \'' . $explain_id . '\' FOR', $sql, 1, $explain_count );