From: Jeroen De Dauw Date: Tue, 20 Jul 2010 11:17:36 +0000 (+0000) Subject: Doc and style improvements X-Git-Tag: 1.31.0-rc.0~36053 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;h=e98162901bf2266d4fcf8fee009e8a37873d3dbd;p=lhc%2Fweb%2Fwiklou.git Doc and style improvements --- diff --git a/includes/installer/DatabaseInstaller.php b/includes/installer/DatabaseInstaller.php index 2b5d551dff..fa16dc17e4 100644 --- a/includes/installer/DatabaseInstaller.php +++ b/includes/installer/DatabaseInstaller.php @@ -5,16 +5,34 @@ */ 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(); /** @@ -27,19 +45,12 @@ abstract class DatabaseInstaller { */ 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(); @@ -48,7 +59,7 @@ abstract class DatabaseInstaller { * 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 */ @@ -65,6 +76,7 @@ abstract class DatabaseInstaller { /** * Set variables based on the request array, assuming it was submitted via * the form return by getSettingsForm(). + * * @return Status */ public abstract function submitSettingsForm(); @@ -77,14 +89,7 @@ abstract class DatabaseInstaller { * 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. @@ -94,11 +99,19 @@ abstract class DatabaseInstaller { 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 @@ -106,22 +119,33 @@ abstract class DatabaseInstaller { /*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() @@ -131,8 +155,10 @@ abstract class DatabaseInstaller { } /** - * 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(); @@ -142,14 +168,14 @@ abstract class DatabaseInstaller { } /** - * 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() { @@ -157,14 +183,14 @@ abstract class DatabaseInstaller { } /** - * 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(); @@ -185,7 +211,7 @@ abstract class DatabaseInstaller { } /** - * 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; @@ -200,8 +226,8 @@ abstract class DatabaseInstaller { } /** - * 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; @@ -216,7 +242,7 @@ abstract class DatabaseInstaller { } /** - * 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; @@ -231,7 +257,7 @@ abstract class DatabaseInstaller { } /** - * Get a set of labelled radio buttons + * Get a set of labelled radio buttons. * * @param $params Array: * Parameters are: @@ -281,7 +307,7 @@ abstract class DatabaseInstaller { } /** - * Get a standard install-user fieldset + * Get a standard install-user fieldset. */ public function getInstallUserBox() { return @@ -294,7 +320,7 @@ abstract class DatabaseInstaller { } /** - * Submit a standard install user fieldset + * Submit a standard install user fieldset. */ public function submitInstallUserBox() { $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) ); @@ -329,20 +355,24 @@ abstract class DatabaseInstaller { /** * 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();