Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -195,7 +195,6 @@ |
196 | 196 | |
197 | 197 | global $wgDBmwschema; |
198 | 198 | if ( isset( $wgDBmwschema ) |
199 | | - && $wgDBmwschema !== 'mediawiki' |
200 | 199 | && preg_match( '/^\w+$/', $wgDBmwschema ) |
201 | 200 | ) { |
202 | 201 | $safeschema = $this->addIdentifierQuotes( $wgDBmwschema ); |
Index: trunk/phase3/includes/installer/Installer.i18n.php |
— | — | @@ -444,6 +444,7 @@ |
445 | 445 | 'config-install-step-failed' => 'failed', |
446 | 446 | 'config-install-extensions' => 'Including extensions', |
447 | 447 | 'config-install-database' => 'Setting up database', |
| 448 | + 'config-install-pg-schema-not-exist' => 'PostgreSQL schema does not exist', |
448 | 449 | 'config-install-pg-schema-failed' => 'Tables creation failed. |
449 | 450 | Make sure that the user "$1" can write to the schema "$2".', |
450 | 451 | 'config-install-pg-commit' => 'Committing changes', |
Index: trunk/phase3/includes/installer/PostgresInstaller.php |
— | — | @@ -226,15 +226,12 @@ |
227 | 227 | |
228 | 228 | $conn->query( "CREATE DATABASE $safedb OWNER $safeuser", __METHOD__ ); |
229 | 229 | |
230 | | - $conn = new DatabasePostgres( |
231 | | - $this->getVar( 'wgDBserver' ), |
232 | | - $this->getVar( 'wgDBuser' ), |
233 | | - $this->getVar( 'wgDBpassword' ), |
234 | | - $dbName, |
235 | | - false, |
236 | | - 0, |
237 | | - $this->getVar( 'wgDBprefix' ) |
238 | | - ); |
| 230 | + $this->useAdmin = false; |
| 231 | + $status = $this->getConnection(); |
| 232 | + if ( !$status->isOK() ) { |
| 233 | + return $status; |
| 234 | + } |
| 235 | + $conn = $status->value; |
239 | 236 | |
240 | 237 | $result = $conn->schemaExists( $schema ); |
241 | 238 | if( !$result ) { |
— | — | @@ -253,6 +250,7 @@ |
254 | 251 | "pg_catalog.oidvectortypes(p.proargtypes)||') TO $safeuser;'\n" . |
255 | 252 | "FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n\n" . |
256 | 253 | "WHERE p.pronamespace = n.oid AND n.nspname = $safeschema2"; |
| 254 | + $conn->query( "SET search_path = $safeschema" ); |
257 | 255 | $res = $conn->query( $SQL ); |
258 | 256 | } |
259 | 257 | } |
— | — | @@ -316,6 +314,9 @@ |
317 | 315 | } |
318 | 316 | |
319 | 317 | public function createTables() { |
| 318 | + $schema = $this->getVar( 'wgDBmwschema' ); |
| 319 | + $user = $this->getVar( 'wgDBuser' ); |
| 320 | + |
320 | 321 | $this->db = null; |
321 | 322 | $this->useAdmin = false; |
322 | 323 | $status = $this->getConnection(); |
— | — | @@ -332,6 +333,13 @@ |
333 | 334 | $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files |
334 | 335 | $this->db->begin( __METHOD__ ); |
335 | 336 | |
| 337 | + |
| 338 | + if( !$this->db->schemaExists( $schema ) ) { |
| 339 | + $status->error( 'config-install-pg-schema-not-exist' ); |
| 340 | + return $status; |
| 341 | + } |
| 342 | + $safeschema = $this->db->addIdentifierQuotes( $schema ); |
| 343 | + $this->db->query( "SET search_path = $safeschema" ); |
336 | 344 | $error = $this->db->sourceFile( $this->db->getSchema() ); |
337 | 345 | if( $error !== true ) { |
338 | 346 | $this->db->reportQueryError( $error, 0, '', __METHOD__ ); |