MediaWiki  REL1_24
DatabaseInstaller Class Reference

Base class for DBMS-specific installation helper classes. More...

Inheritance diagram for DatabaseInstaller:
Collaboration diagram for DatabaseInstaller:

List of all members.

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.
 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().

Public Attributes

DatabaseBase $db = null
 The database connection.
WebInstaller $parent
 The Installer object.

Static Protected Member Functions

static checkExtension ($name)
 Convenience function.

Protected Attributes

array $globalNames = array()
 Array of MW configuration globals this class uses.
array $internalDefaults = array()
 Internal variables for installation.

Private Member Functions

 stepApplySourceFile ($sourceFileMethod, $stepName, $archiveTableMustNotExist=false)
 Apply a SQL source file to the database as part of running an installation step.

Detailed Description

Base class for DBMS-specific installation helper classes.

Since:
1.17

Definition at line 30 of file DatabaseInstaller.php.


Constructor & Destructor Documentation

Construct and initialise parent.

This is typically only called from Installer::getDBInstaller()

Parameters:
WebInstaller$parent

Definition at line 342 of file DatabaseInstaller.php.


Member Function Documentation

static DatabaseInstaller::checkExtension ( name) [static, protected]

Convenience function.

Check if a named extension is present.

Parameters:
string$name
Returns:
bool

Definition at line 353 of file DatabaseInstaller.php.

Referenced by SqliteInstaller\isCompiled(), PostgresInstaller\isCompiled(), OracleInstaller\isCompiled(), MysqlInstaller\isCompiled(), and MssqlInstaller\isCompiled().

Checks for installation prerequisites other than those checked by isCompiled()

Since:
1.19
Returns:
Status

Reimplemented in SqliteInstaller.

Definition at line 73 of file DatabaseInstaller.php.

Create the tables for each extension the user enabled.

Returns:
Status

Definition at line 230 of file DatabaseInstaller.php.

Create database tables from scratch.

Returns:
Status

Reimplemented in MssqlInstaller, PostgresInstaller, OracleInstaller, and SqliteInstaller.

Definition at line 213 of file DatabaseInstaller.php.

Perform database upgrades.

Returns:
bool

Definition at line 295 of file DatabaseInstaller.php.

Set up LBFactory so that wfGetDB() etc.

works. We set up a special LBFactory instance which returns the current installer connection.

Definition at line 281 of file DatabaseInstaller.php.

Referenced by PostgresInstaller\createTables().

DatabaseInstaller::getCheckBox ( var,
label,
attribs = array(),
helpData = "" 
)

Get a labelled checkbox to configure a local boolean variable.

Parameters:
string$var
string$label
array$attribsOptional.
string$helpDataOptional.
Returns:
string

Definition at line 473 of file DatabaseInstaller.php.

Referenced by MssqlInstaller\getSettingsForm().

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, MssqlInstaller, 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.

Returns:
Status

Reimplemented in PostgresInstaller.

Definition at line 145 of file DatabaseInstaller.php.

Referenced by MssqlInstaller\canCreateAccounts(), MysqlInstaller\canCreateAccounts(), MysqlInstaller\getEngines(), MysqlInstaller\preUpgrade(), MssqlInstaller\preUpgrade(), MysqlInstaller\setupDatabase(), MssqlInstaller\setupDatabase(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), MssqlInstaller\setupUser(), OracleInstaller\submitConnectForm(), MysqlInstaller\submitConnectForm(), and MssqlInstaller\submitConnectForm().

Get a name=>value map of MW configuration globals that overrides.

DefaultSettings.php

Returns:
array

Reimplemented in MssqlInstaller, PostgresInstaller, MysqlInstaller, and SqliteInstaller.

Definition at line 372 of file DatabaseInstaller.php.

Get an array of MW configuration globals that will be configured by this class.

Returns:
array

Definition at line 333 of file DatabaseInstaller.php.

Get a standard install-user fieldset.

Returns:
string

Definition at line 546 of file DatabaseInstaller.php.

Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), and MysqlInstaller\getConnectForm().

Get a name=>value map of internal variables used during installation.

Returns:
array

Definition at line 380 of file DatabaseInstaller.php.

Get the DBMS-specific options for LocalSettings.php generation.

Returns:
string

