MediaWiki
1.23.2
|
Class for setting up the MediaWiki database using Postgres. More...
Public Member Functions | |
commitChanges () | |
createTables () | |
Create database tables from scratch. More... | |
getConnectForm () | |
Get HTML for a web form that configures this database. More... | |
getConnection () | |
Connect to the database using the administrative user/password currently defined in the session. More... | |
getLocalSettings () | |
Get the DBMS-specific options for LocalSettings.php generation. More... | |
getName () | |
Return the internal name, e.g. More... | |
getSettingsForm () | |
Get HTML for a web form that retrieves settings used for installation. More... | |
isCompiled () | |
openConnection () | |
Open a connection to the database using the administrative user/password currently defined in the session, without any caching. More... | |
openConnectionToAnyDB ( $user, $password) | |
preInstall () | |
Allow DB installers a chance to make last-minute changes before installation occurs. More... | |
preUpgrade () | |
Allow DB installers a chance to make checks before upgrade. More... | |
setupDatabase () | |
Create the database and return a Status object indicating success or failure. More... | |
setupPLpgSQL () | |
setupSchema () | |
setupUser () | |
submitConnectForm () | |
Set variables based on the request array, assuming it was submitted via the form returned by getConnectForm(). More... | |
submitSettingsForm () | |
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm(). More... | |
Public Member Functions inherited from DatabaseInstaller | |
__construct ( $parent) | |
Construct and initialise parent. More... | |
checkPrerequisites () | |
Checks for installation prerequisites other than those checked by isCompiled() More... | |
createExtensionTables () | |
Create the tables for each extension the user enabled. More... | |
doUpgrade () | |
Perform database upgrades. More... | |
enableLB () | |
Set up LBFactory so that wfGetDB() etc. More... | |
getCheckBox ( $var, $label, $attribs=array(), $helpData="") | |
Get a labelled checkbox to configure a local boolean variable. More... | |
getGlobalDefaults () | |
Get a name=>value map of MW configuration globals that overrides. More... | |
getGlobalNames () | |
Get an array of MW configuration globals that will be configured by this class. More... | |
getInstallUserBox () | |
Get a standard install-user fieldset. More... | |
getInternalDefaults () | |
Get a name=>value map of internal variables used during installation. More... | |
getPasswordBox ( $var, $label, $attribs=array(), $helpData="") | |
Get a labelled password box to configure a local variable. More... | |
getRadioSet ( $params) | |
Get a set of labelled radio buttons. More... | |
getReadableName () | |
Get the internationalised name for this DBMS. More... | |
getSchemaVars () | |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files. More... | |
getTextBox ( $var, $label, $attribs=array(), $helpData="") | |
Get a labelled text box to configure a local variable. More... | |
getVar ( $var, $default=null) | |
Get a variable, taking local defaults into account. More... | |
getWebUserBox ( $noCreateMsg=false) | |
Get a standard web-user fieldset. More... | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. More... | |
outputHandler ( $string) | |
populateInterwikiTable () | |
Common function for databases that don't understand the MySQLish syntax of interwiki.sql. More... | |
setupSchemaVars () | |
Set appropriate schema variables in the current database connection. More... | |
setVar ( $name, $value) | |
Convenience alias for $this->parent->setVar() More... | |
setVarsFromRequest ( $varNames) | |
Convenience function to set variables based on form data. More... | |
submitInstallUserBox () | |
Submit a standard install user fieldset. More... | |
submitWebUserBox () | |
Submit the form from getWebUserBox(). More... | |
Public Attributes | |
$maxRoleSearchDepth = 5 | |
$minimumVersion = '8.3' | |
Public Attributes inherited from DatabaseInstaller | |
DatabaseBase | $db = null |
The database connection. More... | |
WebInstaller | $parent |
The Installer object. More... | |
Protected Member Functions | |
canCreateAccounts () | |
canCreateObjectsForWebUser () | |
Returns true if the install user is able to create objects owned by the web user, false otherwise. More... | |
getInstallUserPermissions () | |
getPgConnection ( $type) | |
Get a special type of connection. More... | |
isRoleMember ( $conn, $targetMember, $group, $maxDepth) | |
Recursive helper for canCreateObjectsForWebUser(). More... | |
isSuperUser () | |
openConnectionWithParams ( $user, $password, $dbName) | |
Open a PG connection with given parameters. More... | |
openPgConnection ( $type) | |
Get a connection of a specific PostgreSQL-specific type. More... | |
Protected Attributes | |
$globalNames | |
$internalDefaults | |
$pgConns = array() | |
Protected Attributes inherited from DatabaseInstaller | |
array | $globalNames = array() |
Array of MW configuration globals this class uses. More... | |
array | $internalDefaults = array() |
Internal variables for installation. More... | |
Additional Inherited Members | |
Static Protected Member Functions inherited from DatabaseInstaller | |
static | checkExtension ( $name) |
Convenience function. More... | |
Class for setting up the MediaWiki database using Postgres.
Definition at line 30 of file PostgresInstaller.php.
|
protected |
Definition at line 302 of file PostgresInstaller.php.
References getInstallUserPermissions().
Referenced by getSettingsForm(), and submitSettingsForm().
|
protected |
Returns true if the install user is able to create objects owned by the web user, false otherwise.
Definition at line 397 of file PostgresInstaller.php.
References array(), getPgConnection(), DatabaseInstaller\getVar(), isRoleMember(), and isSuperUser().
Referenced by submitSettingsForm().
PostgresInstaller::commitChanges | ( | ) |
Definition at line 521 of file PostgresInstaller.php.
References Status\newGood().
PostgresInstaller::createTables | ( | ) |
Create database tables from scratch.
Reimplemented from DatabaseInstaller.
Definition at line 583 of file PostgresInstaller.php.
References $error, DatabaseInstaller\enableLB(), getConnection(), and DatabaseInstaller\getVar().
PostgresInstaller::getConnectForm | ( | ) |
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().
PostgresInstaller::getConnection | ( | ) |
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 137 of file PostgresInstaller.php.
References getPgConnection().
Referenced by createTables().
|
protected |
Definition at line 285 of file PostgresInstaller.php.
References array(), getPgConnection(), and DatabaseInstaller\getVar().
Referenced by canCreateAccounts(), and isSuperUser().
PostgresInstaller::getLocalSettings | ( | ) |
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented from DatabaseInstaller.
Definition at line 565 of file PostgresInstaller.php.
References DatabaseInstaller\getVar().
PostgresInstaller::getName | ( | ) |
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented from DatabaseInstaller.
Definition at line 50 of file PostgresInstaller.php.
|
protected |
Get a special type of connection.
string | $type | See openPgConnection() for details. |
Definition at line 179 of file PostgresInstaller.php.
References $type, DBO_TRX, Status\newGood(), and openPgConnection().
Referenced by canCreateObjectsForWebUser(), getConnection(), getInstallUserPermissions(), setupDatabase(), setupPLpgSQL(), setupSchema(), setupUser(), submitConnectForm(), and submitSettingsForm().
PostgresInstaller::getSettingsForm | ( | ) |
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 320 of file PostgresInstaller.php.
References $s, canCreateAccounts(), and DatabaseInstaller\getWebUserBox().
PostgresInstaller::isCompiled | ( | ) |
Reimplemented from DatabaseInstaller.
Definition at line 54 of file PostgresInstaller.php.
References DatabaseInstaller\checkExtension().
|
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 423 of file PostgresInstaller.php.
References $res, array(), and as.
Referenced by canCreateObjectsForWebUser().
|
protected |
Definition at line 311 of file PostgresInstaller.php.
References getInstallUserPermissions().
Referenced by canCreateObjectsForWebUser(), and setupUser().
PostgresInstaller::openConnection | ( | ) |
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 146 of file PostgresInstaller.php.
References openPgConnection().
PostgresInstaller::openConnectionToAnyDB | ( | $user, | |
$password | |||
) |
Definition at line 252 of file PostgresInstaller.php.
References DatabaseInstaller\$db, $error, $password, $user, array(), as, DatabaseInstaller\getVar(), and Status\newGood().
Referenced by openPgConnection(), and submitSettingsForm().
|
protected |
Open a PG connection with given parameters.
string | $user | User name |
string | $password | Password |
string | $dbName | Database name |
Definition at line 157 of file PostgresInstaller.php.
References DatabaseInstaller\$db, $e, $password, $user, DatabaseInstaller\getVar(), and Status\newGood().
Referenced by openPgConnection().
|
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 224 of file PostgresInstaller.php.
References $type, DatabaseInstaller\getVar(), openConnectionToAnyDB(), and openConnectionWithParams().
Referenced by getPgConnection(), and openConnection().
PostgresInstaller::preInstall | ( | ) |
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 449 of file PostgresInstaller.php.
References array(), and DatabaseInstaller\getVar().
PostgresInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Reimplemented from DatabaseInstaller.
Definition at line 574 of file PostgresInstaller.php.
References DatabaseInstaller\getVar(), and global.
PostgresInstaller::setupDatabase | ( | ) |
Create the database and return a Status object indicating success or failure.
Reimplemented from DatabaseInstaller.
Definition at line 475 of file PostgresInstaller.php.
References array(), getPgConnection(), DatabaseInstaller\getVar(), and Status\newGood().
PostgresInstaller::setupPLpgSQL | ( | ) |
Definition at line 626 of file PostgresInstaller.php.
References $e, array(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
PostgresInstaller::setupSchema | ( | ) |
Definition at line 494 of file PostgresInstaller.php.
References $e, getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), and Status\newGood().
PostgresInstaller::setupUser | ( | ) |
Definition at line 527 of file PostgresInstaller.php.
References $e, getPgConnection(), DatabaseInstaller\getVar(), isSuperUser(), Status\newFatal(), and Status\newGood().
PostgresInstaller::submitConnectForm | ( | ) |
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 84 of file PostgresInstaller.php.
References $version, array(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), Status\newGood(), DatabaseInstaller\setVar(), DatabaseInstaller\setVarsFromRequest(), and DatabaseInstaller\submitInstallUserBox().
PostgresInstaller::submitSettingsForm | ( | ) |
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().
Reimplemented from DatabaseInstaller.
Definition at line 331 of file PostgresInstaller.php.
References canCreateAccounts(), canCreateObjectsForWebUser(), getPgConnection(), DatabaseInstaller\getVar(), Status\newFatal(), Status\newGood(), openConnectionToAnyDB(), DatabaseInstaller\setVar(), and DatabaseInstaller\submitWebUserBox().
|
protected |
Definition at line 32 of file PostgresInstaller.php.
|
protected |
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.
|
protected |
Definition at line 48 of file PostgresInstaller.php.