MediaWiki master
|
Class for setting up the MediaWiki database using Postgres. More...
Inherits MediaWiki\Installer\DatabaseInstaller.
Public Member Functions | |
canCreateAccounts () | |
canCreateObjectsForWebUser () | |
Returns true if the install user is able to create objects owned by the web user, false otherwise. | |
commitChanges () | |
createManualTables () | |
Create database tables from scratch. | |
createTables () | |
Create database tables from scratch from the automatically generated file. | |
getConnectForm (WebInstaller $webInstaller) | |
getConnection () | |
Connect to the database using the administrative user/password currently defined in the session. | |
getGlobalDefaults () | |
Get a name=>value map of MW configuration globals for the default values. | |
getLocalSettings () | |
Get the DBMS-specific options for LocalSettings.php generation. | |
getName () | |
Return the internal name, e.g. | |
getPgConnection ( $type) | |
Get a special type of connection. | |
getSettingsForm (WebInstaller $webInstaller) | |
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 () | |
Public Member Functions inherited from MediaWiki\Installer\DatabaseInstaller | |
__construct ( $parent) | |
Construct and initialise parent. | |
checkPrerequisites () | |
Checks for installation prerequisites other than those checked by isCompiled() | |
createExtensionTables () | |
Create the tables for each extension the user enabled. | |
doUpgrade () | |
Perform database upgrades. | |
enableLB () | |
Set up LBFactory so that getPrimaryDatabase() etc. | |
getGeneratedSchemaPath ( $db) | |
Return a path to the DBMS-specific automatically generated schema file. | |
getGlobalNames () | |
Get an array of MW configuration globals that will be configured by this class. | |
getInternalDefaults () | |
Get a name=>value map of internal variables used during installation. | |
getReadableName () | |
Get the internationalised name for this DBMS. | |
getSchemaPath ( $db) | |
Return a path to the DBMS-specific schema file, otherwise default to tables.sql. | |
getSchemaVars () | |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files. | |
getUpdateKeysPath ( $db) | |
Return a path to the DBMS-specific update key file, otherwise default to update-keys.sql. | |
getVar ( $var, $default=null) | |
Get a variable, taking local defaults into account. | |
insertUpdateKeys () | |
Insert update keys into table to prevent running unneeded updates. | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. | |
outputHandler ( $string) | |
populateInterwikiTable () | |
Common function for databases that don't understand the MySQLish syntax of interwiki.list. | |
setupSchemaVars () | |
Set appropriate schema variables in the current database connection. | |
setVar ( $name, $value) | |
Convenience alias for $this->parent->setVar() | |
Public Attributes | |
$maxRoleSearchDepth = 5 | |
Public Attributes inherited from MediaWiki\Installer\DatabaseInstaller | |
Database | $db = null |
The database connection. | |
Installer | $parent |
The Installer object. | |
Static Public Attributes | |
static | $minimumVersion = '10' |
Static Public Attributes inherited from MediaWiki\Installer\DatabaseInstaller | |
static string | $minimumVersion |
Set by subclasses. | |
Protected Member Functions | |
getInstallUserPermissions () | |
isRoleMember ( $conn, $targetMember, $group, $maxDepth) | |
Recursive helper for canCreateObjectsForWebUser(). | |
isSuperUser () | |
openConnectionWithParams ( $user, $password, $dbName, $schema) | |
Open a PG connection with given parameters. | |
openPgConnection ( $type) | |
Get a connection of a specific PostgreSQL-specific type. | |
Protected Member Functions inherited from MediaWiki\Installer\DatabaseInstaller | |
selectDatabase (Database $conn, string $database) | |
Protected Attributes | |
$globalNames | |
$internalDefaults | |
DatabasePostgres[] | $pgConns = [] |
Protected Attributes inherited from MediaWiki\Installer\DatabaseInstaller | |
array | $globalNames = [] |
Array of MW configuration globals this class uses. | |
array | $internalDefaults = [] |
Internal variables for installation. | |
Static Protected Attributes | |
static | $notMinimumVersionMessage = 'config-postgres-old' |
Static Protected Attributes inherited from MediaWiki\Installer\DatabaseInstaller | |
static string | $notMinimumVersionMessage |
Set by subclasses. | |
Additional Inherited Members | |
Static Public Member Functions inherited from MediaWiki\Installer\DatabaseInstaller | |
static | meetsMinimumRequirement (IDatabase $conn) |
Whether the provided version meets the necessary requirements for this type. | |
Static Protected Member Functions inherited from MediaWiki\Installer\DatabaseInstaller | |
static | checkExtension ( $name) |
Convenience function. | |
Class for setting up the MediaWiki database using Postgres.
Definition at line 41 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::canCreateAccounts | ( | ) |
Definition at line 244 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::canCreateObjectsForWebUser | ( | ) |
Returns true if the install user is able to create objects owned by the web user, false otherwise.
Definition at line 259 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::commitChanges | ( | ) |
Definition at line 384 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::createManualTables | ( | ) |
Create database tables from scratch.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 497 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::createTables | ( | ) |
Create database tables from scratch from the automatically generated file.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 449 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::getConnectForm | ( | WebInstaller | $webInstaller | ) |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 74 of file PostgresInstaller.php.
MediaWiki\Installer\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 MediaWiki\Installer\DatabaseInstaller.
Definition at line 82 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::getGlobalDefaults | ( | ) |
Get a name=>value map of MW configuration globals for the default values.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 502 of file PostgresInstaller.php.
|
protected |
Definition at line 230 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::getLocalSettings | ( | ) |
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 429 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::getName | ( | ) |
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 66 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::getPgConnection | ( | $type | ) |
Get a special type of connection.
string | $type | See openPgConnection() for details. |
Definition at line 128 of file PostgresInstaller.php.
References DBO_TRX.
MediaWiki\Installer\PostgresInstaller::getSettingsForm | ( | WebInstaller | $webInstaller | ) |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 78 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::isCompiled | ( | ) |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 70 of file PostgresInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\checkExtension().
|
protected |
Recursive helper for canCreateObjectsForWebUser().
Database | $conn | |
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 285 of file PostgresInstaller.php.
|
protected |
Definition at line 249 of file PostgresInstaller.php.
MediaWiki\Installer\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 MediaWiki\Installer\DatabaseInstaller.
Definition at line 91 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::openConnectionToAnyDB | ( | $user, | |
$password ) |
Definition at line 193 of file PostgresInstaller.php.
References StatusValue\fatal().
|
protected |
Open a PG connection with given parameters.
string | $user | User name |
string | $password | |
string | $dbName | Database name |
string | $schema | Database schema |
Definition at line 103 of file PostgresInstaller.php.
References MediaWiki\Installer\ConnectionStatus\setDB().
|
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:
|
Definition at line 167 of file PostgresInstaller.php.
MediaWiki\Installer\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 MediaWiki\Installer\DatabaseInstaller.
Definition at line 311 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 440 of file PostgresInstaller.php.
References $wgDBpassword, and $wgDBuser.
MediaWiki\Installer\PostgresInstaller::setupDatabase | ( | ) |
Create the database and return a Status object indicating success or failure.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 337 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::setupPLpgSQL | ( | ) |
Definition at line 510 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::setupSchema | ( | ) |
Definition at line 356 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::setupUser | ( | ) |
Definition at line 390 of file PostgresInstaller.php.
References Wikimedia\Rdbms\Database\addIdentifierQuotes().
|
protected |
Definition at line 43 of file PostgresInstaller.php.
|
protected |
Definition at line 53 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::$maxRoleSearchDepth = 5 |
Definition at line 59 of file PostgresInstaller.php.
|
static |
Definition at line 57 of file PostgresInstaller.php.
|
staticprotected |
Definition at line 58 of file PostgresInstaller.php.
|
protected |
Definition at line 64 of file PostgresInstaller.php.