Reimplemented in MssqlInstaller, MysqlInstaller, PostgresInstaller, OracleInstaller, and SqliteInstaller.

Return the internal name, e.g.

'mysql', or 'sqlite'.

Reimplemented in MssqlInstaller, MysqlInstaller, OracleInstaller, PostgresInstaller, and SqliteInstaller.

DatabaseInstaller::getPasswordBox ( var,
label,
attribs = array(),
helpData = "" 
)

Get a labelled password box to configure a local variable.

Implements password hiding.

Parameters:
string$var
string$label
array$attribs
string$helpData
Returns:
string

Definition at line 447 of file DatabaseInstaller.php.

Referenced by MssqlInstaller\getConnectForm(), and MssqlInstaller\getSettingsForm().

Get a set of labelled radio buttons.

Parameters:
array$paramsParameters 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)
Returns:
string

Definition at line 499 of file DatabaseInstaller.php.

Referenced by MssqlInstaller\getConnectForm(), MysqlInstaller\getSettingsForm(), and MssqlInstaller\getSettingsForm().

Get the internationalised name for this DBMS.

Returns:
string

Definition at line 361 of file DatabaseInstaller.php.

Override this to provide DBMS-specific schema variables, to be substituted into tables.sql and other schema files.

Returns:
array

Reimplemented in MssqlInstaller, MysqlInstaller, and OracleInstaller.

Definition at line 254 of file DatabaseInstaller.php.

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.

Returns:
bool

Reimplemented in MssqlInstaller, MysqlInstaller, and PostgresInstaller.

Definition at line 104 of file DatabaseInstaller.php.

DatabaseInstaller::getTextBox ( var,
label,
attribs = array(),
helpData = "" 
)

Get a labelled text box to configure a local variable.

Parameters:
string$var
string$label
array$attribs
string$helpData
Returns:
string

Definition at line 420 of file DatabaseInstaller.php.

Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getConnectForm(), MssqlInstaller\getConnectForm(), SqliteInstaller\getConnectForm(), MysqlInstaller\getConnectForm(), and MssqlInstaller\getSettingsForm().

DatabaseInstaller::getVar ( var,
default = null 
)

Get a variable, taking local defaults into account.

Parameters:
string$var
mixed | null$default
Returns:
mixed

Definition at line 390 of file DatabaseInstaller.php.

Referenced by MssqlInstaller\canCreateAccounts(), MysqlInstaller\canCreateAccounts(), PostgresInstaller\canCreateObjectsForWebUser(), OracleInstaller\createTables(), PostgresInstaller\createTables(), MssqlInstaller\createTables(), OracleInstaller\getConnectForm(), MssqlInstaller\getConnectForm(), PostgresInstaller\getInstallUserPermissions(), OracleInstaller\getLocalSettings(), PostgresInstaller\getLocalSettings(), MysqlInstaller\getLocalSettings(), MssqlInstaller\getLocalSettings(), OracleInstaller\getSchemaVars(), MysqlInstaller\getSchemaVars(), MssqlInstaller\getSchemaVars(), MysqlInstaller\getSettingsForm(), MssqlInstaller\getSettingsForm(), MysqlInstaller\getTableOptions(), OracleInstaller\needsUpgrade(), MysqlInstaller\openConnection(), OracleInstaller\openConnection(), MssqlInstaller\openConnection(), PostgresInstaller\openConnectionToAnyDB(), PostgresInstaller\openConnectionWithParams(), PostgresInstaller\openPgConnection(), OracleInstaller\openSYSDBAConnection(), PostgresInstaller\preInstall(), MysqlInstaller\preUpgrade(), MssqlInstaller\preUpgrade(), PostgresInstaller\preUpgrade(), PostgresInstaller\setupDatabase(), MysqlInstaller\setupDatabase(), MssqlInstaller\setupDatabase(), PostgresInstaller\setupPLpgSQL(), PostgresInstaller\setupSchema(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), MssqlInstaller\setupUser(), PostgresInstaller\setupUser(), PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), OracleInstaller\submitInstallUserBox(), PostgresInstaller\submitSettingsForm(), MssqlInstaller\submitSettingsForm(), and MysqlInstaller\submitSettingsForm().

Get a standard web-user fieldset.

