|
MediaWiki 1.43.1
|
Base class for DBMS-specific installation helper classes. More...
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() | |
| createExtensionTables () | |
| Create the tables for each extension the user enabled. | |
| createTables () | |
| Create database tables from scratch from the automatically generated file. | |
| definitelyGetConnection (string $type) | |
| Get a connection and unwrap it from its Status object, throwing an exception on failure. | |
| enableLB () | |
| getConnectForm (WebInstaller $webInstaller) | |
| getConnection ( $type=self::CONN_DONT_KNOW) | |
| 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. | |
| 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. | |
| getReadableName () | |
| Get the internationalised name for this DBMS. | |
| getSchemaVars () | |
| Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files. | |
| getSettingsForm (WebInstaller $webInstaller) | |
| getVar ( $var, $default=null) | |
| Get a variable, taking local defaults into account. | |
| insertUpdateKeys () | |
| Insert update keys into table to prevent running unneeded updates. | |
| isCompiled () | |
| needsUpgrade () | |
| Determine whether an existing installation of MediaWiki is present in the configured administrative connection. | |
| populateInterwikiTable () | |
| Common function for databases that don't understand the MySQLish syntax of interwiki.list. | |
| 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. | |
| 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 | |
| Database | $db = null |
| Installer | $parent |
| The Installer object. | |
| 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 (Database $conn, &$storedType, $newType) | |
| Change the type of a connection. | |
| changeConnTypeFromSchemaToTables (Database $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. | |
| selectDatabase (Database $conn, string $database) | |
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 41 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 427 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.
| Database | $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 247 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\Database\selectDomain(), and Wikimedia\Rdbms\Database\setSchemaVars().
Referenced by MediaWiki\Installer\DatabaseInstaller\getConnection().
|
protected |
Change the type of a connection from CONN_CREATE_SCHEMA to CONN_CREATE_TABLES.
Postgres overrides this.
| Database | $conn |
Reimplemented in MediaWiki\Installer\PostgresInstaller.
Definition at line 279 of file DatabaseInstaller.php.
|
staticprotected |
Convenience function.
Check if a named extension is present.
| string | $name |
Definition at line 438 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 143 of file DatabaseInstaller.php.
| MediaWiki\Installer\DatabaseInstaller::createExtensionTables | ( | ) |
Create the tables for each extension the user enabled.
Definition at line 364 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseUpdater\newForDB().
| MediaWiki\Installer\DatabaseInstaller::createTables | ( | ) |
Create database tables from scratch from the automatically generated file.
Reimplemented in MediaWiki\Installer\SqliteInstaller.
Definition at line 310 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 216 of file DatabaseInstaller.php.
| MediaWiki\Installer\DatabaseInstaller::enableLB | ( | ) |
Definition at line 397 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. |
Definition at line 179 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseInstaller\changeConnType(), MediaWiki\Installer\DatabaseInstaller\CONN_CREATE_DATABASE, MediaWiki\Installer\DatabaseInstaller\getSchemaVars(), and MediaWiki\Installer\DatabaseInstaller\openConnection().
Referenced by MediaWiki\Installer\Installer\populateSiteStats().
| 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 456 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 418 of file DatabaseInstaller.php.
| MediaWiki\Installer\DatabaseInstaller::getInternalDefaults | ( | ) |
Get a name=>value map of internal variables used during installation.
Definition at line 470 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::getReadableName | ( | ) |
Get the internationalised name for this DBMS.
Definition at line 446 of file DatabaseInstaller.php.
References wfMessage().
| MediaWiki\Installer\DatabaseInstaller::getSchemaVars | ( | ) |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files.
Reimplemented in MediaWiki\Installer\MysqlInstaller.
Definition at line 390 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\getConnection().
|
abstract |
| MediaWiki\Installer\DatabaseInstaller::getVar | ( | $var, | |
| $default = null ) |
Get a variable, taking local defaults into account.
| string | $var | |
| mixed | null | $default |
Definition at line 480 of file DatabaseInstaller.php.
| MediaWiki\Installer\DatabaseInstaller::insertUpdateKeys | ( | ) |
Insert update keys into table to prevent running unneeded updates.
Definition at line 335 of file DatabaseInstaller.php.
References MediaWiki\Installer\DatabaseUpdater\newForDB().
|
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 117 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 515 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\Database\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.
Referenced by MediaWiki\Installer\DatabaseInstaller\getConnection().
| MediaWiki\Installer\DatabaseInstaller::populateInterwikiTable | ( | ) |
Common function for databases that don't understand the MySQLish syntax of interwiki.list.
Definition at line 530 of file DatabaseInstaller.php.
References $IP.
| MediaWiki\Installer\DatabaseInstaller::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 in MediaWiki\Installer\MysqlInstaller, and MediaWiki\Installer\PostgresInstaller.
Definition at line 405 of file DatabaseInstaller.php.
| 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 411 of file DatabaseInstaller.php.
|
protected |
| Database | $conn | |
| string | $database |
Definition at line 580 of file DatabaseInstaller.php.
References Wikimedia\Rdbms\Database\dbSchema(), Wikimedia\Rdbms\Database\selectDomain(), and Wikimedia\Rdbms\Database\tablePrefix().
|
abstract |
Create the database and return a Status object indicating success or failure.
Reimplemented in MediaWiki\Installer\MysqlInstaller, MediaWiki\Installer\PostgresInstaller, and MediaWiki\Installer\SqliteInstaller.
| MediaWiki\Installer\DatabaseInstaller::setVar | ( | $name, | |
| $value ) |
Convenience alias for $this->parent->setVar()
| string | $name | |
| mixed | $value |
Definition at line 497 of file DatabaseInstaller.php.
| Database MediaWiki\Installer\DatabaseInstaller::$db = null |
Definition at line 89 of file DatabaseInstaller.php.
|
protected |
Array of MW configuration globals this class uses.
Definition at line 108 of file DatabaseInstaller.php.
|
protected |
Internal variables for installation.
Definition at line 101 of file DatabaseInstaller.php.
|
static |
Set by subclasses.
Definition at line 78 of file DatabaseInstaller.php.
|
staticprotected |
Set by subclasses.
Definition at line 83 of file DatabaseInstaller.php.
| Installer MediaWiki\Installer\DatabaseInstaller::$parent |
The Installer object.
Definition at line 73 of file DatabaseInstaller.php.
| const MediaWiki\Installer\DatabaseInstaller::CONN_CREATE_DATABASE = 'create-database' |
A connection for creating DBs, suitable for pre-installation.
Definition at line 45 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\DatabaseInstaller\getConnection(), MediaWiki\Installer\WebInstallerExistingWiki\handleExistingUpgrade(), MediaWiki\Installer\MysqlConnectForm\submit(), MediaWiki\Installer\PostgresConnectForm\submit(), and MediaWiki\Installer\PostgresSettingsForm\submit().
| const MediaWiki\Installer\DatabaseInstaller::CONN_CREATE_SCHEMA = 'create-schema' |
A connection to the new DB, for creating schemas and other similar objects in the new DB.
Definition at line 51 of file DatabaseInstaller.php.
| const MediaWiki\Installer\DatabaseInstaller::CONN_CREATE_TABLES = 'create-tables' |
A connection with a role suitable for creating tables.
Definition at line 56 of file DatabaseInstaller.php.
Referenced by MediaWiki\Installer\WebInstaller\doUpgrade(), and MediaWiki\Installer\Installer\populateSiteStats().
| const MediaWiki\Installer\DatabaseInstaller::CONN_DONT_KNOW = 'dont-know' |
Legacy default connection type.
Before MW 1.43, getConnection() with no parameters would return the cached connection. The state (especially the selected domain) would depend on the previously executed install steps. Using this constant tries to reproduce this behaviour.
Definition at line 66 of file DatabaseInstaller.php.