Index: trunk/phase3/includes/installer/DatabaseInstaller.php |
— | — | @@ -4,11 +4,12 @@ |
5 | 5 | * Base class for DBMS-specific installation helper classes. |
6 | 6 | */ |
7 | 7 | abstract class DatabaseInstaller { |
| 8 | + |
8 | 9 | /** The Installer object */ |
9 | | - var $parent; |
| 10 | + public $parent; |
10 | 11 | |
11 | 12 | /* Database connection */ |
12 | | - var $db; |
| 13 | + public $db; |
13 | 14 | |
14 | 15 | /** Internal variables for installation */ |
15 | 16 | protected $internalDefaults = array(); |
— | — | @@ -17,14 +18,14 @@ |
18 | 19 | protected $globalNames = array(); |
19 | 20 | |
20 | 21 | /** |
21 | | - * Return the internal name, e.g. 'mysql', or 'sqlite' |
| 22 | + * Return the internal name, e.g. 'mysql', or 'sqlite'. |
22 | 23 | */ |
23 | | - abstract function getName(); |
| 24 | + public abstract function getName(); |
24 | 25 | |
25 | 26 | /** |
26 | | - * @return true if the client library is compiled in |
| 27 | + * @return true if the client library is compiled in. |
27 | 28 | */ |
28 | | - abstract public function isCompiled(); |
| 29 | + public abstract function isCompiled(); |
29 | 30 | |
30 | 31 | /** |
31 | 32 | * Get an array of MW configuration globals that will be configured by this class. |
— | — | @@ -40,7 +41,7 @@ |
41 | 42 | * |
42 | 43 | * If this is called, $this->parent can be assumed to be a WebInstaller |
43 | 44 | */ |
44 | | - abstract function getConnectForm(); |
| 45 | + public abstract function getConnectForm(); |
45 | 46 | |
46 | 47 | /** |
47 | 48 | * Set variables based on the request array, assuming it was submitted |
— | — | @@ -51,7 +52,7 @@ |
52 | 53 | * |
53 | 54 | * @return Status |
54 | 55 | */ |
55 | | - abstract function submitConnectForm(); |
| 56 | + public abstract function submitConnectForm(); |
56 | 57 | |
57 | 58 | /** |
58 | 59 | * Get HTML for a web form that retrieves settings used for installation. |
— | — | @@ -59,14 +60,14 @@ |
60 | 61 | * If the DB type has no settings beyond those already configured with |
61 | 62 | * getConnectForm(), this should return false. |
62 | 63 | */ |
63 | | - abstract function getSettingsForm(); |
| 64 | + public abstract function getSettingsForm(); |
64 | 65 | |
65 | 66 | /** |
66 | 67 | * Set variables based on the request array, assuming it was submitted via |
67 | 68 | * the form return by getSettingsForm(). |
68 | 69 | * @return Status |
69 | 70 | */ |
70 | | - abstract function submitSettingsForm(); |
| 71 | + public abstract function submitSettingsForm(); |
71 | 72 | |
72 | 73 | /** |
73 | 74 | * Connect to the database using the administrative user/password currently |
— | — | @@ -75,7 +76,7 @@ |
76 | 77 | * |
77 | 78 | * This may be called multiple times, so the result should be cached. |
78 | 79 | */ |
79 | | - abstract function getConnection(); |
| 80 | + public abstract function getConnection(); |
80 | 81 | |
81 | 82 | /** |
82 | 83 | * Allow DB installers a chance to make last-minute changes before installation |
— | — | @@ -90,13 +91,13 @@ |
91 | 92 | * |
92 | 93 | * @return Status |
93 | 94 | */ |
94 | | - abstract function setupDatabase(); |
| 95 | + public abstract function setupDatabase(); |
95 | 96 | |
96 | 97 | /** |
97 | 98 | * Create database tables from scratch |
98 | 99 | * @return \type Status |
99 | 100 | */ |
100 | | - abstract function createTables(); |
| 101 | + public abstract function createTables(); |
101 | 102 | |
102 | 103 | /** |
103 | 104 | * Perform database upgrades |
— | — | @@ -111,7 +112,7 @@ |
112 | 113 | * override them |
113 | 114 | * @return Array |
114 | 115 | */ |
115 | | - function getTableOptions() { |
| 116 | + public function getTableOptions() { |
116 | 117 | return array(); |
117 | 118 | } |
118 | 119 | |
— | — | @@ -119,13 +120,13 @@ |
120 | 121 | * Get the DBMS-specific options for LocalSettings.php generation. |
121 | 122 | * @return String |
122 | 123 | */ |
123 | | - abstract function getLocalSettings(); |
| 124 | + public abstract function getLocalSettings(); |
124 | 125 | |
125 | 126 | /** |
126 | 127 | * Construct and initialise parent. |
127 | 128 | * This is typically only called from Installer::getDBInstaller() |
128 | 129 | */ |
129 | | - function __construct( $parent ) { |
| 130 | + public function __construct( $parent ) { |
130 | 131 | $this->parent = $parent; |
131 | 132 | } |
132 | 133 | |
— | — | @@ -143,7 +144,7 @@ |
144 | 145 | /** |
145 | 146 | * Get the internationalised name for this DBMS |
146 | 147 | */ |
147 | | - function getReadableName() { |
| 148 | + public function getReadableName() { |
148 | 149 | return wfMsg( 'config-type-' . $this->getName() ); |
149 | 150 | } |
150 | 151 | |
— | — | @@ -151,7 +152,7 @@ |
152 | 153 | * Get a name=>value map of MW configuration globals that overrides |
153 | 154 | * DefaultSettings.php |
154 | 155 | */ |
155 | | - function getGlobalDefaults() { |
| 156 | + public function getGlobalDefaults() { |
156 | 157 | return array(); |
157 | 158 | } |
158 | 159 | |
— | — | @@ -165,7 +166,7 @@ |
166 | 167 | /** |
167 | 168 | * Get a variable, taking local defaults into account |
168 | 169 | */ |
169 | | - function getVar( $var, $default = null ) { |
| 170 | + public function getVar( $var, $default = null ) { |
170 | 171 | $defaults = $this->getGlobalDefaults(); |
171 | 172 | $internal = $this->getInternalDefaults(); |
172 | 173 | if ( isset( $defaults[$var] ) ) { |
— | — | @@ -179,14 +180,14 @@ |
180 | 181 | /** |
181 | 182 | * Convenience alias for $this->parent->setVar() |
182 | 183 | */ |
183 | | - function setVar( $name, $value ) { |
| 184 | + public function setVar( $name, $value ) { |
184 | 185 | $this->parent->setVar( $name, $value ); |
185 | 186 | } |
186 | 187 | |
187 | 188 | /** |
188 | 189 | * Get a labelled text box to configure a local variable |
189 | 190 | */ |
190 | | - function getTextBox( $var, $label, $attribs = array() ) { |
| 191 | + public function getTextBox( $var, $label, $attribs = array() ) { |
191 | 192 | $name = $this->getName() . '_' . $var; |
192 | 193 | $value = $this->getVar( $var ); |
193 | 194 | return $this->parent->getTextBox( array( |
— | — | @@ -202,7 +203,7 @@ |
203 | 204 | * Get a labelled password box to configure a local variable |
204 | 205 | * Implements password hiding |
205 | 206 | */ |
206 | | - function getPasswordBox( $var, $label, $attribs = array() ) { |
| 207 | + public function getPasswordBox( $var, $label, $attribs = array() ) { |
207 | 208 | $name = $this->getName() . '_' . $var; |
208 | 209 | $value = $this->getVar( $var ); |
209 | 210 | return $this->parent->getPasswordBox( array( |
— | — | @@ -217,7 +218,7 @@ |
218 | 219 | /** |
219 | 220 | * Get a labelled checkbox to configure a local boolean variable |
220 | 221 | */ |
221 | | - function getCheckBox( $var, $label, $attribs = array() ) { |
| 222 | + public function getCheckBox( $var, $label, $attribs = array() ) { |
222 | 223 | $name = $this->getName() . '_' . $var; |
223 | 224 | $value = $this->getVar( $var ); |
224 | 225 | return $this->parent->getCheckBox( array( |
— | — | @@ -241,7 +242,7 @@ |
242 | 243 | * itemAttribs Array of attribute arrays, outer key is the value name (optional) |
243 | 244 | * |
244 | 245 | */ |
245 | | - function getRadioSet( $params ) { |
| 246 | + public function getRadioSet( $params ) { |
246 | 247 | $params['controlName'] = $this->getName() . '_' . $params['var']; |
247 | 248 | $params['value'] = $this->getVar( $params['var'] ); |
248 | 249 | return $this->parent->getRadioSet( $params ); |
— | — | @@ -253,7 +254,7 @@ |
254 | 255 | * fake) passwords. |
255 | 256 | * @param $varNames Array |
256 | 257 | */ |
257 | | - function setVarsFromRequest( $varNames ) { |
| 258 | + public function setVarsFromRequest( $varNames ) { |
258 | 259 | return $this->parent->setVarsFromRequest( $varNames, $this->getName() . '_' ); |
259 | 260 | } |
260 | 261 | |
— | — | @@ -267,7 +268,7 @@ |
268 | 269 | * |
269 | 270 | * @return Boolean |
270 | 271 | */ |
271 | | - function needsUpgrade() { |
| 272 | + public function needsUpgrade() { |
272 | 273 | $status = $this->getConnection(); |
273 | 274 | if ( !$status->isOK() ) { |
274 | 275 | return false; |
— | — | @@ -282,7 +283,7 @@ |
283 | 284 | /** |
284 | 285 | * Get a standard install-user fieldset |
285 | 286 | */ |
286 | | - function getInstallUserBox() { |
| 287 | + public function getInstallUserBox() { |
287 | 288 | return |
288 | 289 | Xml::openElement( 'fieldset' ) . |
289 | 290 | Xml::element( 'legend', array(), wfMsg( 'config-db-install-account' ) ) . |
— | — | @@ -295,7 +296,7 @@ |
296 | 297 | /** |
297 | 298 | * Submit a standard install user fieldset |
298 | 299 | */ |
299 | | - function submitInstallUserBox() { |
| 300 | + public function submitInstallUserBox() { |
300 | 301 | $this->setVarsFromRequest( array( '_InstallUser', '_InstallPassword' ) ); |
301 | 302 | return Status::newGood(); |
302 | 303 | } |
— | — | @@ -305,7 +306,7 @@ |
306 | 307 | * @param $noCreateMsg String: Message to display instead of the creation checkbox. |
307 | 308 | * Set this to false to show a creation checkbox. |
308 | 309 | */ |
309 | | - function getWebUserBox( $noCreateMsg = false ) { |
| 310 | + public function getWebUserBox( $noCreateMsg = false ) { |
310 | 311 | $name = $this->getName(); |
311 | 312 | $s = Xml::openElement( 'fieldset' ) . |
312 | 313 | Xml::element( 'legend', array(), wfMsg( 'config-db-web-account' ) ) . |
— | — | @@ -330,7 +331,7 @@ |
331 | 332 | * Submit the form from getWebUserBox(). |
332 | 333 | * @return Status |
333 | 334 | */ |
334 | | - function submitWebUserBox() { |
| 335 | + public function submitWebUserBox() { |
335 | 336 | $this->setVarsFromRequest( array( 'wgDBuser', 'wgDBpassword', |
336 | 337 | '_SameAccount', '_CreateDBAccount' ) ); |
337 | 338 | if ( $this->getVar( '_SameAccount' ) ) { |
— | — | @@ -373,5 +374,4 @@ |
374 | 375 | return Status::newGood(); |
375 | 376 | } |
376 | 377 | |
377 | | -} |
378 | | - |
| 378 | +} |
\ No newline at end of file |