r69590 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69589‎ | r69590 | r69591 >
Date:09:41, 20 July 2010
Author:jeroendedauw
Status:reverted
Tags:
Comment:
Clarified field and method visibility
Modified paths:
  • /trunk/phase3/includes/installer/DatabaseInstaller.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/DatabaseInstaller.php
@@ -4,11 +4,12 @@
55 * Base class for DBMS-specific installation helper classes.
66 */
77 abstract class DatabaseInstaller {
 8+
89 /** The Installer object */
9 - var $parent;
 10+ public $parent;
1011
1112 /* Database connection */
12 - var $db;
 13+ public $db;
1314
1415 /** Internal variables for installation */
1516 protected $internalDefaults = array();
@@ -17,14 +18,14 @@
1819 protected $globalNames = array();
1920
2021 /**
21 - * Return the internal name, e.g. 'mysql', or 'sqlite'
 22+ * Return the internal name, e.g. 'mysql', or 'sqlite'.
2223 */
23 - abstract function getName();
 24+ public abstract function getName();
2425
2526 /**
26 - * @return true if the client library is compiled in
 27+ * @return true if the client library is compiled in.
2728 */
28 - abstract public function isCompiled();
 29+ public abstract function isCompiled();
2930
3031 /**
3132 * Get an array of MW configuration globals that will be configured by this class.
@@ -40,7 +41,7 @@
4142 *
4243 * If this is called, $this->parent can be assumed to be a WebInstaller
4344 */
44 - abstract function getConnectForm();
 45+ public abstract function getConnectForm();
4546
4647 /**
4748 * Set variables based on the request array, assuming it was submitted
@@ -51,7 +52,7 @@
5253 *
5354 * @return Status
5455 */
55 - abstract function submitConnectForm();
 56+ public abstract function submitConnectForm();
5657
5758 /**
5859 * Get HTML for a web form that retrieves settings used for installation.
@@ -59,14 +60,14 @@
6061 * If the DB type has no settings beyond those already configured with
6162 * getConnectForm(), this should return false.
6263 */
63 - abstract function getSettingsForm();
 64+ public abstract function getSettingsForm();
6465
6566 /**
6667 * Set variables based on the request array, assuming it was submitted via
6768 * the form return by getSettingsForm().
6869 * @return Status
6970 */
70 - abstract function submitSettingsForm();
 71+ public abstract function submitSettingsForm();
7172
7273 /**
7374 * Connect to the database using the administrative user/password currently
@@ -75,7 +76,7 @@
7677 *
7778 * This may be called multiple times, so the result should be cached.
7879 */
79 - abstract function getConnection();
 80+ public abstract function getConnection();
8081
8182 /**
8283 * Allow DB installers a chance to make last-minute changes before installation
@@ -90,13 +91,13 @@
9192 *
9293 * @return Status
9394 */
94 - abstract function setupDatabase();
 95+ public abstract function setupDatabase();
9596
9697 /**
9798 * Create database tables from scratch
9899 * @return \type Status
99100 */
100 - abstract function createTables();
 101+ public abstract function createTables();
101102
102103 /**
103104 * Perform database upgrades
@@ -111,7 +112,7 @@
112113 * override them
113114 * @return Array
114115 */
115 - function getTableOptions() {
 116+ public function getTableOptions() {
116117 return array();
117118 }
118119
@@ -119,13 +120,13 @@
120121 * Get the DBMS-specific options for LocalSettings.php generation.
121122 * @return String
122123 */
123 - abstract function getLocalSettings();
 124+ public abstract function getLocalSettings();
124125
125126 /**
126127 * Construct and initialise parent.
127128 * This is typically only called from Installer::getDBInstaller()
128129 */
129 - function __construct( $parent ) {
 130+ public function __construct( $parent ) {
130131 $this->parent = $parent;
131132 }
132133
@@ -143,7 +144,7 @@
144145 /**
145146 * Get the internationalised name for this DBMS
146147 */
147 - function getReadableName() {
 148+ public function getReadableName() {
148149 return wfMsg( 'config-type-' . $this->getName() );
149150 }
150151
@@ -151,7 +152,7 @@
152153 * Get a name=>value map of MW configuration globals that overrides
153154 * DefaultSettings.php
154155 */
155 - function getGlobalDefaults() {
 156+ public function getGlobalDefaults() {
156157 return array();
157158 }
158159
@@ -165,7 +166,7 @@
166167 /**
167168 * Get a variable, taking local defaults into account
168169 */
169 - function getVar( $var, $default = null ) {
 170+ public function getVar( $var, $default = null ) {
170171 $defaults = $this->getGlobalDefaults();
171172 $internal = $this->getInternalDefaults();
172173 if ( isset( $defaults[$var] ) ) {
@@ -179,14 +180,14 @@
180181 /**
181182 * Convenience alias for $this->parent->setVar()
182183 */
183 - function setVar( $name, $value ) {
 184+ public function setVar( $name, $value ) {
184185 $this->parent->setVar( $name, $value );
185186 }
186187
187188 /**
188189 * Get a labelled text box to configure a local variable
189190 */
190 - function getTextBox( $var, $label, $attribs = array() ) {
 191+ public function getTextBox( $var, $label, $attribs = array() ) {
191192 $name = $this->getName() . '_' . $var;
192193 $value = $this->getVar( $var );
193194 return $this->parent->getTextBox( array(
@@ -202,7 +203,7 @@
203204 * Get a labelled password box to configure a local variable
204205 * Implements password hiding
205206 */
206 - function getPasswordBox( $var, $label, $attribs = array() ) {
 207+ public function getPasswordBox( $var, $label, $attribs = array() ) {
207208 $name = $this->getName() . '_' . $var;
208209 $value = $this->getVar( $var );
209210 return $this->parent->getPasswordBox( array(
@@ -217,7 +218,7 @@
218219 /**
219220 * Get a labelled checkbox to configure a local boolean variable
220221 */
221 - function getCheckBox( $var, $label, $attribs = array() ) {
 222+ public function getCheckBox( $var, $label, $attribs = array() ) {
222223 $name = $this->getName() . '_' . $var;
223224 $value = $this->getVar( $var );
224225 return $this->parent->getCheckBox( array(
@@ -241,7 +242,7 @@
242243 * itemAttribs Array of attribute arrays, outer key is the value name (optional)
243244 *
244245 */
245 - function getRadioSet( $params ) {
 246+ public function getRadioSet( $params ) {
246247 $params['controlName'] = $this->getName() . '_' . $params['var'];
247248 $params['value'] = $this->getVar( $params['var'] );
248249 return $this->parent->getRadioSet( $params );
@@ -253,7 +254,7 @@
254255 * fake) passwords.
255256 * @param $varNames Array
256257 */
257 - function setVarsFromRequest( $varNames ) {
 258+ public function setVarsFromRequest( $varNames ) {
258259 return $this->parent->setVarsFromRequest( $varNames, $this->getName() . '_' );
259260 }
260261
@@ -267,7 +268,7 @@
268269 *
269270 * @return Boolean
270271 */
271 - function needsUpgrade() {
 272+ public function needsUpgrade() {
272273 $status = $this->getConnection();
273274 if ( !$status->isOK() ) {
274275 return false;
@@ -282,7 +283,7 @@
283284 /**
284285 * Get a standard install-user fieldset
285286 */
286 - function getInstallUserBox() {
 287+ public function getInstallUserBox() {
287288 return
288289 Xml::openElement( 'fieldset' ) .
289290 Xml::element( 'legend', array(), wfMsg( 'config-db-install-account' ) ) .
@@ -295,7 +296,7 @@
296297 /**
297298 * Submit a standard install user fieldset
298299 */
299 - function submitInstallUserBox() {
 300+ public function submitInstallUserBox() {
300301 $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) );
301302 return Status::newGood();
302303 }
@@ -305,7 +306,7 @@
306307 * @param $noCreateMsg String: Message to display instead of the creation checkbox.
307308 * Set this to false to show a creation checkbox.
308309 */
309 - function getWebUserBox( $noCreateMsg = false ) {
 310+ public function getWebUserBox( $noCreateMsg = false ) {
310311 $name = $this->getName();
311312 $s = Xml::openElement( 'fieldset' ) .
312313 Xml::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) .
@@ -330,7 +331,7 @@
331332 * Submit the form from getWebUserBox().
332333 * @return Status
333334 */
334 - function submitWebUserBox() {
 335+ public function submitWebUserBox() {
335336 $this->setVarsFromRequest( array( 'wgDBuser', 'wgDBpassword',
336337 '_SameAccount', '_CreateDBAccount' ) );
337338 if ( $this->getVar( '_SameAccount' ) ) {
@@ -373,5 +374,4 @@
374375 return Status::newGood();
375376 }
376377
377 -}
378 -
 378+}
\ No newline at end of file

Follow-up revisions

RevisionCommit summaryAuthorDate
r69598Re-did r69590jeroendedauw11:00, 20 July 2010

Status & tagging log