1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
<?php
namespace MediaWiki\Installer;
use MediaWiki\Html\Html;
use MediaWiki\Status\Status;
/**
* @internal
*/
abstract class DatabaseConnectForm extends DatabaseForm {
/**
* 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.
*/
abstract public function getHtml();
/**
* Set variables based on the request array, assuming it was submitted
* 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.
*
* @return Status
*/
abstract public function submit();
/**
* Get a standard install-user fieldset.
*
* @return string
*/
protected function getInstallUserBox() {
return "<span class=\"cdx-card\"><span class=\"cdx-card__text\">" .
Html::element(
'span',
[ 'class' => 'cdx-card__text__title' ],
wfMessage( 'config-db-install-account' )->text()
) .
"<span class=\"cdx-card__text__description\">" .
$this->getTextBox(
'_InstallUser',
'config-db-username',
[ 'dir' => 'ltr' ],
$this->webInstaller->getHelpBox( 'config-db-install-username' )
) .
$this->getPasswordBox(
'_InstallPassword',
'config-db-password',
[ 'dir' => 'ltr' ],
$this->webInstaller->getHelpBox( 'config-db-install-password' )
) .
"</span></span></span>";
}
/**
* Submit a standard install user fieldset.
* @return Status
*/
protected function submitInstallUserBox() {
$this->setVarsFromRequest( [ '_InstallUser', '_InstallPassword' ] );
return Status::newGood();
}
}
|