MediaWiki  REL1_19
PostgresInstaller Class Reference

Class for setting up the MediaWiki database using Postgres. More...

Inheritance diagram for PostgresInstaller:
Collaboration diagram for PostgresInstaller:

List of all members.

Public Member Functions

 commitChanges ()
 createTables ()
 Create database tables from scratch.
 getConnectForm ()
 Get HTML for a web form that configures this database.
 getConnection ()
 Connect to the database using the administrative user/password currently defined in the session.
 getLocalSettings ()
 Get the DBMS-specific options for LocalSettings.php generation.
 getName ()
 Return the internal name, e.g.
 getSettingsForm ()
 Get HTML for a web form that retrieves settings used for installation.
 isCompiled ()
 openConnection ()
 Open a connection to the database using the administrative user/password currently defined in the session, without any caching.
 openConnectionToAnyDB ($user, $password)
 preInstall ()
 Allow DB installers a chance to make last-minute changes before installation occurs.
 preUpgrade ()
 Allow DB installers a chance to make checks before upgrade.
 setupDatabase ()
 Create the database and return a Status object indicating success or failure.
 setupPLpgSQL ()
 setupSchema ()
 setupUser ()
 submitConnectForm ()
 Set variables based on the request array, assuming it was submitted via the form returned by getConnectForm().
 submitSettingsForm ()
 Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().

Public Attributes

 $maxRoleSearchDepth = 5
 $minimumVersion = '8.3'

Protected Member Functions

 canCreateAccounts ()
 canCreateObjectsForWebUser ()
 Returns true if the install user is able to create objects owned by the web user, false otherwise.
 getInstallUserPermissions ()
 getPgConnection ($type)
 Get a special type of connection.
 isRoleMember ($conn, $targetMember, $group, $maxDepth)
 Recursive helper for canCreateObjectsForWebUser().
 isSuperUser ()
 openConnectionWithParams ($user, $password, $dbName)
 Open a PG connection with given parameters.
 openPgConnection ($type)
 Get a connection of a specific PostgreSQL-specific type.

Protected Attributes

 $globalNames
 $internalDefaults
 $pgConns = array()

Detailed Description

Class for setting up the MediaWiki database using Postgres.

Since:
1.17

Definition at line 15 of file PostgresInstaller.php.


Member Function Documentation

Definition at line 257 of file PostgresInstaller.php.

References getInstallUserPermissions().

Referenced by getSettingsForm(), and submitSettingsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

Returns true if the install user is able to create objects owned by the web user, false otherwise.

Definition at line 348 of file PostgresInstaller.php.

References getPgConnection(), DatabaseInstaller\getVar(), isRoleMember(), and isSuperUser().

Referenced by submitSettingsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 478 of file PostgresInstaller.php.

References Status\newGood().

Here is the call graph for this function:

Create database tables from scratch.

Returns:
Status

Reimplemented from DatabaseInstaller.

Definition at line 541 of file PostgresInstaller.php.

References DatabaseInstaller\enableLB(), getConnection(), and DatabaseInstaller\getVar().

Here is the call graph for this function:

Get HTML for a web form that configures this database.

Configuration at this time should be the minimum needed to connect and test whether install or upgrade is required.

If this is called, $this->parent can be assumed to be a WebInstaller.

Reimplemented from DatabaseInstaller.

Definition at line 43 of file PostgresInstaller.php.

References Html\closeElement(), Html\element(), DatabaseInstaller\getInstallUserBox(), DatabaseInstaller\getTextBox(), Html\openElement(), and wfMsg().

Here is the call graph for this function:

Connect to the database using the administrative user/password currently defined in the session.

Returns a status object. On success, the status object will contain a Database object in its value member.

This will return a cached connection if one is available.

Returns:
Status

Reimplemented from DatabaseInstaller.

Definition at line 99 of file PostgresInstaller.php.

References getPgConnection().

Referenced by createTables().

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 241 of file PostgresInstaller.php.

