Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
DatabaseConnectForm | |
0.00% |
0 / 22 |
|
0.00% |
0 / 2 |
6 | |
0.00% |
0 / 1 |
getHtml | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
submit | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
getInstallUserBox | |
0.00% |
0 / 20 |
|
0.00% |
0 / 1 |
2 | |||
submitInstallUserBox | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Installer; |
4 | |
5 | use MediaWiki\Html\Html; |
6 | use MediaWiki\Status\Status; |
7 | |
8 | /** |
9 | * @internal |
10 | */ |
11 | abstract class DatabaseConnectForm extends DatabaseForm { |
12 | |
13 | /** |
14 | * Get HTML for a web form that configures this database. Configuration |
15 | * at this time should be the minimum needed to connect and test |
16 | * whether install or upgrade is required. |
17 | * |
18 | * If this is called, $this->parent can be assumed to be a WebInstaller. |
19 | */ |
20 | abstract public function getHtml(); |
21 | |
22 | /** |
23 | * Set variables based on the request array, assuming it was submitted |
24 | * via the form returned by getConnectForm(). Validate the connection |
25 | * settings by attempting to connect with them. |
26 | * |
27 | * If this is called, $this->parent can be assumed to be a WebInstaller. |
28 | * |
29 | * @return Status |
30 | */ |
31 | abstract public function submit(); |
32 | |
33 | /** |
34 | * Get a standard install-user fieldset. |
35 | * |
36 | * @return string |
37 | */ |
38 | protected function getInstallUserBox() { |
39 | return "<span class=\"cdx-card\"><span class=\"cdx-card__text\">" . |
40 | Html::element( |
41 | 'span', |
42 | [ 'class' => 'cdx-card__text__title' ], |
43 | wfMessage( 'config-db-install-account' )->text() |
44 | ) . |
45 | "<span class=\"cdx-card__text__description\">" . |
46 | $this->getTextBox( |
47 | '_InstallUser', |
48 | 'config-db-username', |
49 | [ 'dir' => 'ltr' ], |
50 | $this->webInstaller->getHelpBox( 'config-db-install-username' ) |
51 | ) . |
52 | $this->getPasswordBox( |
53 | '_InstallPassword', |
54 | 'config-db-password', |
55 | [ 'dir' => 'ltr' ], |
56 | $this->webInstaller->getHelpBox( 'config-db-install-password' ) |
57 | ) . |
58 | "</span></span></span>"; |
59 | } |
60 | |
61 | /** |
62 | * Submit a standard install user fieldset. |
63 | * @return Status |
64 | */ |
65 | protected function submitInstallUserBox() { |
66 | $this->setVarsFromRequest( [ '_InstallUser', '_InstallPassword' ] ); |
67 | |
68 | return Status::newGood(); |
69 | } |
70 | |
71 | } |