MediaWiki
REL1_19
|
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() | |
createExtensionTables () | |
Create the tables for each extension the user enabled. | |
createTables () | |
Create database tables from scratch. | |
doUpgrade () | |
Perform database upgrades. | |
enableLB () | |
Set up LBFactory so that wfGetDB() etc. | |
getCheckBox ($var, $label, $attribs=array(), $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. | |
getGlobalDefaults () | |
Get a name=>value map of MW configuration globals that overrides. | |
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=array(), $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. | |
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=array(), $helpData="") | |
Get a labelled text box to configure a local variable. | |
getVar ($var, $default=null) | |
Get a variable, taking local defaults into account. | |
getWebUserBox ($noCreateMsg=false) | |
Get a standard web-user fieldset. | |
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(). | |
Public Attributes | |
$db = null | |
$parent | |
Static Protected Member Functions | |
static | checkExtension ($name) |
Convenience function. | |
Protected Attributes | |
$globalNames = array() | |
$internalDefaults = array() |
Base class for DBMS-specific installation helper classes.
Definition at line 15 of file DatabaseInstaller.php.
DatabaseInstaller::__construct | ( | $ | parent | ) |
Construct and initialise parent.
This is typically only called from Installer::getDBInstaller()
$parent |
Reimplemented in Ibm_db2Installer, and MysqlInstaller.
Definition at line 295 of file DatabaseInstaller.php.
References $parent.
static DatabaseInstaller::checkExtension | ( | $ | name | ) | [static, protected] |
Convenience function.
Check if a named extension is present.
$name |
Definition at line 307 of file DatabaseInstaller.php.
References wfDl(), wfRestoreWarnings(), and wfSuppressWarnings().
Referenced by SqliteInstaller\isCompiled(), PostgresInstaller\isCompiled(), OracleInstaller\isCompiled(), Ibm_db2Installer\isCompiled(), and MysqlInstaller\isCompiled().
Checks for installation prerequisites other than those checked by isCompiled()
Reimplemented in SqliteInstaller.
Definition at line 62 of file DatabaseInstaller.php.
References Status\newGood().
Create the tables for each extension the user enabled.
Definition at line 188 of file DatabaseInstaller.php.
References getConnection(), and DatabaseUpdater\newForDB().
Create database tables from scratch.
Reimplemented in PostgresInstaller, OracleInstaller, SqliteInstaller, and Ibm_db2Installer.
Definition at line 153 of file DatabaseInstaller.php.
References enableLB(), getConnection(), and getVar().
Perform database upgrades.
Definition at line 249 of file DatabaseInstaller.php.
References echo, enableLB(), MWException\getText(), DatabaseUpdater\newForDB(), and setupSchemaVars().
Set up LBFactory so that wfGetDB() etc.
works. We set up a special LBFactory instance which returns the current installer connection.
Definition at line 235 of file DatabaseInstaller.php.
References getConnection(), and LBFactory\setInstance().
Referenced by createTables(), Ibm_db2Installer\createTables(), PostgresInstaller\createTables(), and doUpgrade().
DatabaseInstaller::getCheckBox | ( | $ | var, |
$ | label, | ||
$ | attribs = array() , |
||
$ | helpData = "" |
||
) |
Get a labelled checkbox to configure a local boolean variable.
Definition at line 418 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by getWebUserBox().
DatabaseInstaller::getConnectForm | ( | ) | [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, SqliteInstaller, Ibm_db2Installer, OracleInstaller, and PostgresInstaller.
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.
Reimplemented in PostgresInstaller.
Definition at line 133 of file DatabaseInstaller.php.
References Status\newGood(), and openConnection().
Referenced by MysqlInstaller\canCreateAccounts(), Ibm_db2Installer\checkPageSize(), createExtensionTables(), createTables(), Ibm_db2Installer\createTables(), enableLB(), MysqlInstaller\getEngines(), needsUpgrade(), populateInterwikiTable(), Installer\populateSiteStats(), MysqlInstaller\preUpgrade(), Ibm_db2Installer\setupDatabase(), SqliteInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), setupSchemaVars(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), OracleInstaller\submitConnectForm(), Ibm_db2Installer\submitConnectForm(), and MysqlInstaller\submitConnectForm().
Get a name=>value map of MW configuration globals that overrides.
Reimplemented in MysqlInstaller, and SqliteInstaller.
Definition at line 325 of file DatabaseInstaller.php.
Referenced by getVar().
Get an array of MW configuration globals that will be configured by this class.
Definition at line 286 of file DatabaseInstaller.php.
Get a standard install-user fieldset.
Definition at line 486 of file DatabaseInstaller.php.
References Html\closeElement(), Html\element(), getPasswordBox(), getTextBox(), Html\openElement(), and wfMsg().
Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), Ibm_db2Installer\getConnectForm(), and MysqlInstaller\getConnectForm().
Get a name=>value map of internal variables used during installation.
Definition at line 332 of file DatabaseInstaller.php.
Referenced by getVar().
DatabaseInstaller::getLocalSettings | ( | ) | [abstract] |
Get the DBMS-specific options for LocalSettings.php generation.
Reimplemented in MysqlInstaller, PostgresInstaller, OracleInstaller, Ibm_db2Installer, and SqliteInstaller.
DatabaseInstaller::getName | ( | ) | [abstract] |
Return the internal name, e.g.
'mysql', or 'sqlite'.
Reimplemented in MysqlInstaller, Ibm_db2Installer, OracleInstaller, PostgresInstaller, and SqliteInstaller.
Referenced by getCheckBox(), getPasswordBox(), getRadioSet(), getReadableName(), getTextBox(), and setVarsFromRequest().
DatabaseInstaller::getPasswordBox | ( | $ | var, |
$ | label, | ||
$ | attribs = array() , |
||
$ | helpData = "" |
||
) |
Get a labelled password box to configure a local variable.
Implements password hiding.
$var | string |
$label | string |
$attribs | array |
$helpData | string |
Definition at line 397 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by getInstallUserBox(), and getWebUserBox().
DatabaseInstaller::getRadioSet | ( | $ | params | ) |
Get a set of labelled radio buttons.
$params | Array: 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 443 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by MysqlInstaller\getSettingsForm().
Get the internationalised name for this DBMS.
Definition at line 317 of file DatabaseInstaller.php.
References getName(), and wfMsg().
Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files.
Reimplemented in MysqlInstaller, and OracleInstaller.
Definition at line 211 of file DatabaseInstaller.php.
Referenced by setupSchemaVars().
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.
Reimplemented in MysqlInstaller, and PostgresInstaller.
Definition at line 92 of file DatabaseInstaller.php.
DatabaseInstaller::getTextBox | ( | $ | var, |
$ | label, | ||
$ | attribs = array() , |
||
$ | helpData = "" |
||
) |
Get a labelled text box to configure a local variable.
$var | string |
$label | string |
$attribs | array |
$helpData | string |
Definition at line 371 of file DatabaseInstaller.php.
References getName(), and getVar().
Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), Ibm_db2Installer\getConnectForm(), SqliteInstaller\getConnectForm(), MysqlInstaller\getConnectForm(), getInstallUserBox(), and getWebUserBox().
DatabaseInstaller::getVar | ( | $ | var, |
$ | default = null |
||
) |
Get a variable, taking local defaults into account.
$var | string |
$default | null |
Definition at line 342 of file DatabaseInstaller.php.
References getGlobalDefaults(), and getInternalDefaults().
Referenced by MysqlInstaller\canCreateAccounts(), PostgresInstaller\canCreateObjectsForWebUser(), Ibm_db2Installer\checkPageSize(), createTables(), Ibm_db2Installer\createTables(), OracleInstaller\createTables(), PostgresInstaller\createTables(), getCheckBox(), OracleInstaller\getConnectForm(), PostgresInstaller\getInstallUserPermissions(), SqliteInstaller\getLocalSettings(), Ibm_db2Installer\getLocalSettings(), OracleInstaller\getLocalSettings(), PostgresInstaller\getLocalSettings(), MysqlInstaller\getLocalSettings(), getPasswordBox(), getRadioSet(), OracleInstaller\getSchemaVars(), MysqlInstaller\getSchemaVars(), MysqlInstaller\getSettingsForm(), MysqlInstaller\getTableOptions(), getTextBox(), getWebUserBox(), SqliteInstaller\needsUpgrade(), OracleInstaller\needsUpgrade(), Ibm_db2Installer\openConnection(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), SqliteInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), PostgresInstaller\openPgConnection(), OracleInstaller\openSYSDBAConnection(), populateInterwikiTable(), PostgresInstaller\preInstall(), MysqlInstaller\preUpgrade(), PostgresInstaller\preUpgrade(), Ibm_db2Installer\setupDatabase(), SqliteInstaller\setupDatabase(), PostgresInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), PostgresInstaller\setupUser(), PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), Ibm_db2Installer\submitConnectForm(), SqliteInstaller\submitConnectForm(), OracleInstaller\submitInstallUserBox(), PostgresInstaller\submitSettingsForm(), MysqlInstaller\submitSettingsForm(), and submitWebUserBox().
DatabaseInstaller::getWebUserBox | ( | $ | noCreateMsg = false | ) |
Get a standard web-user fieldset.
$noCreateMsg | String: Message to display instead of the creation checkbox. Set this to false to show a creation checkbox. |
Definition at line 510 of file DatabaseInstaller.php.
References Html\closeElement(), Html\element(), getCheckBox(), getPasswordBox(), getTextBox(), getVar(), Html\openElement(), wfMsg(), and wfMsgNoTrans().
Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getSettingsForm(), and MysqlInstaller\getSettingsForm().
DatabaseInstaller::isCompiled | ( | ) | [abstract] |
Reimplemented in MysqlInstaller, Ibm_db2Installer, OracleInstaller, PostgresInstaller, and SqliteInstaller.
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.
Reimplemented in OracleInstaller, and SqliteInstaller.
Definition at line 469 of file DatabaseInstaller.php.
References getConnection().
DatabaseInstaller::openConnection | ( | ) | [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 SqliteInstaller, OracleInstaller, MysqlInstaller, Ibm_db2Installer, and PostgresInstaller.
Referenced by getConnection().
DatabaseInstaller::outputHandler | ( | $ | string | ) |
Definition at line 591 of file DatabaseInstaller.php.
Common function for databases that don't understand the MySQLish syntax of interwiki.sql.
Definition at line 558 of file DatabaseInstaller.php.
References $IP, $rows, getConnection(), getVar(), Status\newFatal(), Status\newGood(), wfRestoreWarnings(), and wfSuppressWarnings().
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 MysqlInstaller, PostgresInstaller, and OracleInstaller.
Definition at line 272 of file DatabaseInstaller.php.
Allow DB installers a chance to make checks before upgrade.
Reimplemented in PostgresInstaller, and MysqlInstaller.
Definition at line 279 of file DatabaseInstaller.php.
DatabaseInstaller::setupDatabase | ( | ) | [abstract] |
Create the database and return a Status object indicating success or failure.
Reimplemented in MysqlInstaller, PostgresInstaller, OracleInstaller, SqliteInstaller, and Ibm_db2Installer.
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 221 of file DatabaseInstaller.php.
References getConnection(), and getSchemaVars().
Referenced by OracleInstaller\createTables(), doUpgrade(), Ibm_db2Installer\setupDatabase(), SqliteInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), OracleInstaller\setupUser(), and MysqlInstaller\setupUser().
DatabaseInstaller::setVar | ( | $ | name, |
$ | value | ||
) |
Convenience alias for $this->parent->setVar()
$name | string |
$value | mixed |
Definition at line 358 of file DatabaseInstaller.php.
Referenced by MysqlInstaller\getSettingsForm(), MysqlInstaller\preUpgrade(), SqliteInstaller\setupDatabase(), PostgresInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), PostgresInstaller\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.
$varNames | Array |
Definition at line 455 of file DatabaseInstaller.php.
References getName().
Referenced by PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), Ibm_db2Installer\submitConnectForm(), MysqlInstaller\submitConnectForm(), SqliteInstaller\submitConnectForm(), submitInstallUserBox(), MysqlInstaller\submitSettingsForm(), and submitWebUserBox().
DatabaseInstaller::submitConnectForm | ( | ) | [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 SqliteInstaller, MysqlInstaller, Ibm_db2Installer, OracleInstaller, and PostgresInstaller.
Submit a standard install user fieldset.
Reimplemented in OracleInstaller.
Definition at line 498 of file DatabaseInstaller.php.
References Status\newGood(), and setVarsFromRequest().
Referenced by PostgresInstaller\submitConnectForm(), Ibm_db2Installer\submitConnectForm(), and MysqlInstaller\submitConnectForm().
Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().
Reimplemented in MysqlInstaller, and PostgresInstaller.
Definition at line 102 of file DatabaseInstaller.php.
References Status\newGood().
Submit the form from getWebUserBox().
Definition at line 536 of file DatabaseInstaller.php.
References getVar(), Status\newFatal(), Status\newGood(), setVar(), and setVarsFromRequest().
Referenced by OracleInstaller\submitConnectForm(), PostgresInstaller\submitSettingsForm(), and MysqlInstaller\submitSettingsForm().
DatabaseInstaller::$db = null |
Reimplemented in SqliteInstaller.
Definition at line 31 of file DatabaseInstaller.php.
Referenced by Ibm_db2Installer\openConnection(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), and OracleInstaller\openSYSDBAConnection().
DatabaseInstaller::$globalNames = array() [protected] |
Reimplemented in SqliteInstaller, Ibm_db2Installer, MysqlInstaller, PostgresInstaller, and OracleInstaller.
Definition at line 45 of file DatabaseInstaller.php.
DatabaseInstaller::$internalDefaults = array() [protected] |
Reimplemented in MysqlInstaller, Ibm_db2Installer, OracleInstaller, and PostgresInstaller.
Definition at line 38 of file DatabaseInstaller.php.
DatabaseInstaller::$parent |
Definition at line 24 of file DatabaseInstaller.php.
Referenced by MysqlInstaller\__construct(), Ibm_db2Installer\__construct(), and __construct().