MediaWiki
REL1_20
|
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 272 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 364 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), isRoleMember(), and isSuperUser().
Referenced by submitSettingsForm().
Definition at line 485 of file PostgresInstaller.php.
References Status\newGood().
Create database tables from scratch.
Reimplemented from DatabaseInstaller.
Definition at line 546 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 58 of file PostgresInstaller.php.
References Html\closeElement(), Html\element(), DatabaseInstaller\getInstallUserBox(), DatabaseInstaller\getTextBox(), Html\openElement(), 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 256 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 528 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.
$type | string 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 288 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 |
$targetMember | int Role ID of the member to look for |
$group | int Role ID of the group to look for |
$maxDepth | int Maximum recursive search depth |
Definition at line 390 of file PostgresInstaller.php.
References $res.
Referenced by canCreateObjectsForWebUser().
PostgresInstaller::isSuperUser | ( | ) | [protected] |
Definition at line 280 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 223 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 133 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 | string The type of connection to get:
|
Definition at line 196 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 415 of file PostgresInstaller.php.
References DatabaseInstaller\getVar().
Allow DB installers a chance to make checks before upgrade.
Reimplemented from DatabaseInstaller.
Definition at line 537 of file PostgresInstaller.php.
References DatabaseInstaller\getVar().
Create the database and return a Status object indicating success or failure.
Reimplemented from DatabaseInstaller.
Definition at line 441 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), and Status\newGood().
Definition at line 586 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
Definition at line 459 of file PostgresInstaller.php.
References getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
Definition at line 490 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 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 299 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.