'config-install-step-failed' => 'failed',
'config-install-extensions' => 'Including extensions',
'config-install-database' => 'Setting up database',
+ 'config-install-pg-schema-not-exist' => 'PostgreSQL schema does not exist',
'config-install-pg-schema-failed' => 'Tables creation failed.
Make sure that the user "$1" can write to the schema "$2".',
'config-install-pg-commit' => 'Committing changes',
$conn->query( "CREATE DATABASE $safedb OWNER $safeuser", __METHOD__ );
- $conn = new DatabasePostgres(
- $this->getVar( 'wgDBserver' ),
- $this->getVar( 'wgDBuser' ),
- $this->getVar( 'wgDBpassword' ),
- $dbName,
- false,
- 0,
- $this->getVar( 'wgDBprefix' )
- );
+ $this->useAdmin = false;
+ $status = $this->getConnection();
+ if ( !$status->isOK() ) {
+ return $status;
+ }
+ $conn = $status->value;
$result = $conn->schemaExists( $schema );
if( !$result ) {
"pg_catalog.oidvectortypes(p.proargtypes)||') TO $safeuser;'\n" .
"FROM pg_catalog.pg_proc p, pg_catalog.pg_namespace n\n" .
"WHERE p.pronamespace = n.oid AND n.nspname = $safeschema2";
+ $conn->query( "SET search_path = $safeschema" );
$res = $conn->query( $SQL );
}
}
}
public function createTables() {
+ $schema = $this->getVar( 'wgDBmwschema' );
+ $user = $this->getVar( 'wgDBuser' );
+
$this->db = null;
$this->useAdmin = false;
$status = $this->getConnection();
$this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files
$this->db->begin( __METHOD__ );
+
+ if( !$this->db->schemaExists( $schema ) ) {
+ $status->error( 'config-install-pg-schema-not-exist' );
+ return $status;
+ }
+ $safeschema = $this->db->addIdentifierQuotes( $schema );
+ $this->db->query( "SET search_path = $safeschema" );
$error = $this->db->sourceFile( $this->db->getSchema() );
if( $error !== true ) {
$this->db->reportQueryError( $error, 0, '', __METHOD__ );