MediaWiki master
|
Class for setting up the MediaWiki database using Postgres. More...
Inherits MediaWiki\Installer\DatabaseInstaller.
Public Member Functions | |
getConnectForm (WebInstaller $webInstaller) | |
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. | |
getSettingsForm (WebInstaller $webInstaller) | |
isCompiled () | |
openConnectionToAnyDB ( $user, $password) | |
preUpgrade () | |
Allow DB installers a chance to make checks before upgrade. | |
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() | |
definitelyGetConnection (string $type) | |
Get a connection and unwrap it from its Status object, throwing an exception on failure. | |
getConfigVar (string $name) | |
Get a MediaWiki configuration value for the wiki being created. | |
getConnection ( $type=self::CONN_DONT_KNOW) | |
Connect to the database using the administrative user/password currently defined in the session. | |
getDbType () | |
Get the selected database type name. | |
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. | |
getOption (string $name) | |
Get a named installer option. | |
getProvision (string $name) | |
Get the object stored by provide() | |
getReadableName () | |
Get the internationalised name for this DBMS. | |
getSchemaVars () | |
Override this to provide DBMS-specific schema variables, to be substituted into the schema files. | |
getVar ( $var, $default=null) | |
Get a variable, taking local defaults into account. | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. | |
provide (string $name, $value) | |
Store an object to be used by a later task. | |
setVar ( $name, $value) | |
Convenience alias for $this->parent->setVar() | |
Static Public Attributes | |
static | $minimumVersion = '10' |
Static Public Attributes inherited from MediaWiki\Installer\DatabaseInstaller | |
static string | $minimumVersion |
Set by subclasses. | |
Protected Member Functions | |
changeConnTypeFromSchemaToTables (IMaintainableDatabase $conn) | |
Change the type of a connection from CONN_CREATE_SCHEMA to CONN_CREATE_TABLES. | |
openConnection (string $type) | |
Get a connection of a specific PostgreSQL-specific type. | |
openConnectionWithParams ( $user, $password, $dbName, $schema) | |
Open a PG connection with given parameters. | |
Protected Member Functions inherited from MediaWiki\Installer\DatabaseInstaller | |
changeConnType (IMaintainableDatabase $conn, &$storedType, $newType) | |
Change the type of a connection. | |
Protected Attributes | |
$globalNames | |
$internalDefaults | |
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. | |
Public Attributes inherited from MediaWiki\Installer\DatabaseInstaller | |
IMaintainableDatabase | $db = null |
Installer | $parent |
The Installer object. | |
Public Attributes inherited from MediaWiki\Installer\Task\ITaskContext | |
const | CONN_CREATE_DATABASE = 'create-database' |
A connection for creating DBs, suitable for pre-installation. | |
const | CONN_CREATE_SCHEMA = 'create-schema' |
A connection to the new DB, for creating schemas and other similar objects in the new DB. | |
const | CONN_CREATE_TABLES = 'create-tables' |
A connection with a role suitable for creating tables. | |
const | CONN_DONT_KNOW = 'dont-know' |
Legacy default connection 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 39 of file PostgresInstaller.php.
|
protected |
Change the type of a connection from CONN_CREATE_SCHEMA to CONN_CREATE_TABLES.
Postgres overrides this.
IMaintainableDatabase | $conn |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 153 of file PostgresInstaller.php.
References Wikimedia\Rdbms\Platform\ISQLPlatform\addIdentifierQuotes(), and Wikimedia\Rdbms\IDatabase\query().
MediaWiki\Installer\PostgresInstaller::getConnectForm | ( | WebInstaller | $webInstaller | ) |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 70 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 227 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 207 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 62 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::getSettingsForm | ( | WebInstaller | $webInstaller | ) |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 74 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::isCompiled | ( | ) |
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 66 of file PostgresInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\checkExtension().
|
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:
|
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 129 of file PostgresInstaller.php.
MediaWiki\Installer\PostgresInstaller::openConnectionToAnyDB | ( | $user, | |
$password ) |
Definition at line 170 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 86 of file PostgresInstaller.php.
References MediaWiki\Installer\ConnectionStatus\setDB().
MediaWiki\Installer\PostgresInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Reimplemented from MediaWiki\Installer\DatabaseInstaller.
Definition at line 218 of file PostgresInstaller.php.
References $wgDBpassword, and $wgDBuser.
|
protected |
Definition at line 42 of file PostgresInstaller.php.
|
protected |
Definition at line 53 of file PostgresInstaller.php.
|
static |
Definition at line 58 of file PostgresInstaller.php.
|
staticprotected |
Definition at line 60 of file PostgresInstaller.php.