'_InstallUser' => 'postgres',
);
- var $minimumVersion = '8.3';
- var $maxRoleSearchDepth = 5;
+ public $minimumVersion = '8.3';
+ public $maxRoleSearchDepth = 5;
protected $pgConns = array();
}
function getConnectForm() {
- return $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
+ return $this->getTextBox(
+ 'wgDBserver',
+ 'config-db-host',
+ array(),
+ $this->parent->getHelpBox( 'config-db-host-help' )
+ ) .
$this->getTextBox( 'wgDBport', 'config-db-port' ) .
Html::openElement( 'fieldset' ) .
Html::element( 'legend', array(), wfMessage( 'config-db-wiki-settings' )->text() ) .
- $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) .
- $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) .
+ $this->getTextBox(
+ 'wgDBname',
+ 'config-db-name',
+ array(),
+ $this->parent->getHelpBox( 'config-db-name-help' )
+ ) .
+ $this->getTextBox(
+ 'wgDBmwschema',
+ 'config-db-schema',
+ array(),
+ $this->parent->getHelpBox( 'config-db-schema-help' )
+ ) .
Html::closeElement( 'fieldset' ) .
$this->getInstallUserBox();
}
$this->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );
$this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
+
return Status::newGood();
}
if ( $status->isOK() ) {
$this->db = $status->value;
}
+
return $status;
}
} catch ( DBConnectionError $e ) {
$status->fatal( 'config-connection-error', $e->getMessage() );
}
+
return $status;
}
$conn->commit( __METHOD__ );
$this->pgConns[$type] = $conn;
}
+
return $status;
}
$safeRole = $conn->addIdentifierQuotes( $this->getVar( 'wgDBuser' ) );
$conn->query( "SET ROLE $safeRole" );
}
+
return $status;
default:
throw new MWException( "Invalid special connection type: \"$type\"" );
$row = $conn->selectRow( '"pg_catalog"."pg_roles"', '*',
array( 'rolname' => $superuser ), __METHOD__ );
+
return $row;
}
if ( !$perms ) {
return false;
}
+
return $perms->rolsuper === 't' || $perms->rolcreaterole === 't';
}
if ( !$perms ) {
return false;
}
+
return $perms->rolsuper === 't';
}
} else {
$msg = 'config-install-user-missing';
}
+
return Status::newFatal( $msg, $this->getVar( 'wgDBuser' ) );
}
}
}
}
+
return false;
}
$safedb = $conn->addIdentifierQuotes( $dbName );
$conn->query( "CREATE DATABASE $safedb", __METHOD__ );
}
+
return Status::newGood();
}
// Select the new schema in the current connection
$conn->determineCoreSchema( $schema );
+
return Status::newGood();
}
function commitChanges() {
$this->db->commit( __METHOD__ );
+
return Status::newGood();
}
function getLocalSettings() {
$port = $this->getVar( 'wgDBport' );
$schema = $this->getVar( 'wgDBmwschema' );
- return
-"# Postgres specific settings
+
+ return "# Postgres specific settings
\$wgDBport = \"{$port}\";
\$wgDBmwschema = \"{$schema}\";";
}
if ( $conn->tableExists( 'archive' ) ) {
$status->warning( 'config-install-tables-exist' );
$this->enableLB();
+
return $status;
}
if ( !$conn->schemaExists( $schema ) ) {
$status->fatal( 'config-install-pg-schema-not-exist' );
+
return $status;
}
$error = $conn->sourceFile( $conn->getSchemaPath() );
if ( $status->isOk() ) {
$this->enableLB();
}
+
return $status;
}
} else {
return Status::newFatal( 'config-pg-no-plpgsql', $this->getVar( 'wgDBname' ) );
}
+
return Status::newGood();
}
}