** Moved the responsibility for calling setupSchemaVars() on install to the DatabaseInstaller subclass. This allows it to be called after setupDatabase() has completed, as required by Oracle and PostgreSQL.
** Fixed OracleInstaller::getConnection() so that it respects $this->useSysDBA correctly.
** In OracleInstaller, added some more variables to the list of schema vars, which are needed by user.sql and tables.sql
** In SearchOracle, specify the database name when calling ctx_ddl.sync_index(). This fixes a fatal error in the createMainpage step, caused by the schema name not being equal to the current user.
* In oracle/tables.sql, fixed a couple of indexes with missing table prefixes.
* Improved debugging output in DatabaseInstaller::getConnection() and Installer::createMainpage().
* In DatabaseBase::selectDB(), set $this->mDBname correctly, as in DatabaseMysql.
# Stub. Shouldn't cause serious problems if it's not overridden, but
# if your database engine supports a concept similar to MySQL's
# databases you may as well.
+ $this->mDBname = $db;
return true;
}
}
function selectDB( $db ) {
- if ( $db == null || $db == $this->mUser ) { return true; }
+ $this->mDBname = $db;
+ if ( $db == null || $db == $this->mUser ) {
+ return true;
+ }
$sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper($db);
$stmt = oci_parse( $this->mConn, $sql );
- if ( !oci_execute( $stmt ) ) {
+ wfSuppressWarnings();
+ $success = oci_execute( $stmt );
+ wfRestoreWarnings();
+ if ( !$success ) {
$e = oci_error( $stmt );
if ( $e['code'] != '1435' ) {
$this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ );
$status = $this->getConnection();
if ( $status->isOK() ) {
$status->value->setSchemaVars( $this->getSchemaVars() );
+ } else {
+ throw new MWException( __METHOD__.': unexpected DB connection error' );
}
}
'config-install-sysop' => 'Creating administrator user account',
'config-install-subscribe-fail' => 'Unable to subscribe to mediawiki-announce',
'config-install-mainpage' => 'Creating main page with default content',
- 'config-install-mainpage-failed' => 'Could not insert main page.',
+ 'config-install-mainpage-failed' => 'Could not insert main page: $1',
'config-install-done' => "'''Congratulations!'''
You have successfully installed MediaWiki.
$installResults = array();
$installer = $this->getDBInstaller();
$installer->preInstall();
- $installer->setupSchemaVars();
$steps = $this->getInstallSteps( $installer );
foreach( $steps as $stepObj ) {
$name = $stepObj['name'];
$conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ );
$conn->selectDB( $dbName );
}
+ $this->setupSchemaVars();
return $status;
}
public $minimumVersion = '9.0.1'; // 9iR1
+ protected $sysConn, $userConn;
+
public function getName() {
return 'oracle';
}
$this->getVar( 'wgDBserver' ),
$this->getVar( '_InstallUser' ),
$this->getVar( '_InstallPassword' ),
- $this->getVar( 'wgDBname' ),
+ $this->getVar( '_InstallUser' ),
DBO_SYSDBA | DBO_DDLMODE,
$this->getVar( 'wgDBprefix' )
);
return $status;
}
+ /**
+ * Cache the two different types of connection which can be returned by
+ * openConnection().
+ *
+ * $this->db will be set to the last used connection object.
+ *
+ * FIXME: openConnection() should not be doing two different things.
+ */
+ public function getConnection() {
+ // Check cache
+ if ( $this->useSysDBA ) {
+ $conn = $this->sysConn;
+ } else {
+ $conn = $this->userConn;
+ }
+ if ( $conn !== null ) {
+ $this->db = $conn;
+ return Status::newGood( $conn );
+ }
+
+ // Open a new connection
+ $status = $this->openConnection();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+
+ // Save to the cache
+ if ( $this->useSysDBA ) {
+ $this->sysConn = $status->value;
+ } else {
+ $this->userConn = $status->value;
+ }
+ $this->db = $status->value;
+ return $status;
+ }
+
public function needsUpgrade() {
$tempDBname = $this->getVar( 'wgDBname' );
$this->parent->setVar( 'wgDBname', $this->getVar( 'wgDBuser' ) );
return $status;
}
+ $this->setupSchemaVars();
+
if ( !$this->db->selectDB( $this->getVar( 'wgDBuser' ) ) ) {
$this->db->setFlag( DBO_DDLMODE );
$error = $this->db->sourceFile( "$IP/maintenance/oracle/user.sql" );
}
}
+
return $status;
}
* Overload: after this action field info table has to be rebuilt
*/
public function createTables() {
+ $this->setupSchemaVars();
+ $this->db->selectDB( $this->getVar( 'wgDBuser' ) );
$status = parent::createTables();
$this->db->query( 'BEGIN fill_wiki_info; END;' );
}
public function getSchemaVars() {
- /**
- * The variables $_OracleDefTS, $_OracleTempTS are used by maintenance/oracle/user.sql
- */
- return array(
- '_OracleDefTS' => $this->getVar( '_OracleDefTS' ),
- '_OracleTempTS' => $this->getVar( '_OracleTempTS' ),
+ $varNames = array(
+ # These variables are used by maintenance/oracle/user.sql
+ '_OracleDefTS',
+ '_OracleTempTS',
+ 'wgDBuser',
+ 'wgDBpassword',
+
+ # These are used by tables.sql
+ 'wgDBprefix',
);
+ $vars = array();
+ foreach ( $varNames as $name ) {
+ $vars[$name] = $this->getVar( $name );
+ }
+ return $vars;
}
public function getLocalSettings() {
if ( !$status->isOK() ) {
return $status;
}
+ $this->setupSchemaVars();
$conn = $status->value;
$dbName = $this->getVar( 'wgDBname' );
$this->setVar( 'wgDBserver', '' );
$this->setVar( 'wgDBuser', '' );
$this->setVar( 'wgDBpassword', '' );
+ $this->setupSchemaVars();
return $this->getConnection();
}
'si_title' => $title,
'si_text' => $text
), 'SearchOracle::update' );
- $dbw->query("CALL ctx_ddl.sync_index('si_text_idx')");
- $dbw->query("CALL ctx_ddl.sync_index('si_title_idx')");
+
+ // Sync the index
+ // We need to specify the DB name (i.e. user/schema) here so that
+ // it can work from the installer, where
+ // ALTER SESSION SET CURRENT_SCHEMA = ...
+ // was used.
+ $dbw->query( "CALL ctx_ddl.sync_index(" .
+ $dbw->addQuotes( $dbw->getDBname() . '.si_text_idx' ) . ")" );
+ $dbw->query( "CALL ctx_ddl.sync_index(" .
+ $dbw->addQuotes( $dbw->getDBname() . '.si_title_idx' ) . ")" );
}
/**
--);
--CREATE UNIQUE INDEX &mw_prefix.profiling_u01 ON &mw_prefix.profiling (pf_name, pf_server);
-CREATE INDEX si_title_idx ON &mw_prefix.searchindex(si_title) INDEXTYPE IS ctxsys.context;
-CREATE INDEX si_text_idx ON &mw_prefix.searchindex(si_text) INDEXTYPE IS ctxsys.context;
+CREATE INDEX &mw_prefix.si_title_idx ON &mw_prefix.searchindex(si_title) INDEXTYPE IS ctxsys.context;
+CREATE INDEX &mw_prefix.si_text_idx ON &mw_prefix.searchindex(si_text) INDEXTYPE IS ctxsys.context;
CREATE TABLE &mw_prefix.l10n_cache (
lc_lang varchar2(32) NOT NULL,