*/
abstract class DatabaseInstaller {
- /** The Installer object */
+ /**
+ * The Installer object.
+ *
+ * TODO: naming this parent is confusing, 'installer' would be clearer.
+ *
+ * @var Installer
+ */
public $parent;
- /* Database connection */
+ /**
+ * The database connection.
+ *
+ * @var DatabaseBase
+ */
public $db;
- /** Internal variables for installation */
+ /**
+ * Internal variables for installation.
+ *
+ * @var array
+ */
protected $internalDefaults = array();
- /** Array of MW configuration globals this class uses */
+ /**
+ * Array of MW configuration globals this class uses.
+ *
+ * @var array
+ */
protected $globalNames = array();
/**
*/
public abstract function isCompiled();
- /**
- * Get an array of MW configuration globals that will be configured by this class.
- */
- public function getGlobalNames() {
- return $this->globalNames;
- }
-
/**
* 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
+ * If this is called, $this->parent can be assumed to be a WebInstaller.
*/
public abstract function getConnectForm();
* 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
+ * If this is called, $this->parent can be assumed to be a WebInstaller.
*
* @return Status
*/
/**
* Set variables based on the request array, assuming it was submitted via
* the form return by getSettingsForm().
+ *
* @return Status
*/
public abstract function submitSettingsForm();
* This may be called multiple times, so the result should be cached.
*/
public abstract function getConnection();
-
- /**
- * 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 :)
- */
- public function preInstall() {}
-
+
/**
* Create the database and return a Status object indicating success or
* failure.
public abstract function setupDatabase();
/**
- * Create database tables from scratch
+ * Create database tables from scratch.
+ *
* @return \type Status
*/
public abstract function createTables();
+ /**
+ * Get the DBMS-specific options for LocalSettings.php generation.
+ *
+ * @return String
+ */
+ public abstract function getLocalSettings();
+
/**
* Perform database upgrades
* @todo make abstract
/*abstract*/ function doUpgrade() {
return false;
}
+
+ /**
+ * 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 :)
+ */
+ public function preInstall() {
+
+ }
+
+ /**
+ * Get an array of MW configuration globals that will be configured by this class.
+ */
+ public function getGlobalNames() {
+ return $this->globalNames;
+ }
/**
* Return any table options to be applied to all tables that don't
- * override them
+ * override them.
+ *
* @return Array
*/
public function getTableOptions() {
return array();
}
- /**
- * Get the DBMS-specific options for LocalSettings.php generation.
- * @return String
- */
- public abstract function getLocalSettings();
-
/**
* Construct and initialise parent.
* This is typically only called from Installer::getDBInstaller()
}
/**
- * Convenience function
- * Check if a named extension is present
+ * Convenience function.
+ * Check if a named extension is present.
+ *
+ * @see wfDl
*/
protected static function checkExtension( $name ) {
wfSuppressWarnings();
}
/**
- * Get the internationalised name for this DBMS
+ * Get the internationalised name for this DBMS.
*/
public function getReadableName() {
return wfMsg( 'config-type-' . $this->getName() );
}
/**
- * Get a name=>value map of MW configuration globals that overrides
+ * Get a name=>value map of MW configuration globals that overrides.
* DefaultSettings.php
*/
public function getGlobalDefaults() {
}
/**
- * Get a name=>value map of internal variables used during installation
+ * Get a name=>value map of internal variables used during installation.
*/
public function getInternalDefaults() {
return $this->internalDefaults;
}
/**
- * Get a variable, taking local defaults into account
+ * Get a variable, taking local defaults into account.
*/
public function getVar( $var, $default = null ) {
$defaults = $this->getGlobalDefaults();
}
/**
- * Get a labelled text box to configure a local variable
+ * Get a labelled text box to configure a local variable.
*/
public function getTextBox( $var, $label, $attribs = array() ) {
$name = $this->getName() . '_' . $var;
}
/**
- * Get a labelled password box to configure a local variable
- * Implements password hiding
+ * Get a labelled password box to configure a local variable.
+ * Implements password hiding.
*/
public function getPasswordBox( $var, $label, $attribs = array() ) {
$name = $this->getName() . '_' . $var;
}
/**
- * Get a labelled checkbox to configure a local boolean variable
+ * Get a labelled checkbox to configure a local boolean variable.
*/
public function getCheckBox( $var, $label, $attribs = array() ) {
$name = $this->getName() . '_' . $var;
}
/**
- * Get a set of labelled radio buttons
+ * Get a set of labelled radio buttons.
*
* @param $params Array:
* Parameters are:
}
/**
- * Get a standard install-user fieldset
+ * Get a standard install-user fieldset.
*/
public function getInstallUserBox() {
return
}
/**
- * Submit a standard install user fieldset
+ * Submit a standard install user fieldset.
*/
public function submitInstallUserBox() {
$this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) );
/**
* Submit the form from getWebUserBox().
+ *
* @return Status
*/
public function submitWebUserBox() {
- $this->setVarsFromRequest( array( 'wgDBuser', 'wgDBpassword',
- '_SameAccount', '_CreateDBAccount' ) );
+ $this->setVarsFromRequest(
+ array( 'wgDBuser', 'wgDBpassword', '_SameAccount', '_CreateDBAccount' )
+ );
+
if ( $this->getVar( '_SameAccount' ) ) {
$this->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );
$this->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
}
+
return Status::newGood();
}
/**
- * Common function for databases that don't understand the MySQLish syntax of interwiki.sql
+ * Common function for databases that don't understand the MySQLish syntax of interwiki.sql.
*/
public function populateInterwikiTable() {
$status = $this->getConnection();