References getPgConnection(), and DatabaseInstaller\getVar().

Referenced by canCreateAccounts(), and isSuperUser().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the DBMS-specific options for LocalSettings.php generation.

Returns:
String

Reimplemented from DatabaseInstaller.

Definition at line 523 of file PostgresInstaller.php.

References DatabaseInstaller\getVar().

Here is the call graph for this function:

Return the internal name, e.g.

'mysql', or 'sqlite'.

Reimplemented from DatabaseInstaller.

Definition at line 35 of file PostgresInstaller.php.

PostgresInstaller::getPgConnection ( type) [protected]

Get a special type of connection.

Parameters:
$typestring See openPgConnection() for details.
Returns:
Status

Definition at line 138 of file PostgresInstaller.php.

References Status\newGood(), and openPgConnection().

Referenced by canCreateObjectsForWebUser(), getConnection(), getInstallUserPermissions(), setupDatabase(), setupPLpgSQL(), setupSchema(), setupUser(), submitConnectForm(), and submitSettingsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

Get HTML for a web form that retrieves settings used for installation.

$this->parent can be assumed to be a WebInstaller. If the DB type has no settings beyond those already configured with getConnectForm(), this should return false.

Reimplemented from DatabaseInstaller.

Definition at line 273 of file PostgresInstaller.php.

References canCreateAccounts(), and DatabaseInstaller\getWebUserBox().

Here is the call graph for this function:

Returns:
true if the client library is compiled in.

Reimplemented from DatabaseInstaller.

Definition at line 39 of file PostgresInstaller.php.

References DatabaseInstaller\checkExtension().

Here is the call graph for this function:

PostgresInstaller::isRoleMember ( conn,
targetMember,
group,
maxDepth 
) [protected]

Recursive helper for canCreateObjectsForWebUser().

Parameters:
$connDatabase object
$targetMemberRole ID of the member to look for
$groupRole ID of the group to look for
$maxDepthMaximum recursive search depth

Definition at line 373 of file PostgresInstaller.php.

References $res.

Referenced by canCreateObjectsForWebUser().

Here is the caller graph for this function:

Definition at line 265 of file PostgresInstaller.php.

References getInstallUserPermissions().

Referenced by canCreateObjectsForWebUser(), and setupUser().

Here is the call graph for this function:

Here is the caller graph for this function:

Open a connection to the database using the administrative user/password currently defined in the session, without any caching.

Returns a status object. On success, the status object will contain a Database object in its value member.

Returns:
Status

Reimplemented from DatabaseInstaller.

Definition at line 107 of file PostgresInstaller.php.

References openPgConnection().

Here is the call graph for this function:

PostgresInstaller::openConnectionToAnyDB ( user,
password 
)

Definition at line 208 of file PostgresInstaller.php.

References DatabaseInstaller\$db, $user, DatabaseInstaller\getVar(), and Status\newGood().

Referenced by openPgConnection(), and submitSettingsForm().

Here is the call graph for this function:

Here is the caller graph for this function:

PostgresInstaller::openConnectionWithParams ( user,
password,
dbName 
) [protected]

Open a PG connection with given parameters.

Parameters:
$userUser name
$passwordPassword
$dbNameDatabase name
Returns:
Status

Definition at line 118 of file PostgresInstaller.php.

References DatabaseInstaller\$db, $user, DatabaseInstaller\getVar(), and Status\newGood().

Referenced by openPgConnection().

Here is the call graph for this function:

Here is the caller graph for this function:

PostgresInstaller::openPgConnection ( type) [protected]

Get a connection of a specific PostgreSQL-specific type.

Connections of a given type are cached.

PostgreSQL lacks cross-database operations, so after the new database is created, you need to make a separate connection to connect to that database and add tables to it.

