MediaWiki
REL1_21
|
Class for setting up the MediaWiki database using Postgres. More...
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 | |
Array of MW configuration globals this class uses. | |
$internalDefaults | |
Internal variables for installation. | |
$pgConns = array() |
Class for setting up the MediaWiki database using Postgres.
Definition at line 30 of file PostgresInstaller.php.
PostgresInstaller::canCreateAccounts | ( | ) | [protected] |
Definition at line 273 of file PostgresInstaller.php.
References getInstallUserPermissions().
Referenced by getSettingsForm(), and submitSettingsForm().
PostgresInstaller::canCreateObjectsForWebUser | ( | ) | [protected] |
Returns true if the install user is able to create objects owned by the web user, false otherwise.
Definition at line 365 of file PostgresInstaller.php.
References array(), getPgConnection(), DatabaseInstaller\getVar(), isRoleMember(), and isSuperUser().
Referenced by submitSettingsForm().
Definition at line 486 of file PostgresInstaller.php.
References Status\newGood().
Create database tables from scratch.
Reimplemented from DatabaseInstaller.
Definition at line 547 of file PostgresInstaller.php.
References $error, DatabaseInstaller\enableLB(), getConnection(), and DatabaseInstaller\getVar().
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 58 of file PostgresInstaller.php.
References array(), Html\closeElement(), Html\element(), DatabaseInstaller\getInstallUserBox(), DatabaseInstaller\getTextBox(), Html\openElement(), text, and wfMessage().
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.
Reimplemented from DatabaseInstaller.
Definition at line 114 of file PostgresInstaller.php.
References getPgConnection().
Referenced by createTables().
PostgresInstaller::getInstallUserPermissions | ( | ) | [protected] |
Definition at line 257 of file PostgresInstaller.php.
References array(), getPgConnection(), and DatabaseInstaller\getVar().
Referenced by canCreateAccounts(), and isSuperUser().
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented from DatabaseInstaller.
Definition at line 529 of file PostgresInstaller.php.
References DatabaseInstaller\getVar().
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented from DatabaseInstaller.
Definition at line 50 of file PostgresInstaller.php.
PostgresInstaller::getPgConnection | ( | $ | type | ) | [protected] |
Get a special type of connection.
string | $type | See openPgConnection() for details. |
Definition at line 153 of file PostgresInstaller.php.
References Status\newGood(), and openPgConnection().
Referenced by canCreateObjectsForWebUser(), getConnection(), getInstallUserPermissions(), setupDatabase(), setupPLpgSQL(), setupSchema(), setupUser(), submitConnectForm(), and submitSettingsForm().
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 289 of file PostgresInstaller.php.
References $s, canCreateAccounts(), and DatabaseInstaller\getWebUserBox().
Reimplemented from DatabaseInstaller.
Definition at line 54 of file PostgresInstaller.php.
References DatabaseInstaller\checkExtension().
PostgresInstaller::isRoleMember | ( | $ | conn, |
$ | targetMember, | ||
$ | group, | ||
$ | maxDepth | ||
) | [protected] |
Recursive helper for canCreateObjectsForWebUser().
$conn | DatabaseBase object | |
int | $targetMember | Role ID of the member to look for |
int | $group | Role ID of the group to look for |
int | $maxDepth | Maximum recursive search depth |
Definition at line 391 of file PostgresInstaller.php.
References $res, array(), and as.
Referenced by canCreateObjectsForWebUser().
PostgresInstaller::isSuperUser | ( | ) | [protected] |
Definition at line 281 of file PostgresInstaller.php.
References getInstallUserPermissions().
Referenced by canCreateObjectsForWebUser(), and setupUser().
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.
Reimplemented from DatabaseInstaller.
Definition at line 122 of file PostgresInstaller.php.
References openPgConnection().
PostgresInstaller::openConnectionToAnyDB | ( | $ | user, |
$ | password | ||
) |
Definition at line 224 of file PostgresInstaller.php.
References DatabaseInstaller\$db, $error, $password, $user, array(), as, DatabaseInstaller\getVar(), and Status\newGood().
Referenced by openPgConnection(), and submitSettingsForm().
PostgresInstaller::openConnectionWithParams | ( | $ | user, |
$ | password, | ||
$ | dbName | ||
) | [protected] |
Open a PG connection with given parameters.
string | $user | User name |
string | $password | Password |
string | $dbName | Database name |
Definition at line 133 of file PostgresInstaller.php.
References DatabaseInstaller\$db, $password, $user, DatabaseInstaller\getVar(), and Status\newGood().
Referenced by openPgConnection().
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.
string | $type | The type of connection to get:
|
MWException |
Definition at line 197 of file PostgresInstaller.php.
References DatabaseInstaller\getVar(), openConnectionToAnyDB(), and openConnectionWithParams().
Referenced by getPgConnection(), and openConnection().
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 416 of file PostgresInstaller.php.
References array(), and DatabaseInstaller\getVar().
Allow DB installers a chance to make checks before upgrade.
Reimplemented from DatabaseInstaller.
Definition at line 538 of file PostgresInstaller.php.
References DatabaseInstaller\getVar(), and global.
Create the database and return a Status object indicating success or failure.
Reimplemented from DatabaseInstaller.
Definition at line 442 of file PostgresInstaller.php.
References array(), getPgConnection(), DatabaseInstaller\getVar(), and Status\newGood().
Definition at line 587 of file PostgresInstaller.php.
References array(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
Definition at line 460 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
Definition at line 491 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), isSuperUser(), Status\newFatal(), and Status\newGood().
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.
Reimplemented from DatabaseInstaller.
Definition at line 70 of file PostgresInstaller.php.
References array(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), Status\newGood(), DatabaseInstaller\setVar(), DatabaseInstaller\setVarsFromRequest(), and DatabaseInstaller\submitInstallUserBox().
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().
Reimplemented from DatabaseInstaller.
Definition at line 300 of file PostgresInstaller.php.
References canCreateAccounts(), canCreateObjectsForWebUser(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), Status\newGood(), openConnectionToAnyDB(), DatabaseInstaller\setVar(), and DatabaseInstaller\submitWebUserBox().
PostgresInstaller::$globalNames [protected] |
array( 'wgDBserver', 'wgDBport', 'wgDBname', 'wgDBuser', 'wgDBpassword', 'wgDBmwschema', )
Array of MW configuration globals this class uses.
Reimplemented from DatabaseInstaller.
Definition at line 32 of file PostgresInstaller.php.
PostgresInstaller::$internalDefaults [protected] |
array( '_InstallUser' => 'postgres', )
Internal variables for installation.
Reimplemented from DatabaseInstaller.
Definition at line 41 of file PostgresInstaller.php.
PostgresInstaller::$maxRoleSearchDepth = 5 |
Definition at line 46 of file PostgresInstaller.php.
PostgresInstaller::$minimumVersion = '8.3' |
Definition at line 45 of file PostgresInstaller.php.
PostgresInstaller::$pgConns = array() [protected] |
Definition at line 48 of file PostgresInstaller.php.