MediaWiki REL1_35
|
Base class for DBMS-specific installation helper classes. More...
Public Member Functions | |
__construct ( $parent) | |
Construct and initialise parent. | |
checkPrerequisites () | |
Checks for installation prerequisites other than those checked by isCompiled() Stable to override. | |
createExtensionTables () | |
Create the tables for each extension the user enabled Stable to override. | |
createManualTables () | |
Create database tables from scratch. | |
createTables () | |
Create database tables from scratch from the automatically generated file Stable to override. | |
doUpgrade () | |
Perform database upgrades. | |
enableLB () | |
Set up LBFactory so that wfGetDB() etc. | |
getCheckBox ( $var, $label, $attribs=[], $helpData="") | |
Get a labelled checkbox to configure a local boolean variable. | |
getConnectForm () | |
Get HTML for a web form that configures this database. | |
getConnection () | |
Connect to the database using the administrative user/password currently defined in the session. | |
getGeneratedSchemaPath ( $db) | |
Return a path to the DBMS-specific automatically generated schema file. | |
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. | |
getInstallUserBox () | |
Get a standard install-user fieldset. | |
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. | |
getPasswordBox ( $var, $label, $attribs=[], $helpData="") | |
Get a labelled password box to configure a local variable. | |
getRadioSet ( $params) | |
Get a set of labelled radio buttons. | |
getReadableName () | |
Get the internationalised name for this DBMS. | |
getSchemaPath ( $db) | |
Return a path to the DBMS-specific schema file, otherwise default to tables.sql Stable to override. | |
getSchemaVars () | |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files. | |
getSettingsForm () | |
Get HTML for a web form that retrieves settings used for installation. | |
getTextBox ( $var, $label, $attribs=[], $helpData="") | |
Get a labelled text box to configure a local variable. | |
getUpdateKeysPath ( $db) | |
Return a path to the DBMS-specific update key file, otherwise default to update-keys.sql Stable to override. | |
getVar ( $var, $default=null) | |
Get a variable, taking local defaults into account. | |
getWebUserBox ( $noCreateMsg=false) | |
Get a standard web-user fieldset. | |
insertUpdateKeys () | |
Insert update keys into table to prevent running unneded updates. | |
isCompiled () | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. | |
openConnection () | |
Open a connection to the database using the administrative user/password currently defined in the session, without any caching. | |
outputHandler ( $string) | |
populateInterwikiTable () | |
Common function for databases that don't understand the MySQLish syntax of interwiki.sql. | |
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. | |
setupSchemaVars () | |
Set appropriate schema variables in the current database connection. | |
setVar ( $name, $value) | |
Convenience alias for $this->parent->setVar() | |
setVarsFromRequest ( $varNames) | |
Convenience function to set variables based on form data. | |
submitConnectForm () | |
Set variables based on the request array, assuming it was submitted via the form returned by getConnectForm(). | |
submitInstallUserBox () | |
Submit a standard install user fieldset. | |
submitSettingsForm () | |
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm(). | |
submitWebUserBox () | |
Submit the form from getWebUserBox(). | |
Static Public Member Functions | |
static | meetsMinimumRequirement ( $serverVersion) |
Whether the provided version meets the necessary requirements for this type. | |
Public Attributes | |
Database | $db = null |
The database connection. | |
WebInstaller | $parent |
The Installer object. | |
Static Public Attributes | |
static string | $minimumVersion |
Set by subclasses. | |
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. | |
Private Member Functions | |
getSqlFilePath ( $db, $filename) | |
Return a path to the DBMS-specific SQL file if it exists, otherwise default SQL file. | |
stepApplySourceFile ( $sourceFileMethod, $stepName, $archiveTableMustNotExist=false) | |
Apply a SQL source file to the database as part of running an installation step. | |
Base class for DBMS-specific installation helper classes.
Stable to extend
Definition at line 37 of file DatabaseInstaller.php.
DatabaseInstaller::__construct | ( | $parent | ) |
Construct and initialise parent.
This is typically only called from Installer::getDBInstaller() Stable to call
WebInstaller | $parent |
Definition at line 471 of file DatabaseInstaller.php.
References $parent.
|
staticprotected |
Convenience function.
Check if a named extension is present.
string | $name |
Definition at line 482 of file DatabaseInstaller.php.
Referenced by MysqlInstaller\isCompiled(), PostgresInstaller\isCompiled(), and SqliteInstaller\isCompiled().
DatabaseInstaller::checkPrerequisites | ( | ) |
Checks for installation prerequisites other than those checked by isCompiled() Stable to override.
Reimplemented in SqliteInstaller.
Definition at line 110 of file DatabaseInstaller.php.
DatabaseInstaller::createExtensionTables | ( | ) |
Create the tables for each extension the user enabled Stable to override.
Definition at line 339 of file DatabaseInstaller.php.
References getConnection().
DatabaseInstaller::createManualTables | ( | ) |
Create database tables from scratch.
Stable to override
Definition at line 265 of file DatabaseInstaller.php.
References stepApplySourceFile().
DatabaseInstaller::createTables | ( | ) |
Create database tables from scratch from the automatically generated file Stable to override.
Reimplemented in PostgresInstaller, and SqliteInstaller.
Definition at line 255 of file DatabaseInstaller.php.
References stepApplySourceFile().
DatabaseInstaller::doUpgrade | ( | ) |
Perform database upgrades.
SecurityCheck-XSS Escaping provided by $this->outputHandler
Definition at line 416 of file DatabaseInstaller.php.
References enableLB(), MWException\getText(), and setupSchemaVars().
DatabaseInstaller::enableLB | ( | ) |
Set up LBFactory so that wfGetDB() etc.
works. We set up a special LBFactory instance which returns the current installer connection.
Definition at line 396 of file DatabaseInstaller.php.
References getConnection().
Referenced by PostgresInstaller\createTables(), doUpgrade(), and stepApplySourceFile().
DatabaseInstaller::getCheckBox | ( | $var, | |
$label, | |||
$attribs = [] , |
|||
$helpData = "" |
|||
) |
Get a labelled checkbox to configure a local boolean variable.
string | $var | |
string | $label | |
array | $attribs | Optional. |
string | $helpData | Optional. |
Definition at line 608 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by getWebUserBox().
|
abstract |
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 in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
DatabaseInstaller::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.
Stable to override
Reimplemented in PostgresInstaller.
Definition at line 186 of file DatabaseInstaller.php.
References DBO_TRX, and openConnection().
Referenced by MysqlInstaller\canCreateAccounts(), createExtensionTables(), enableLB(), MysqlInstaller\getEngines(), needsUpgrade(), populateInterwikiTable(), Installer\populateSiteStats(), MysqlInstaller\preUpgrade(), MysqlInstaller\setupDatabase(), setupSchemaVars(), MysqlInstaller\setupUser(), stepApplySourceFile(), and MysqlInstaller\submitConnectForm().
DatabaseInstaller::getGeneratedSchemaPath | ( | $db | ) |
Return a path to the DBMS-specific automatically generated schema file.
Stable to override
IDatabase | $db |
Definition at line 318 of file DatabaseInstaller.php.
References getSqlFilePath().
Referenced by PostgresInstaller\createTables().
DatabaseInstaller::getGlobalDefaults | ( | ) |
Get a name=>value map of MW configuration globals for the default values.
Stable to override
Reimplemented in PostgresInstaller, and SqliteInstaller.
Definition at line 501 of file DatabaseInstaller.php.
References $GLOBALS, and getGlobalNames().
Referenced by getVar().
DatabaseInstaller::getGlobalNames | ( | ) |
Get an array of MW configuration globals that will be configured by this class.
Stable to override
Definition at line 461 of file DatabaseInstaller.php.
References $globalNames.
Referenced by getGlobalDefaults().
DatabaseInstaller::getInstallUserBox | ( | ) |
Get a standard install-user fieldset.
Definition at line 687 of file DatabaseInstaller.php.
References getPasswordBox(), getTextBox(), and wfMessage().
Referenced by MysqlInstaller\getConnectForm(), and PostgresInstaller\getConnectForm().
DatabaseInstaller::getInternalDefaults | ( | ) |
Get a name=>value map of internal variables used during installation.
Definition at line 515 of file DatabaseInstaller.php.
References $internalDefaults.
Referenced by getVar().
|
abstract |
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
|
abstract |
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
Referenced by getCheckBox(), getPasswordBox(), getRadioSet(), getReadableName(), getTextBox(), and setVarsFromRequest().
DatabaseInstaller::getPasswordBox | ( | $var, | |
$label, | |||
$attribs = [] , |
|||
$helpData = "" |
|||
) |
Get a labelled password box to configure a local variable.
Implements password hiding.
string | $var | |
string | $label | |
array | $attribs | |
string | $helpData |
Definition at line 582 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by getInstallUserBox(), and getWebUserBox().
DatabaseInstaller::getRadioSet | ( | $params | ) |
Get a set of labelled radio buttons.
array | $params | Parameters are: var: The variable to be configured (required) label: The message name for the label (required) itemLabelPrefix: The message name prefix for the item labels (required) values: List of allowed values (required) itemAttribs Array of attribute arrays, outer key is the value name (optional) |
Definition at line 634 of file DatabaseInstaller.php.
DatabaseInstaller::getReadableName | ( | ) |
Get the internationalised name for this DBMS.
Stable to override
Definition at line 491 of file DatabaseInstaller.php.
References getName(), and wfMessage().
DatabaseInstaller::getSchemaPath | ( | $db | ) |
Return a path to the DBMS-specific schema file, otherwise default to tables.sql Stable to override.
IDatabase | $db |
Definition at line 307 of file DatabaseInstaller.php.
References getSqlFilePath().
Referenced by PostgresInstaller\createTables().
DatabaseInstaller::getSchemaVars | ( | ) |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files.
Stable to override
Reimplemented in MysqlInstaller.
Definition at line 366 of file DatabaseInstaller.php.
Referenced by setupSchemaVars().
DatabaseInstaller::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. Stable to override
Reimplemented in MysqlInstaller, and PostgresInstaller.
Definition at line 142 of file DatabaseInstaller.php.
|
private |
Return a path to the DBMS-specific SQL file if it exists, otherwise default SQL file.
IDatabase | $db | |
string | $filename |
Definition at line 288 of file DatabaseInstaller.php.
References $db, $IP, and Wikimedia\Rdbms\IDatabase\getType().
Referenced by getGeneratedSchemaPath(), getSchemaPath(), and getUpdateKeysPath().
DatabaseInstaller::getTextBox | ( | $var, | |
$label, | |||
$attribs = [] , |
|||
$helpData = "" |
|||
) |
Get a labelled text box to configure a local variable.
string | $var | |
string | $label | |
array | $attribs | |
string | $helpData |
Definition at line 555 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by MysqlInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), SqliteInstaller\getConnectForm(), getInstallUserBox(), and getWebUserBox().
DatabaseInstaller::getUpdateKeysPath | ( | $db | ) |
Return a path to the DBMS-specific update key file, otherwise default to update-keys.sql Stable to override.
IDatabase | $db |
Definition at line 330 of file DatabaseInstaller.php.
References getSqlFilePath().
DatabaseInstaller::getVar | ( | $var, | |
$default = null |
|||
) |
Get a variable, taking local defaults into account.
string | $var | |
mixed | null | $default |
Definition at line 525 of file DatabaseInstaller.php.
References getGlobalDefaults(), and getInternalDefaults().
Referenced by MysqlInstaller\canCreateAccounts(), PostgresInstaller\canCreateObjectsForWebUser(), PostgresInstaller\createTables(), getCheckBox(), PostgresInstaller\getInstallUserPermissions(), MysqlInstaller\getLocalSettings(), PostgresInstaller\getLocalSettings(), getPasswordBox(), getRadioSet(), MysqlInstaller\getSchemaVars(), MysqlInstaller\getSettingsForm(), MysqlInstaller\getTableOptions(), getTextBox(), getWebUserBox(), needsUpgrade(), MysqlInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), PostgresInstaller\openPgConnection(), populateInterwikiTable(), PostgresInstaller\preInstall(), MysqlInstaller\preUpgrade(), PostgresInstaller\preUpgrade(), MysqlInstaller\setupDatabase(), PostgresInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), MysqlInstaller\setupUser(), PostgresInstaller\setupUser(), stepApplySourceFile(), PostgresInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), MysqlInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), and submitWebUserBox().
DatabaseInstaller::getWebUserBox | ( | $noCreateMsg = false | ) |
Get a standard web-user fieldset.
string | bool | $noCreateMsg | Message to display instead of the creation checkbox. Set this to false to show a creation checkbox (default). |
Definition at line 722 of file DatabaseInstaller.php.
References $s, getCheckBox(), getPasswordBox(), getTextBox(), getVar(), and wfMessage().
Referenced by MysqlInstaller\getSettingsForm(), and PostgresInstaller\getSettingsForm().
DatabaseInstaller::insertUpdateKeys | ( | ) |
Insert update keys into table to prevent running unneded updates.
Stable to override
Definition at line 276 of file DatabaseInstaller.php.
References stepApplySourceFile().
|
abstract |
Reimplemented in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
|
static |
Whether the provided version meets the necessary requirements for this type.
string | $serverVersion | Output of Database::getServerVersion() |
Definition at line 84 of file DatabaseInstaller.php.
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.
Stable to override
Reimplemented in SqliteInstaller.
Definition at line 663 of file DatabaseInstaller.php.
References getConnection(), and getVar().
|
abstract |
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 in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
Referenced by getConnection().
DatabaseInstaller::outputHandler | ( | $string | ) |
Definition at line 809 of file DatabaseInstaller.php.
DatabaseInstaller::populateInterwikiTable | ( | ) |
Common function for databases that don't understand the MySQLish syntax of interwiki.sql.
Stable to override
Definition at line 772 of file DatabaseInstaller.php.
References $IP, getConnection(), and getVar().
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 :) Stable to override
Reimplemented in MysqlInstaller, and PostgresInstaller.
Definition at line 446 of file DatabaseInstaller.php.
DatabaseInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Stable to override
Reimplemented in MysqlInstaller, and PostgresInstaller.
Definition at line 453 of file DatabaseInstaller.php.
|
abstract |
Create the database and return a Status object indicating success or failure.
Reimplemented in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
DatabaseInstaller::setupSchemaVars | ( | ) |
Set appropriate schema variables in the current database connection.
This should be called after any request data has been imported, but before any write operations to the database.
Stable to override
Definition at line 378 of file DatabaseInstaller.php.
References getConnection(), and getSchemaVars().
Referenced by doUpgrade(), MysqlInstaller\setupDatabase(), and MysqlInstaller\setupUser().
DatabaseInstaller::setVar | ( | $name, | |
$value | |||
) |
Convenience alias for $this->parent->setVar()
string | $name | |
mixed | $value |
Definition at line 542 of file DatabaseInstaller.php.
Referenced by MysqlInstaller\getSettingsForm(), MysqlInstaller\preUpgrade(), PostgresInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), MysqlInstaller\submitSettingsForm(), PostgresInstaller\submitSettingsForm(), and submitWebUserBox().
DatabaseInstaller::setVarsFromRequest | ( | $varNames | ) |
Convenience function to set variables based on form data.
Assumes that variables containing "password" in the name are (potentially fake) passwords.
array | $varNames |
Definition at line 648 of file DatabaseInstaller.php.
References getName().
Referenced by MysqlInstaller\submitConnectForm(), PostgresInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), submitInstallUserBox(), MysqlInstaller\submitSettingsForm(), and submitWebUserBox().
|
private |
Apply a SQL source file to the database as part of running an installation step.
string | $sourceFileMethod | |
string | $stepName | |
bool | $archiveTableMustNotExist |
Definition at line 210 of file DatabaseInstaller.php.
References DBO_DDLMODE, enableLB(), getConnection(), and getVar().
Referenced by createManualTables(), createTables(), and insertUpdateKeys().
|
abstract |
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 in MysqlInstaller, PostgresInstaller, and SqliteInstaller.
DatabaseInstaller::submitInstallUserBox | ( | ) |
Submit a standard install user fieldset.
Definition at line 709 of file DatabaseInstaller.php.
References setVarsFromRequest().
Referenced by MysqlInstaller\submitConnectForm(), and PostgresInstaller\submitConnectForm().
DatabaseInstaller::submitSettingsForm | ( | ) |
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().
Stable to override
Reimplemented in MysqlInstaller, and PostgresInstaller.
Definition at line 153 of file DatabaseInstaller.php.
DatabaseInstaller::submitWebUserBox | ( | ) |
Submit the form from getWebUserBox().
Definition at line 749 of file DatabaseInstaller.php.
References getVar(), setVar(), and setVarsFromRequest().
Referenced by MysqlInstaller\submitSettingsForm(), and PostgresInstaller\submitSettingsForm().
Database DatabaseInstaller::$db = null |
The database connection.
Definition at line 61 of file DatabaseInstaller.php.
Referenced by getSqlFilePath(), MysqlInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), and PostgresInstaller\openConnectionWithParams().
|
protected |
Array of MW configuration globals this class uses.
Definition at line 75 of file DatabaseInstaller.php.
Referenced by getGlobalNames().
|
protected |
Internal variables for installation.
Definition at line 68 of file DatabaseInstaller.php.
Referenced by getInternalDefaults().
|
static |
Set by subclasses.
Definition at line 49 of file DatabaseInstaller.php.
|
staticprotected |
Set by subclasses.
Definition at line 54 of file DatabaseInstaller.php.
WebInstaller DatabaseInstaller::$parent |
The Installer object.
Definition at line 44 of file DatabaseInstaller.php.
Referenced by __construct().