MediaWiki master
|
Base class for DBMS-specific installation helper classes. More...
Inherits MediaWiki\Installer\Task\ITaskContext.
Inherited by MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Public Member Functions | |
__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. | |
getConnectForm (WebInstaller $webInstaller) | |
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. | |
getGlobalDefaults () | |
Get a name=>value map of MW configuration globals for the default values. | |
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. | |
getLocalSettings () | |
Get the DBMS-specific options for LocalSettings.php generation. | |
getName () | |
Return the internal name, e.g. | |
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. | |
getSettingsForm (WebInstaller $webInstaller) | |
getVar ( $var, $default=null) | |
Get a variable, taking local defaults into account. | |
isCompiled () | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. | |
preUpgrade () | |
Allow DB installers a chance to make checks before upgrade. | |
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 Member Functions | |
static | meetsMinimumRequirement (IDatabase $conn) |
Whether the provided version meets the necessary requirements for this type. | |
Public Attributes | |
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 Public Attributes | |
static string | $minimumVersion |
Set by subclasses. | |
Protected Member Functions | |
changeConnType (IMaintainableDatabase $conn, &$storedType, $newType) | |
Change the type of a connection. | |
changeConnTypeFromSchemaToTables (IMaintainableDatabase $conn) | |
Change the type of a connection from CONN_CREATE_SCHEMA to CONN_CREATE_TABLES. | |
openConnection (string $type) | |
Open a connection to the database using the administrative user/password currently defined in the session, without any caching. | |
Static Protected Member Functions | |
static | checkExtension ( $name) |
Convenience function. | |
Protected Attributes | |
array | $globalNames = [] |
Array of MW configuration globals this class uses. | |
array | $internalDefaults = [] |
Internal variables for installation. | |
Static Protected Attributes | |
static string | $notMinimumVersionMessage |
Set by subclasses. | |
Base class for DBMS-specific installation helper classes.
Definition at line 40 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::__construct | ( | $parent | ) |
Construct and initialise parent.
This is typically only called from Installer::getDBInstaller()
Installer | $parent |
Definition at line 311 of file DatabaseInstaller.php.
|
protected |
Change the type of a connection.
CONN_CREATE_DATABASE means the domain is indeterminate and irrelevant, so converting from this type can be done by selecting the domain, and converting to it is a no-op.
CONN_CREATE_SCHEMA means the domain is correct but tables created by PostgreSQL will have the incorrect role. So to convert from this to CONN_CREATE_TABLES, we set the role.
CONN_CREATE_TABLES means a fully-configured connection, suitable for most tasks, so converting from it is a no-op.
IMaintainableDatabase | $conn | |
string | &$storedType | One of the self::CONN_* constants. An in/out parameter, set to the new type on success. It is set to the "real" new type, reflecting the highest configuration level reached, to avoid unnecessary selectDomain() calls when we need to temporarily give an unconfigured connection. |
string | $newType | One of the self::CONN_* constants |
Definition at line 216 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\IReadableDatabase\selectDomain(), and Wikimedia\Rdbms\Platform\ISQLPlatform\setSchemaVars().
|
protected |
Change the type of a connection from CONN_CREATE_SCHEMA to CONN_CREATE_TABLES.
Postgres overrides this.
IMaintainableDatabase | $conn |
Reimplemented in MediaWiki\Installer\PostgresInstaller.
Definition at line 248 of file DatabaseInstaller.php.
|
staticprotected |
Convenience function.
Check if a named extension is present.
string | $name |
Definition at line 322 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\MysqlInstaller\isCompiled(), MediaWiki\Installer\PostgresInstaller\isCompiled(), and MediaWiki\Installer\SqliteInstaller\isCompiled().
MediaWiki\Installer\DatabaseInstaller::checkPrerequisites | ( | ) |
Checks for installation prerequisites other than those checked by isCompiled()
Reimplemented in MediaWiki\Installer\SqliteInstaller.
Definition at line 120 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::definitelyGetConnection | ( | string | $type | ) |
Get a connection and unwrap it from its Status object, throwing an exception on failure.
string | $type |
Definition at line 185 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::getConfigVar | ( | string | $name | ) |
Get a MediaWiki configuration value for the wiki being created.
The name should not have a "wg" prefix.
string | $name |
Implements MediaWiki\Installer\Task\ITaskContext.
Definition at line 256 of file DatabaseInstaller.php.
|
abstract |
MediaWiki\Installer\DatabaseInstaller::getConnection | ( | $type = self::CONN_DONT_KNOW | ) |
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.
string | $type | One of the self::CONN_* constants. Using CONN_DONT_KNOW is deprecated and will cause an exception to be thrown in a future release. |
Implements MediaWiki\Installer\Task\ITaskContext.
Definition at line 148 of file DatabaseInstaller.php.
References MediaWiki\Installer\Task\ITaskContext\CONN_CREATE_DATABASE.
MediaWiki\Installer\DatabaseInstaller::getDbType | ( | ) |
Get the selected database type name.
Implements MediaWiki\Installer\Task\ITaskContext.
Definition at line 252 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::getGlobalDefaults | ( | ) |
Get a name=>value map of MW configuration globals for the default values.
Reimplemented in MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
Definition at line 340 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::getGlobalNames | ( | ) |
Get an array of MW configuration globals that will be configured by this class.
Definition at line 302 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::getInternalDefaults | ( | ) |
Get a name=>value map of internal variables used during installation.
Definition at line 354 of file DatabaseInstaller.php.
|
abstract |
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
|
abstract |
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
MediaWiki\Installer\DatabaseInstaller::getOption | ( | string | $name | ) |
Get a named installer option.
string | $name |
Implements MediaWiki\Installer\Task\ITaskContext.
Definition at line 260 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::getProvision | ( | string | $name | ) |
Get the object stored by provide()
string | $name |
Implements MediaWiki\Installer\Task\ITaskContext.
Definition at line 268 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::getReadableName | ( | ) |
Get the internationalised name for this DBMS.
Definition at line 330 of file DatabaseInstaller.php.
References wfMessage().
MediaWiki\Installer\DatabaseInstaller::getSchemaVars | ( | ) |
Override this to provide DBMS-specific schema variables, to be substituted into the schema files.
Implements MediaWiki\Installer\Task\ITaskContext.
Reimplemented in MediaWiki\Installer\MysqlInstaller.
Definition at line 288 of file DatabaseInstaller.php.
|
abstract |
MediaWiki\Installer\DatabaseInstaller::getVar | ( | $var, | |
$default = null ) |
Get a variable, taking local defaults into account.
string | $var | |
mixed | null | $default |
Definition at line 364 of file DatabaseInstaller.php.
|
abstract |
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
|
static |
Whether the provided version meets the necessary requirements for this type.
IDatabase | $conn |
Reimplemented in MediaWiki\Installer\MysqlInstaller.
Definition at line 94 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\IReadableDatabase\getServerVersion().
Referenced by MediaWiki\Installer\PostgresConnectForm\submit().
MediaWiki\Installer\DatabaseInstaller::needsUpgrade | ( | ) |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection.
Returns true if there is such a wiki, false if the database doesn't exist.
Traditionally, this is done by testing for the existence of either the revision table or the cur table.
Definition at line 399 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\IMaintainableDatabase\tableExists().
|
abstractprotected |
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.
The database should not be implicitly created.
string | $type | One of the self::CONN_* constants, except CONN_DONT_KNOW |
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
MediaWiki\Installer\DatabaseInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Reimplemented in MediaWiki\Installer\MysqlInstaller, and MediaWiki\Installer\PostgresInstaller.
Definition at line 295 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::provide | ( | string | $name, |
$value ) |
Store an object to be used by a later task.
string | $name | |
mixed | $value |
Implements MediaWiki\Installer\Task\ITaskContext.
Definition at line 264 of file DatabaseInstaller.php.
MediaWiki\Installer\DatabaseInstaller::setVar | ( | $name, | |
$value ) |
Convenience alias for $this->parent->setVar()
string | $name | |
mixed | $value |
Definition at line 381 of file DatabaseInstaller.php.
IMaintainableDatabase MediaWiki\Installer\DatabaseInstaller::$db = null |
Definition at line 63 of file DatabaseInstaller.php.
|
protected |
Array of MW configuration globals this class uses.
Definition at line 82 of file DatabaseInstaller.php.
|
protected |
Internal variables for installation.
Definition at line 75 of file DatabaseInstaller.php.
|
static |
Set by subclasses.
Definition at line 52 of file DatabaseInstaller.php.
|
staticprotected |
Set by subclasses.
Definition at line 57 of file DatabaseInstaller.php.
Installer MediaWiki\Installer\DatabaseInstaller::$parent |
The Installer object.
Definition at line 47 of file DatabaseInstaller.php.