| Index: trunk/phase3/maintenance/oracle/tables.sql |
| — | — | @@ -610,8 +610,8 @@ |
| 611 | 611 | --); |
| 612 | 612 | --CREATE UNIQUE INDEX &mw_prefix.profiling_u01 ON &mw_prefix.profiling (pf_name, pf_server); |
| 613 | 613 | |
| 614 | | -CREATE INDEX si_title_idx ON &mw_prefix.searchindex(si_title) INDEXTYPE IS ctxsys.context; |
| 615 | | -CREATE INDEX si_text_idx ON &mw_prefix.searchindex(si_text) INDEXTYPE IS ctxsys.context; |
| | 614 | +CREATE INDEX &mw_prefix.si_title_idx ON &mw_prefix.searchindex(si_title) INDEXTYPE IS ctxsys.context; |
| | 615 | +CREATE INDEX &mw_prefix.si_text_idx ON &mw_prefix.searchindex(si_text) INDEXTYPE IS ctxsys.context; |
| 616 | 616 | |
| 617 | 617 | CREATE TABLE &mw_prefix.l10n_cache ( |
| 618 | 618 | lc_lang varchar2(32) NOT NULL, |
| Index: trunk/phase3/includes/search/SearchOracle.php |
| — | — | @@ -246,8 +246,16 @@ |
| 247 | 247 | 'si_title' => $title, |
| 248 | 248 | 'si_text' => $text |
| 249 | 249 | ), 'SearchOracle::update' ); |
| 250 | | - $dbw->query("CALL ctx_ddl.sync_index('si_text_idx')"); |
| 251 | | - $dbw->query("CALL ctx_ddl.sync_index('si_title_idx')"); |
| | 250 | + |
| | 251 | + // Sync the index |
| | 252 | + // We need to specify the DB name (i.e. user/schema) here so that |
| | 253 | + // it can work from the installer, where |
| | 254 | + // ALTER SESSION SET CURRENT_SCHEMA = ... |
| | 255 | + // was used. |
| | 256 | + $dbw->query( "CALL ctx_ddl.sync_index(" . |
| | 257 | + $dbw->addQuotes( $dbw->getDBname() . '.si_text_idx' ) . ")" ); |
| | 258 | + $dbw->query( "CALL ctx_ddl.sync_index(" . |
| | 259 | + $dbw->addQuotes( $dbw->getDBname() . '.si_title_idx' ) . ")" ); |
| 252 | 260 | } |
| 253 | 261 | |
| 254 | 262 | /** |
| Index: trunk/phase3/includes/db/DatabaseOracle.php |
| — | — | @@ -1086,10 +1086,16 @@ |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | function selectDB( $db ) { |
| 1090 | | - if ( $db == null || $db == $this->mUser ) { return true; } |
| | 1090 | + $this->mDBname = $db; |
| | 1091 | + if ( $db == null || $db == $this->mUser ) { |
| | 1092 | + return true; |
| | 1093 | + } |
| 1091 | 1094 | $sql = 'ALTER SESSION SET CURRENT_SCHEMA=' . strtoupper($db); |
| 1092 | 1095 | $stmt = oci_parse( $this->mConn, $sql ); |
| 1093 | | - if ( !oci_execute( $stmt ) ) { |
| | 1096 | + wfSuppressWarnings(); |
| | 1097 | + $success = oci_execute( $stmt ); |
| | 1098 | + wfRestoreWarnings(); |
| | 1099 | + if ( !$success ) { |
| 1094 | 1100 | $e = oci_error( $stmt ); |
| 1095 | 1101 | if ( $e['code'] != '1435' ) { |
| 1096 | 1102 | $this->reportQueryError( $e['message'], $e['code'], $sql, __METHOD__ ); |
| Index: trunk/phase3/includes/db/Database.php |
| — | — | @@ -1474,6 +1474,7 @@ |
| 1475 | 1475 | # Stub. Shouldn't cause serious problems if it's not overridden, but |
| 1476 | 1476 | # if your database engine supports a concept similar to MySQL's |
| 1477 | 1477 | # databases you may as well. |
| | 1478 | + $this->mDBname = $db; |
| 1478 | 1479 | return true; |
| 1479 | 1480 | } |
| 1480 | 1481 | |
| Index: trunk/phase3/includes/installer/Installer.php |
| — | — | @@ -1272,7 +1272,6 @@ |
| 1273 | 1273 | $installResults = array(); |
| 1274 | 1274 | $installer = $this->getDBInstaller(); |
| 1275 | 1275 | $installer->preInstall(); |
| 1276 | | - $installer->setupSchemaVars(); |
| 1277 | 1276 | $steps = $this->getInstallSteps( $installer ); |
| 1278 | 1277 | foreach( $steps as $stepObj ) { |
| 1279 | 1278 | $name = $stepObj['name']; |
| Index: trunk/phase3/includes/installer/Installer.i18n.php |
| — | — | @@ -471,7 +471,7 @@ |
| 472 | 472 | 'config-install-sysop' => 'Creating administrator user account', |
| 473 | 473 | 'config-install-subscribe-fail' => 'Unable to subscribe to mediawiki-announce', |
| 474 | 474 | 'config-install-mainpage' => 'Creating main page with default content', |
| 475 | | - 'config-install-mainpage-failed' => 'Could not insert main page.', |
| | 475 | + 'config-install-mainpage-failed' => 'Could not insert main page: $1', |
| 476 | 476 | 'config-install-done' => "'''Congratulations!''' |
| 477 | 477 | You have successfully installed MediaWiki. |
| 478 | 478 | |
| Index: trunk/phase3/includes/installer/SqliteInstaller.php |
| — | — | @@ -144,6 +144,7 @@ |
| 145 | 145 | $this->setVar( 'wgDBserver', '' ); |
| 146 | 146 | $this->setVar( 'wgDBuser', '' ); |
| 147 | 147 | $this->setVar( 'wgDBpassword', '' ); |
| | 148 | + $this->setupSchemaVars(); |
| 148 | 149 | return $this->getConnection(); |
| 149 | 150 | } |
| 150 | 151 | |
| Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
| — | — | @@ -195,6 +195,8 @@ |
| 196 | 196 | $status = $this->getConnection(); |
| 197 | 197 | if ( $status->isOK() ) { |
| 198 | 198 | $status->value->setSchemaVars( $this->getSchemaVars() ); |
| | 199 | + } else { |
| | 200 | + throw new MWException( __METHOD__.': unexpected DB connection error' ); |
| 199 | 201 | } |
| 200 | 202 | } |
| 201 | 203 | |
| Index: trunk/phase3/includes/installer/MysqlInstaller.php |
| — | — | @@ -414,6 +414,7 @@ |
| 415 | 415 | $conn->query( "CREATE DATABASE " . $conn->addIdentifierQuotes( $dbName ), __METHOD__ ); |
| 416 | 416 | $conn->selectDB( $dbName ); |
| 417 | 417 | } |
| | 418 | + $this->setupSchemaVars(); |
| 418 | 419 | return $status; |
| 419 | 420 | } |
| 420 | 421 | |
| Index: trunk/phase3/includes/installer/OracleInstaller.php |
| — | — | @@ -31,6 +31,8 @@ |
| 32 | 32 | |
| 33 | 33 | public $minimumVersion = '9.0.1'; // 9iR1 |
| 34 | 34 | |
| | 35 | + protected $sysConn, $userConn; |
| | 36 | + |
| 35 | 37 | public function getName() { |
| 36 | 38 | return 'oracle'; |
| 37 | 39 | } |
| — | — | @@ -117,7 +119,7 @@ |
| 118 | 120 | $this->getVar( 'wgDBserver' ), |
| 119 | 121 | $this->getVar( '_InstallUser' ), |
| 120 | 122 | $this->getVar( '_InstallPassword' ), |
| 121 | | - $this->getVar( 'wgDBname' ), |
| | 123 | + $this->getVar( '_InstallUser' ), |
| 122 | 124 | DBO_SYSDBA | DBO_DDLMODE, |
| 123 | 125 | $this->getVar( 'wgDBprefix' ) |
| 124 | 126 | ); |
| — | — | @@ -138,6 +140,42 @@ |
| 139 | 141 | return $status; |
| 140 | 142 | } |
| 141 | 143 | |
| | 144 | + /** |
| | 145 | + * Cache the two different types of connection which can be returned by |
| | 146 | + * openConnection(). |
| | 147 | + * |
| | 148 | + * $this->db will be set to the last used connection object. |
| | 149 | + * |
| | 150 | + * FIXME: openConnection() should not be doing two different things. |
| | 151 | + */ |
| | 152 | + public function getConnection() { |
| | 153 | + // Check cache |
| | 154 | + if ( $this->useSysDBA ) { |
| | 155 | + $conn = $this->sysConn; |
| | 156 | + } else { |
| | 157 | + $conn = $this->userConn; |
| | 158 | + } |
| | 159 | + if ( $conn !== null ) { |
| | 160 | + $this->db = $conn; |
| | 161 | + return Status::newGood( $conn ); |
| | 162 | + } |
| | 163 | + |
| | 164 | + // Open a new connection |
| | 165 | + $status = $this->openConnection(); |
| | 166 | + if ( !$status->isOK() ) { |
| | 167 | + return $status; |
| | 168 | + } |
| | 169 | + |
| | 170 | + // Save to the cache |
| | 171 | + if ( $this->useSysDBA ) { |
| | 172 | + $this->sysConn = $status->value; |
| | 173 | + } else { |
| | 174 | + $this->userConn = $status->value; |
| | 175 | + } |
| | 176 | + $this->db = $status->value; |
| | 177 | + return $status; |
| | 178 | + } |
| | 179 | + |
| 142 | 180 | public function needsUpgrade() { |
| 143 | 181 | $tempDBname = $this->getVar( 'wgDBname' ); |
| 144 | 182 | $this->parent->setVar( 'wgDBname', $this->getVar( 'wgDBuser' ) ); |
| — | — | @@ -175,6 +213,8 @@ |
| 176 | 214 | return $status; |
| 177 | 215 | } |
| 178 | 216 | |
| | 217 | + $this->setupSchemaVars(); |
| | 218 | + |
| 179 | 219 | if ( !$this->db->selectDB( $this->getVar( 'wgDBuser' ) ) ) { |
| 180 | 220 | $this->db->setFlag( DBO_DDLMODE ); |
| 181 | 221 | $error = $this->db->sourceFile( "$IP/maintenance/oracle/user.sql" ); |
| — | — | @@ -183,6 +223,7 @@ |
| 184 | 224 | } |
| 185 | 225 | } |
| 186 | 226 | |
| | 227 | + |
| 187 | 228 | return $status; |
| 188 | 229 | } |
| 189 | 230 | |
| — | — | @@ -190,6 +231,8 @@ |
| 191 | 232 | * Overload: after this action field info table has to be rebuilt |
| 192 | 233 | */ |
| 193 | 234 | public function createTables() { |
| | 235 | + $this->setupSchemaVars(); |
| | 236 | + $this->db->selectDB( $this->getVar( 'wgDBuser' ) ); |
| 194 | 237 | $status = parent::createTables(); |
| 195 | 238 | |
| 196 | 239 | $this->db->query( 'BEGIN fill_wiki_info; END;' ); |
| — | — | @@ -198,13 +241,21 @@ |
| 199 | 242 | } |
| 200 | 243 | |
| 201 | 244 | public function getSchemaVars() { |
| 202 | | - /** |
| 203 | | - * The variables $_OracleDefTS, $_OracleTempTS are used by maintenance/oracle/user.sql |
| 204 | | - */ |
| 205 | | - return array( |
| 206 | | - '_OracleDefTS' => $this->getVar( '_OracleDefTS' ), |
| 207 | | - '_OracleTempTS' => $this->getVar( '_OracleTempTS' ), |
| | 245 | + $varNames = array( |
| | 246 | + # These variables are used by maintenance/oracle/user.sql |
| | 247 | + '_OracleDefTS', |
| | 248 | + '_OracleTempTS', |
| | 249 | + 'wgDBuser', |
| | 250 | + 'wgDBpassword', |
| | 251 | + |
| | 252 | + # These are used by tables.sql |
| | 253 | + 'wgDBprefix', |
| 208 | 254 | ); |
| | 255 | + $vars = array(); |
| | 256 | + foreach ( $varNames as $name ) { |
| | 257 | + $vars[$name] = $this->getVar( $name ); |
| | 258 | + } |
| | 259 | + return $vars; |
| 209 | 260 | } |
| 210 | 261 | |
| 211 | 262 | public function getLocalSettings() { |
| Index: trunk/phase3/includes/installer/PostgresInstaller.php |
| — | — | @@ -215,6 +215,7 @@ |
| 216 | 216 | if ( !$status->isOK() ) { |
| 217 | 217 | return $status; |
| 218 | 218 | } |
| | 219 | + $this->setupSchemaVars(); |
| 219 | 220 | $conn = $status->value; |
| 220 | 221 | |
| 221 | 222 | $dbName = $this->getVar( 'wgDBname' ); |