New tables are owned by the user that creates them, and MediaWiki's PostgreSQL support has always assumed that the table owner will be $wgDBuser. So before we create new tables, we either need to either connect as the other user or to execute a SET ROLE command. Using a separate connection for this allows us to avoid accidental cross-module dependencies.

Parameters:
$typeThe type of connection to get:
  • create-db: A connection for creating DBs, suitable for pre- installation.
  • create-schema: A connection to the new DB, for creating schemas and other similar objects in the new DB.
  • create-tables: A connection with a role suitable for creating tables.
Returns:
A Status object. On success, a connection object will be in the value member.

Definition at line 181 of file PostgresInstaller.php.

References DatabaseInstaller\getVar(), openConnectionToAnyDB(), and openConnectionWithParams().

Referenced by getPgConnection(), and openConnection().

Here is the call graph for this function:

Here is the caller graph for this function:

Allow DB installers a chance to make last-minute changes before installation occurs.

This happens before setupDatabase() or createTables() is called, but long after the constructor. Helpful for things like modifying setup steps :)

Reimplemented from DatabaseInstaller.

Definition at line 398 of file PostgresInstaller.php.

References DatabaseInstaller\getVar().

Here is the call graph for this function:

Allow DB installers a chance to make checks before upgrade.

Reimplemented from DatabaseInstaller.

Definition at line 532 of file PostgresInstaller.php.

References $wgDBpassword, $wgDBuser, and DatabaseInstaller\getVar().

Here is the call graph for this function:

Create the database and return a Status object indicating success or failure.

Returns:
Status

Reimplemented from DatabaseInstaller.

Definition at line 424 of file PostgresInstaller.php.

References getPgConnection(), DatabaseInstaller\getVar(), and Status\newGood().

Here is the call graph for this function:

Definition at line 581 of file PostgresInstaller.php.

References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().

Here is the call graph for this function:

Definition at line 446 of file PostgresInstaller.php.

References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().

Here is the call graph for this function:

Definition at line 483 of file PostgresInstaller.php.

References getPgConnection(), DatabaseInstaller\getVar(), isSuperUser(), Status\newFatal(), and Status\newGood().

Here is the call graph for this function:

Set variables based on the request array, assuming it was submitted via the form returned by getConnectForm().

Validate the connection settings by attempting to connect with them.

If this is called, $this->parent can be assumed to be a WebInstaller.

Returns:
Status

Reimplemented from DatabaseInstaller.

Definition at line 55 of file PostgresInstaller.php.

References $version, getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), Status\newGood(), DatabaseInstaller\setVar(), DatabaseInstaller\setVarsFromRequest(), and DatabaseInstaller\submitInstallUserBox().

Here is the call graph for this function:

Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().

Returns:
Status

Reimplemented from DatabaseInstaller.

Definition at line 284 of file PostgresInstaller.php.

References canCreateAccounts(), canCreateObjectsForWebUser(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), Status\newGood(), openConnectionToAnyDB(), DatabaseInstaller\setVar(), and DatabaseInstaller\submitWebUserBox().

Here is the call graph for this function:


Member Data Documentation

PostgresInstaller::$globalNames [protected]
Initial value:
 array(
                'wgDBserver',
                'wgDBport',
                'wgDBname',
                'wgDBuser',
                'wgDBpassword',
                'wgDBmwschema',
        )

Reimplemented from DatabaseInstaller.

Definition at line 17 of file PostgresInstaller.php.

PostgresInstaller::$internalDefaults [protected]
Initial value:
 array(
                '_InstallUser' => 'postgres',
        )

Reimplemented from DatabaseInstaller.

Definition at line 26 of file PostgresInstaller.php.

PostgresInstaller::$maxRoleSearchDepth = 5

Definition at line 31 of file PostgresInstaller.php.

PostgresInstaller::$minimumVersion = '8.3'

Definition at line 30 of file PostgresInstaller.php.

PostgresInstaller::$pgConns = array() [protected]

Definition at line 33 of file PostgresInstaller.php.


The documentation for this class was generated from the following file: