Re-did r69590
authorJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 20 Jul 2010 11:00:51 +0000 (11:00 +0000)
committerJeroen De Dauw <jeroendedauw@users.mediawiki.org>
Tue, 20 Jul 2010 11:00:51 +0000 (11:00 +0000)
includes/installer/DatabaseInstaller.php

index 45ad9ab..2b5d551 100644 (file)
@@ -4,11 +4,12 @@
  * Base class for DBMS-specific installation helper classes.
  */
 abstract class DatabaseInstaller {
+       
        /** The Installer object */
-       var $parent;
+       public $parent;
 
        /* Database connection */
-       var $db;
+       public $db;
 
        /** Internal variables for installation */
        protected $internalDefaults = array();
@@ -17,14 +18,14 @@ abstract class DatabaseInstaller {
        protected $globalNames = array();
 
        /**
-        * Return the internal name, e.g. 'mysql', or 'sqlite'
+        * Return the internal name, e.g. 'mysql', or 'sqlite'.
         */
-       abstract function getName();
+       public abstract function getName();
 
        /**
-        * @return true if the client library is compiled in
+        * @return true if the client library is compiled in.
         */
-       abstract public function isCompiled();
+       public abstract function isCompiled();
 
        /**
         * Get an array of MW configuration globals that will be configured by this class.
@@ -40,7 +41,7 @@ abstract class DatabaseInstaller {
         *
         * If this is called, $this->parent can be assumed to be a WebInstaller
         */
-       abstract function getConnectForm();
+       public abstract function getConnectForm();
 
        /**
         * Set variables based on the request array, assuming it was submitted
@@ -51,7 +52,7 @@ abstract class DatabaseInstaller {
         *
         * @return Status
         */
-       abstract function submitConnectForm();
+       public abstract function submitConnectForm();
 
        /**
         * Get HTML for a web form that retrieves settings used for installation.
@@ -59,14 +60,14 @@ abstract class DatabaseInstaller {
         * If the DB type has no settings beyond those already configured with 
         * getConnectForm(), this should return false.
         */
-       abstract function getSettingsForm();
+       public abstract function getSettingsForm();
 
        /**
         * Set variables based on the request array, assuming it was submitted via
         * the form return by getSettingsForm().
         * @return Status
         */
-       abstract function submitSettingsForm();
+       public abstract function submitSettingsForm();
 
        /**
         * Connect to the database using the administrative user/password currently
@@ -75,7 +76,7 @@ abstract class DatabaseInstaller {
         *
         * This may be called multiple times, so the result should be cached.
         */
-       abstract function getConnection();
+       public abstract function getConnection();
 
        /**
         * Allow DB installers a chance to make last-minute changes before installation
@@ -90,13 +91,13 @@ abstract class DatabaseInstaller {
         *
         * @return Status
         */
-       abstract function setupDatabase();
+       public abstract function setupDatabase();
 
        /**
         * Create database tables from scratch
         * @return \type Status
         */
-       abstract function createTables();
+       public abstract function createTables();
 
        /**
         * Perform database upgrades
@@ -111,7 +112,7 @@ abstract class DatabaseInstaller {
         * override them
         * @return Array
         */
-       function getTableOptions() {
+       public function getTableOptions() {
                return array();
        }
 
@@ -119,13 +120,13 @@ abstract class DatabaseInstaller {
         * Get the DBMS-specific options for LocalSettings.php generation.
         * @return String
         */
-       abstract function getLocalSettings();
+       public abstract function getLocalSettings();
 
        /** 
         * Construct and initialise parent.
         * This is typically only called from Installer::getDBInstaller()
         */
-       function __construct( $parent ) {
+       public function __construct( $parent ) {
                $this->parent = $parent;
        }
 
@@ -143,7 +144,7 @@ abstract class DatabaseInstaller {
        /**
         * Get the internationalised name for this DBMS
         */
-       function getReadableName() {
+       public function getReadableName() {
                return wfMsg( 'config-type-' . $this->getName() );
        }
        
@@ -151,7 +152,7 @@ abstract class DatabaseInstaller {
         * Get a name=>value map of MW configuration globals that overrides
         * DefaultSettings.php
         */
-       function getGlobalDefaults() {
+       public function getGlobalDefaults() {
                return array();
        }
 
@@ -165,7 +166,7 @@ abstract class DatabaseInstaller {
        /**
         * Get a variable, taking local defaults into account
         */
-       function getVar( $var, $default = null ) {
+       public function getVar( $var, $default = null ) {
                $defaults = $this->getGlobalDefaults();
                $internal = $this->getInternalDefaults();
                if ( isset( $defaults[$var] ) ) {
@@ -179,14 +180,14 @@ abstract class DatabaseInstaller {
        /**
         * Convenience alias for $this->parent->setVar()
         */
-       function setVar( $name, $value ) {
+       public function setVar( $name, $value ) {
                $this->parent->setVar( $name, $value );
        }
 
        /**
         * Get a labelled text box to configure a local variable
         */
-       function getTextBox( $var, $label, $attribs = array() ) {
+       public function getTextBox( $var, $label, $attribs = array() ) {
                $name = $this->getName() . '_' . $var;
                $value = $this->getVar( $var );
                return $this->parent->getTextBox( array(
@@ -202,7 +203,7 @@ abstract class DatabaseInstaller {
         * Get a labelled password box to configure a local variable
         * Implements password hiding
         */
-       function getPasswordBox( $var, $label, $attribs = array() ) {
+       public function getPasswordBox( $var, $label, $attribs = array() ) {
                $name = $this->getName() . '_' . $var;
                $value = $this->getVar( $var );
                return $this->parent->getPasswordBox( array(
@@ -217,7 +218,7 @@ abstract class DatabaseInstaller {
        /**
         * Get a labelled checkbox to configure a local boolean variable
         */
-       function getCheckBox( $var, $label, $attribs = array() ) {
+       public function getCheckBox( $var, $label, $attribs = array() ) {
                $name = $this->getName() . '_' . $var;
                $value = $this->getVar( $var );
                return $this->parent->getCheckBox( array(
@@ -241,7 +242,7 @@ abstract class DatabaseInstaller {
         *      itemAttribs     Array of attribute arrays, outer key is the value name (optional)
         *
         */
-       function getRadioSet( $params ) {
+       public function getRadioSet( $params ) {
                $params['controlName'] = $this->getName() . '_' . $params['var'];
                $params['value'] = $this->getVar( $params['var'] );
                return $this->parent->getRadioSet( $params );
@@ -253,7 +254,7 @@ abstract class DatabaseInstaller {
         * fake) passwords.
         * @param $varNames Array
         */
-       function setVarsFromRequest( $varNames ) {
+       public function setVarsFromRequest( $varNames ) {
                return $this->parent->setVarsFromRequest( $varNames, $this->getName() . '_' );
        }
 
@@ -267,7 +268,7 @@ abstract class DatabaseInstaller {
         *
         * @return Boolean
         */
-       function needsUpgrade() {
+       public function needsUpgrade() {
                $status = $this->getConnection();
                if ( !$status->isOK() ) {
                        return false;
@@ -282,7 +283,7 @@ abstract class DatabaseInstaller {
        /**
         * Get a standard install-user fieldset
         */
-       function getInstallUserBox() {
+       public function getInstallUserBox() {
                return
                        Xml::openElement( 'fieldset' ) .
                        Xml::element( 'legend', array(), wfMsg( 'config-db-install-account' ) ) .
@@ -295,7 +296,7 @@ abstract class DatabaseInstaller {
        /**
         * Submit a standard install user fieldset
         */
-       function submitInstallUserBox() {
+       public function submitInstallUserBox() {
                $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) );
                return Status::newGood();
        }
@@ -305,7 +306,7 @@ abstract class DatabaseInstaller {
         * @param $noCreateMsg String: Message to display instead of the creation checkbox.
         *   Set this to false to show a creation checkbox.
         */
-       function getWebUserBox( $noCreateMsg = false ) {
+       public function getWebUserBox( $noCreateMsg = false ) {
                $name = $this->getName();
                $s = Xml::openElement( 'fieldset' ) .
                        Xml::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
@@ -330,7 +331,7 @@ abstract class DatabaseInstaller {
         * Submit the form from getWebUserBox().
         * @return Status
         */
-       function submitWebUserBox() {
+       public function submitWebUserBox() {
                $this->setVarsFromRequest( array( 'wgDBuser', 'wgDBpassword', 
                        '_SameAccount', '_CreateDBAccount' ) );
                if ( $this->getVar( '_SameAccount' ) ) {
@@ -373,5 +374,4 @@ abstract class DatabaseInstaller {
                return Status::newGood();
        }
 
-}
-
+}
\ No newline at end of file