Parameters:
string | bool$noCreateMsgMessage to display instead of the creation checkbox. Set this to false to show a creation checkbox (default).
Returns:
string

Definition at line 581 of file DatabaseInstaller.php.

Referenced by OracleInstaller\getConnectForm(), PostgresInstaller\getSettingsForm(), and MysqlInstaller\getSettingsForm().

Insert update keys into table to prevent running unneded updates.

Returns:
Status

Definition at line 222 of file DatabaseInstaller.php.

Returns:
bool Returns true if the client library is compiled in.

Reimplemented in MssqlInstaller, MysqlInstaller, 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.

Returns:
bool

Reimplemented in OracleInstaller, and SqliteInstaller.

Definition at line 527 of file DatabaseInstaller.php.

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.

Returns:
Status

Reimplemented in MssqlInstaller, SqliteInstaller, OracleInstaller, MysqlInstaller, and PostgresInstaller.

Definition at line 667 of file DatabaseInstaller.php.

Common function for databases that don't understand the MySQLish syntax of interwiki.sql.

Returns:
Status

Definition at line 630 of file DatabaseInstaller.php.

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 MssqlInstaller, MysqlInstaller, PostgresInstaller, and OracleInstaller.

Definition at line 320 of file DatabaseInstaller.php.

Allow DB installers a chance to make checks before upgrade.

Reimplemented in PostgresInstaller, MssqlInstaller, and MysqlInstaller.

Definition at line 326 of file DatabaseInstaller.php.

Create the database and return a Status object indicating success or failure.

Returns:
Status

Reimplemented in MssqlInstaller, MysqlInstaller, PostgresInstaller, OracleInstaller, and SqliteInstaller.

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 264 of file DatabaseInstaller.php.

Referenced by OracleInstaller\createTables(), MysqlInstaller\setupDatabase(), MssqlInstaller\setupDatabase(), OracleInstaller\setupUser(), MysqlInstaller\setupUser(), and MssqlInstaller\setupUser().

Convenience function to set variables based on form data.

Assumes that variables containing "password" in the name are (potentially fake) passwords.

Parameters:
array$varNames
Returns:
array

Definition at line 513 of file DatabaseInstaller.php.

Referenced by PostgresInstaller\submitConnectForm(), OracleInstaller\submitConnectForm(), MysqlInstaller\submitConnectForm(), MssqlInstaller\submitConnectForm(), MssqlInstaller\submitSettingsForm(), and MysqlInstaller\submitSettingsForm().

DatabaseInstaller::stepApplySourceFile ( sourceFileMethod,
stepName,
archiveTableMustNotExist = false 
) [private]

Apply a SQL source file to the database as part of running an installation step.

Parameters:
string$sourceFileMethod
string$stepName
string$archiveTableMustNotExist
Returns:
Status

Definition at line 169 of file DatabaseInstaller.php.

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.

Returns:
Status

Reimplemented in MssqlInstaller, SqliteInstaller, MysqlInstaller, OracleInstaller, and PostgresInstaller.

Submit a standard install user fieldset.

Returns:
Status

Reimplemented in OracleInstaller.

Definition at line 568 of file DatabaseInstaller.php.

Referenced by PostgresInstaller\submitConnectForm(), and MysqlInstaller\submitConnectForm().

Set variables based on the request array, assuming it was submitted via the form return by getSettingsForm().

Returns:
Status

Reimplemented in MysqlInstaller, MssqlInstaller, and PostgresInstaller.

Definition at line 114 of file DatabaseInstaller.php.


Member Data Documentation

array DatabaseInstaller::$globalNames = array() [protected]

Array of MW configuration globals this class uses.

Reimplemented in MssqlInstaller, MysqlInstaller, SqliteInstaller, PostgresInstaller, and OracleInstaller.

Definition at line 56 of file DatabaseInstaller.php.

array DatabaseInstaller::$internalDefaults = array() [protected]

Internal variables for installation.

Reimplemented in MssqlInstaller, MysqlInstaller, OracleInstaller, and PostgresInstaller.

Definition at line 50 of file DatabaseInstaller.php.

WebInstaller DatabaseInstaller::$parent

The Installer object.

Todo:
Naming this parent is confusing, 'installer' would be clearer.

Definition at line 38 of file DatabaseInstaller.php.


The documentation for this class was generated from the following file: