MediaWiki
REL1_19
|
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 | |
$internalDefaults | |
$pgConns = array() |
Class for setting up the MediaWiki database using Postgres.
Definition at line 15 of file PostgresInstaller.php.
PostgresInstaller::canCreateAccounts | ( | ) | [protected] |
Definition at line 257 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 348 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), isRoleMember(), and isSuperUser().
Referenced by submitSettingsForm().
Definition at line 478 of file PostgresInstaller.php.
References Status\newGood().
Create database tables from scratch.
Reimplemented from DatabaseInstaller.
Definition at line 541 of file PostgresInstaller.php.
References 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 43 of file PostgresInstaller.php.
References Html\closeElement(), Html\element(), DatabaseInstaller\getInstallUserBox(), DatabaseInstaller\getTextBox(), Html\openElement(), and wfMsg().
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 99 of file PostgresInstaller.php.
References getPgConnection().
Referenced by createTables().
PostgresInstaller::getInstallUserPermissions | ( | ) | [protected] |
Definition at line 241 of file PostgresInstaller.php.
References getPgConnection(), and DatabaseInstaller\getVar().
Referenced by canCreateAccounts(), and isSuperUser().
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented from DatabaseInstaller.
Definition at line 523 of file PostgresInstaller.php.
References DatabaseInstaller\getVar().
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.
$type | string See openPgConnection() for details. |
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().
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().
Reimplemented from DatabaseInstaller.
Definition at line 39 of file PostgresInstaller.php.
References DatabaseInstaller\checkExtension().
PostgresInstaller::isRoleMember | ( | $ | conn, |
$ | targetMember, | ||
$ | group, | ||
$ | maxDepth | ||
) | [protected] |
Recursive helper for canCreateObjectsForWebUser().
$conn | Database object |
$targetMember | Role ID of the member to look for |
$group | Role ID of the group to look for |
$maxDepth | Maximum recursive search depth |
Definition at line 373 of file PostgresInstaller.php.
References $res.
Referenced by canCreateObjectsForWebUser().
PostgresInstaller::isSuperUser | ( | ) | [protected] |
Definition at line 265 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 107 of file PostgresInstaller.php.
References openPgConnection().
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().
PostgresInstaller::openConnectionWithParams | ( | $ | user, |
$ | password, | ||
$ | dbName | ||
) | [protected] |
Open a PG connection with given parameters.
Definition at line 118 of file PostgresInstaller.php.
References DatabaseInstaller\$db, $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.
$type | The type of connection to get:
|
Definition at line 181 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 398 of file PostgresInstaller.php.
References DatabaseInstaller\getVar().
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().
Create the database and return a Status object indicating success or failure.
Reimplemented from DatabaseInstaller.
Definition at line 424 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), and Status\newGood().
Definition at line 581 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
Definition at line 446 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
Definition at line 483 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 55 of file PostgresInstaller.php.
References $version, 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 284 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', )
Reimplemented from DatabaseInstaller.
Definition at line 17 of file PostgresInstaller.php.
PostgresInstaller::$internalDefaults [protected] |
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.