37 $r = $this->parent->request;
38 if ( $r->wasPosted() && $this->submit() ) {
48 if ( $this->
getVar(
'wgSitename' ) ==
'MediaWiki' ) {
49 $this->
setVar(
'wgSitename',
'' );
54 $metaNS = $this->
getVar(
'wgMetaNamespace' );
57 wfMessage(
'config-ns-other-default' )->inContentLanguage()->text()
63 MainConfigNames::DBtype => $this->
getVar(
'wgDBtype' ),
65 $pingbackInfo = Pingback::getSystemInfo( $pingbackConf );
68 $this->parent->getTextBox( [
69 'var' =>
'wgSitename',
70 'label' =>
'config-site-name',
71 'help' => $this->parent->getHelpBox(
'config-site-name-help' )
76 $this->parent->getRadioSet( [
77 'var' =>
'_NamespaceType',
78 'label' =>
'config-project-namespace',
79 'itemLabelPrefix' =>
'config-ns-',
80 'values' => [
'site-name',
'generic',
'other' ],
81 'commonAttribs' => [
'class' =>
'enableForOther',
82 'rel' =>
'config_wgMetaNamespace' ],
83 'help' => $this->parent->getHelpBox(
'config-project-namespace-help' )
85 $this->parent->getTextBox( [
86 'var' =>
'wgMetaNamespace',
88 'attribs' => [
'class' =>
'enabledByOther' ]
90 $this->getFieldsetStart(
'config-admin-box' ) .
91 $this->parent->getTextBox( [
92 'var' =>
'_AdminName',
93 'label' =>
'config-admin-name',
94 'help' => $this->parent->getHelpBox(
'config-admin-help' )
96 $this->parent->getPasswordBox( [
97 'var' =>
'_AdminPassword',
98 'label' =>
'config-admin-password',
100 $this->parent->getPasswordBox( [
101 'var' =>
'_AdminPasswordConfirm',
102 'label' =>
'config-admin-password-confirm'
104 $this->parent->getTextBox( [
105 'var' =>
'_AdminEmail',
109 'label' =>
'config-admin-email',
110 'help' => $this->parent->getHelpBox(
'config-admin-email-help' )
112 $this->parent->getCheckBox( [
113 'var' =>
'_Subscribe',
114 'label' =>
'config-subscribe',
115 'help' => $this->parent->getHelpBox(
'config-subscribe-help' )
117 $this->parent->getCheckBox( [
118 'var' =>
'wgPingback',
119 'label' =>
'config-pingback',
120 'help' => $this->parent->getHelpBox(
121 'config-pingback-help',
126 $this->getFieldsetEnd() .
127 $this->parent->getInfoBox(
wfMessage(
'config-almost-done' )->plain() ) .
131 $this->parent->getRadioSet( [
132 'var' =>
'_SkipOptional',
133 'itemLabelPrefix' =>
'config-optional-',
134 'values' => [
'continue',
'skip' ]
139 $this->
setVar(
'wgMetaNamespace', $metaNS );
153 $this->parent->setVarsFromRequest( [
'wgSitename',
'_NamespaceType',
154 '_AdminName',
'_AdminPassword',
'_AdminPasswordConfirm',
'_AdminEmail',
155 '_Subscribe',
'_SkipOptional',
'wgMetaNamespace',
'wgPingback' ] );
158 if ( strval( $this->
getVar(
'wgSitename' ) ) ===
'' ) {
159 $this->parent->showError(
'config-site-name-blank' );
164 $nsType = $this->
getVar(
'_NamespaceType' );
165 if ( $nsType ==
'site-name' ) {
166 $name = $this->
getVar(
'wgSitename' );
169 $name = preg_replace(
'/[\[\]\{\}|#<>%+? ]/',
'_', $name );
170 $name = str_replace(
'&',
'&', $name );
171 $name = preg_replace(
'/__+/',
'_', $name );
172 $name = ucfirst( trim( $name,
'_' ) );
173 } elseif ( $nsType ==
'generic' ) {
174 $name =
wfMessage(
'config-ns-generic' )->text();
176 $name = $this->
getVar(
'wgMetaNamespace' );
180 if ( strpos( $name,
':' ) !==
false ) {
184 $title = Title::newFromText( $name );
186 $good = $nsType ==
'site-name';
188 $name = $title->getDBkey();
193 $this->parent->showError(
'config-ns-invalid', $name );
198 $nsIndex = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $name );
199 if ( $nsIndex !==
false && $nsIndex !==
NS_PROJECT ) {
200 $this->parent->showError(
'config-ns-conflict', $name );
204 $this->
setVar(
'wgMetaNamespace', $name );
207 $name = $this->
getVar(
'_AdminName' );
208 if ( strval( $name ) ===
'' ) {
209 $this->parent->showError(
'config-admin-name-blank' );
213 $userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
214 $cname = $userNameUtils->getCanonical( $name, UserRigorOptions::RIGOR_CREATABLE );
215 if ( $cname ===
false ) {
216 $this->parent->showError(
'config-admin-name-invalid', $name );
219 $this->
setVar(
'_AdminName', $cname );
225 $pwd = $this->
getVar(
'_AdminPassword' );
226 $user = User::newFromName( $cname );
232 $status = $upp->checkUserPasswordForGroups(
235 [
'bureaucrat',
'sysop',
'interface-admin' ]
237 $valid = $status->isGood() ?
true : $status->getMessage();
239 $valid =
'config-admin-name-invalid';
241 if ( strval( $pwd ) ===
'' ) {
243 $msg =
'config-admin-password-blank';
244 } elseif ( $pwd !== $this->
getVar(
'_AdminPasswordConfirm' ) ) {
245 $msg =
'config-admin-password-mismatch';
246 } elseif ( $valid !==
true ) {
249 if ( $msg !==
false ) {
250 call_user_func( [ $this->parent,
'showError' ], $msg );
251 $this->
setVar(
'_AdminPassword',
'' );
252 $this->
setVar(
'_AdminPasswordConfirm',
'' );
257 $email = $this->
getVar(
'_AdminEmail' );
258 if ( $email && !Sanitizer::validateEmail( $email ) ) {
259 $this->parent->showError(
'config-admin-error-bademail' );
264 if ( !$email && $this->
getVar(
'_Subscribe' ) ) {
265 $this->parent->showError(
'config-subscribe-noemail' );
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
A class containing constants representing the names of configuration variables.
Check if a user's password complies with any password policies that apply to that user,...
Abstract class to define pages for the web installer.
endForm( $continue='continue', $back='back')
getVar( $var, $default=null)
$wgPasswordPolicy
Config variable stub for the PasswordPolicy setting, for use by phpdoc and IDEs.