MediaWiki
master
|
Base class for DBMS-specific installation helper classes. More...
Public Member Functions | |
__construct ($parent) | |
Construct and initialise parent. More... | |
checkPrerequisites () | |
Checks for installation prerequisites other than those checked by isCompiled() More... | |
createExtensionTables () | |
Create the tables for each extension the user enabled. More... | |
createTables () | |
Create database tables from scratch. More... | |
doUpgrade () | |
Perform database upgrades. More... | |
enableLB () | |
Set up LBFactory so that wfGetDB() etc. More... | |
getCheckBox ($var, $label, $attribs=[], $helpData="") | |
Get a labelled checkbox to configure a local boolean variable. More... | |
getConnectForm () | |
Get HTML for a web form that configures this database. More... | |
getConnection () | |
Connect to the database using the administrative user/password currently defined in the session. More... | |
getGlobalDefaults () | |
Get a name=>value map of MW configuration globals for the default values. More... | |
getGlobalNames () | |
Get an array of MW configuration globals that will be configured by this class. More... | |
getInstallUserBox () | |
Get a standard install-user fieldset. More... | |
getInternalDefaults () | |
Get a name=>value map of internal variables used during installation. More... | |
getLocalSettings () | |
Get the DBMS-specific options for LocalSettings.php generation. More... | |
getName () | |
Return the internal name, e.g. More... | |
getPasswordBox ($var, $label, $attribs=[], $helpData="") | |
Get a labelled password box to configure a local variable. More... | |
getRadioSet ($params) | |
Get a set of labelled radio buttons. More... | |
getReadableName () | |
Get the internationalised name for this DBMS. More... | |
getSchemaVars () | |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files. More... | |
getSettingsForm () | |
Get HTML for a web form that retrieves settings used for installation. More... | |
getTextBox ($var, $label, $attribs=[], $helpData="") | |
Get a labelled text box to configure a local variable. More... | |
getVar ($var, $default=null) | |
Get a variable, taking local defaults into account. More... | |
getWebUserBox ($noCreateMsg=false) | |
Get a standard web-user fieldset. More... | |
insertUpdateKeys () | |
Insert update keys into table to prevent running unneded updates. More... | |
isCompiled () | |
needsUpgrade () | |
Determine whether an existing installation of MediaWiki is present in the configured administrative connection. More... | |
openConnection () | |
Open a connection to the database using the administrative user/password currently defined in the session, without any caching. More... | |
outputHandler ($string) | |
populateInterwikiTable () | |
Common function for databases that don't understand the MySQLish syntax of interwiki.sql. More... | |
preInstall () | |
Allow DB installers a chance to make last-minute changes before installation occurs. More... | |
preUpgrade () | |
Allow DB installers a chance to make checks before upgrade. More... | |
setupDatabase () | |
Create the database and return a Status object indicating success or failure. More... | |
setupSchemaVars () | |
Set appropriate schema variables in the current database connection. More... | |
setVar ($name, $value) | |
Convenience alias for $this->parent->setVar() More... | |
setVarsFromRequest ($varNames) | |
Convenience function to set variables based on form data. More... | |
submitConnectForm () | |
Set variables based on the request array, assuming it was submitted via the form returned by getConnectForm(). More... | |
submitInstallUserBox () | |
Submit a standard install user fieldset. More... | |
submitSettingsForm () | |
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm(). More... | |
submitWebUserBox () | |
Submit the form from getWebUserBox(). More... | |
Public Attributes | |
DatabaseBase | $db = null |
The database connection. More... | |
WebInstaller | $parent |
The Installer object. More... | |
Static Protected Member Functions | |
static | checkExtension ($name) |
Convenience function. More... | |
Protected Attributes | |
array | $globalNames = [] |
Array of MW configuration globals this class uses. More... | |
array | $internalDefaults = [] |
Internal variables for installation. More... | |
Private Member Functions | |
stepApplySourceFile ($sourceFileMethod, $stepName, $archiveTableMustNotExist=false) | |
Apply a SQL source file to the database as part of running an installation step. More... | |
Base class for DBMS-specific installation helper classes.
Definition at line 30 of file DatabaseInstaller.php.
DatabaseInstaller::__construct | ( | $parent | ) |
Construct and initialise parent.
This is typically only called from Installer::getDBInstaller()
WebInstaller | $parent |
Definition at line 354 of file DatabaseInstaller.php.
References $parent.
|
staticprotected |
Convenience function.
Check if a named extension is present.
string | $name |
Definition at line 365 of file DatabaseInstaller.php.
References $name.
DatabaseInstaller::checkPrerequisites | ( | ) |
Checks for installation prerequisites other than those checked by isCompiled()
Definition at line 77 of file DatabaseInstaller.php.
References Status\newGood().
DatabaseInstaller::createExtensionTables | ( | ) |
Create the tables for each extension the user enabled.
Definition at line 234 of file DatabaseInstaller.php.
References $status, getConnection(), and DatabaseUpdater\newForDB().
DatabaseInstaller::createTables | ( | ) |
Create database tables from scratch.
Definition at line 217 of file DatabaseInstaller.php.
References stepApplySourceFile().
DatabaseInstaller::doUpgrade | ( | ) |
Perform database upgrades.
Definition at line 307 of file DatabaseInstaller.php.
References $e, $ret, enableLB(), DatabaseUpdater\newForDB(), 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 285 of file DatabaseInstaller.php.
References $services, $status, getConnection(), and use.
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 490 of file DatabaseInstaller.php.
References $attribs, $name, $value, getName(), and getVar().
Referenced by MssqlInstaller\getSettingsForm(), and 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.
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.
Definition at line 149 of file DatabaseInstaller.php.
References $status, DBO_TRX, Status\newGood(), and openConnection().
Referenced by MssqlInstaller\canCreateAccounts(), MysqlInstaller\canCreateAccounts(), createExtensionTables(), enableLB(), MysqlInstaller\getEngines(), needsUpgrade(), populateInterwikiTable(), Installer\populateSiteStats(), MysqlInstaller\preUpgrade(), MssqlInstaller\preUpgrade(), SqliteInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), MssqlInstaller\setupDatabase(), setupSchemaVars(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), MssqlInstaller\setupUser(), stepApplySourceFile(), OracleInstaller\submitConnectForm(), MysqlInstaller\submitConnectForm(), and MssqlInstaller\submitConnectForm().
DatabaseInstaller::getGlobalDefaults | ( | ) |
Get a name=>value map of MW configuration globals for the default values.
Definition at line 383 of file DatabaseInstaller.php.
References $GLOBALS, as, and getGlobalNames().
Referenced by getVar().
DatabaseInstaller::getGlobalNames | ( | ) |
Get an array of MW configuration globals that will be configured by this class.
Definition at line 345 of file DatabaseInstaller.php.
References $globalNames.
Referenced by getGlobalDefaults().
DatabaseInstaller::getInstallUserBox | ( | ) |
Get a standard install-user fieldset.
Definition at line 563 of file DatabaseInstaller.php.
References Html\closeElement(), Html\element(), getPasswordBox(), getTextBox(), Html\openElement(), text, and wfMessage().
Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), and MysqlInstaller\getConnectForm().
DatabaseInstaller::getInternalDefaults | ( | ) |
Get a name=>value map of internal variables used during installation.
Definition at line 397 of file DatabaseInstaller.php.
References $internalDefaults.
Referenced by getVar().
|
abstract |
Get the DBMS-specific options for LocalSettings.php generation.
|
abstract |
Return the internal name, e.g.
'mysql', or 'sqlite'.
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 464 of file DatabaseInstaller.php.
References $attribs, $name, $value, getName(), and getVar().
Referenced by MssqlInstaller\getConnectForm(), getInstallUserBox(), MssqlInstaller\getSettingsForm(), 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 516 of file DatabaseInstaller.php.
References $params, getName(), and getVar().
Referenced by MssqlInstaller\getConnectForm(), MysqlInstaller\getSettingsForm(), and MssqlInstaller\getSettingsForm().
DatabaseInstaller::getReadableName | ( | ) |
Get the internationalised name for this DBMS.
Definition at line 373 of file DatabaseInstaller.php.
References getName(), and wfMessage().
DatabaseInstaller::getSchemaVars | ( | ) |
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files.
Definition at line 258 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.
Definition at line 108 of file DatabaseInstaller.php.
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 437 of file DatabaseInstaller.php.
References $attribs, $name, $value, getName(), and getVar().
Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), MysqlInstaller\getConnectForm(), MssqlInstaller\getConnectForm(), SqliteInstaller\getConnectForm(), getInstallUserBox(), MssqlInstaller\getSettingsForm(), and getWebUserBox().
DatabaseInstaller::getVar | ( | $var, | |
$default = null |
|||
) |
Get a variable, taking local defaults into account.
string | $var | |
mixed | null | $default |
Definition at line 407 of file DatabaseInstaller.php.
References getGlobalDefaults(), and getInternalDefaults().
Referenced by MssqlInstaller\canCreateAccounts(), MysqlInstaller\canCreateAccounts(), PostgresInstaller\canCreateObjectsForWebUser(), OracleInstaller\createTables(), PostgresInstaller\createTables(), MssqlInstaller\createTables(), getCheckBox(), OracleInstaller\getConnectForm(), MssqlInstaller\getConnectForm(), PostgresInstaller\getInstallUserPermissions(), OracleInstaller\getLocalSettings(), SqliteInstaller\getLocalSettings(), PostgresInstaller\getLocalSettings(), MysqlInstaller\getLocalSettings(), MssqlInstaller\getLocalSettings(), getPasswordBox(), getRadioSet(), OracleInstaller\getSchemaVars(), MysqlInstaller\getSchemaVars(), MssqlInstaller\getSchemaVars(), MysqlInstaller\getSettingsForm(), MssqlInstaller\getSettingsForm(), MysqlInstaller\getTableOptions(), getTextBox(), getWebUserBox(), SqliteInstaller\needsUpgrade(), OracleInstaller\needsUpgrade(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), SqliteInstaller\openConnection(), MssqlInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), PostgresInstaller\openPgConnection(), OracleInstaller\openSYSDBAConnection(), populateInterwikiTable(), PostgresInstaller\preInstall(), MysqlInstaller\preUpgrade(), MssqlInstaller\preUpgrade(), PostgresInstaller\preUpgrade(), SqliteInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), PostgresInstaller\setupDatabase(), MssqlInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), MssqlInstaller\setupUser(), PostgresInstaller\setupUser(), stepApplySourceFile(), PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), OracleInstaller\submitInstallUserBox(), PostgresInstaller\submitSettingsForm(), MssqlInstaller\submitSettingsForm(), MysqlInstaller\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 598 of file DatabaseInstaller.php.
References $s, Html\closeElement(), Html\element(), getCheckBox(), getPasswordBox(), getTextBox(), getVar(), Html\openElement(), text, and wfMessage().
Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getSettingsForm(), and MysqlInstaller\getSettingsForm().
DatabaseInstaller::insertUpdateKeys | ( | ) |
Insert update keys into table to prevent running unneded updates.
Definition at line 226 of file DatabaseInstaller.php.
References stepApplySourceFile().
|
abstract |
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 544 of file DatabaseInstaller.php.
References $status, and getConnection().
|
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.
Referenced by getConnection().
DatabaseInstaller::outputHandler | ( | $string | ) |
Definition at line 684 of file DatabaseInstaller.php.
DatabaseInstaller::populateInterwikiTable | ( | ) |
Common function for databases that don't understand the MySQLish syntax of interwiki.sql.
Definition at line 647 of file DatabaseInstaller.php.
References $IP, $status, as, file, getConnection(), getVar(), global, Status\newFatal(), and Status\newGood().
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 :)
Definition at line 332 of file DatabaseInstaller.php.
DatabaseInstaller::preUpgrade | ( | ) |
Allow DB installers a chance to make checks before upgrade.
Definition at line 338 of file DatabaseInstaller.php.
|
abstract |
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.
Definition at line 268 of file DatabaseInstaller.php.
References $status, getConnection(), and getSchemaVars().
Referenced by OracleInstaller\createTables(), doUpgrade(), SqliteInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), MssqlInstaller\setupDatabase(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), and MssqlInstaller\setupUser().
DatabaseInstaller::setVar | ( | $name, | |
$value | |||
) |
Convenience alias for $this->parent->setVar()
string | $name | |
mixed | $value |
Definition at line 424 of file DatabaseInstaller.php.
Referenced by MysqlInstaller\getSettingsForm(), MysqlInstaller\preUpgrade(), SqliteInstaller\setupDatabase(), PostgresInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), MssqlInstaller\submitConnectForm(), PostgresInstaller\submitSettingsForm(), MssqlInstaller\submitSettingsForm(), MysqlInstaller\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 530 of file DatabaseInstaller.php.
References getName().
Referenced by PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), MysqlInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), MssqlInstaller\submitConnectForm(), submitInstallUserBox(), MssqlInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), and submitWebUserBox().
|
private |
Apply a SQL source file to the database as part of running an installation step.
string | $sourceFileMethod | |
string | $stepName | |
string | $archiveTableMustNotExist |
Definition at line 173 of file DatabaseInstaller.php.
References $status, DBO_DDLMODE, enableLB(), getConnection(), and getVar().
Referenced by 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.
DatabaseInstaller::submitInstallUserBox | ( | ) |
Submit a standard install user fieldset.
Definition at line 585 of file DatabaseInstaller.php.
References Status\newGood(), and setVarsFromRequest().
Referenced by PostgresInstaller\submitConnectForm(), and MysqlInstaller\submitConnectForm().
DatabaseInstaller::submitSettingsForm | ( | ) |
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().
Definition at line 118 of file DatabaseInstaller.php.
References Status\newGood().
DatabaseInstaller::submitWebUserBox | ( | ) |
Submit the form from getWebUserBox().
Definition at line 625 of file DatabaseInstaller.php.
References getVar(), Status\newFatal(), Status\newGood(), setVar(), and setVarsFromRequest().
Referenced by OracleInstaller\submitConnectForm(), PostgresInstaller\submitSettingsForm(), and MysqlInstaller\submitSettingsForm().
DatabaseBase DatabaseInstaller::$db = null |
The database connection.
Definition at line 46 of file DatabaseInstaller.php.
Referenced by MysqlInstaller\openConnection(), OracleInstaller\openConnection(), MssqlInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), and OracleInstaller\openSYSDBAConnection().
|
protected |
Array of MW configuration globals this class uses.
Definition at line 60 of file DatabaseInstaller.php.
Referenced by getGlobalNames().
|
protected |
Internal variables for installation.
Definition at line 53 of file DatabaseInstaller.php.
Referenced by getInternalDefaults().
WebInstaller DatabaseInstaller::$parent |
The Installer object.
Definition at line 39 of file DatabaseInstaller.php.
Referenced by __construct().