32 $r = $this->parent->request;
33 if ( $r->wasPosted() && $this->submit() ) {
43 if ( $this->
getVar(
'wgSitename' ) ==
'MediaWiki' ) {
44 $this->
setVar(
'wgSitename',
'' );
49 $metaNS = $this->
getVar(
'wgMetaNamespace' );
52 wfMessage(
'config-ns-other-default' )->inContentLanguage()->text()
58 MainConfigNames::DBtype => $this->
getVar(
'wgDBtype' ),
63 $this->parent->getTextBox( [
64 'var' =>
'wgSitename',
65 'label' =>
'config-site-name',
66 'help' => $this->parent->getHelpBox(
'config-site-name-help' )
71 $this->parent->getRadioSet( [
72 'var' =>
'_NamespaceType',
73 'label' =>
'config-project-namespace',
74 'itemLabelPrefix' =>
'config-ns-',
75 'values' => [
'site-name',
'generic',
'other' ],
76 'commonAttribs' => [
'class' =>
'enableForOther',
77 'rel' =>
'config_wgMetaNamespace' ],
78 'help' => $this->parent->getHelpBox(
'config-project-namespace-help' )
80 $this->parent->getTextBox( [
81 'var' =>
'wgMetaNamespace',
83 'attribs' => [
'class' =>
'enabledByOther' ]
85 $this->getFieldsetStart(
'config-admin-box' ) .
86 $this->parent->getTextBox( [
87 'var' =>
'_AdminName',
88 'label' =>
'config-admin-name',
89 'help' => $this->parent->getHelpBox(
'config-admin-help' )
91 $this->parent->getPasswordBox( [
92 'var' =>
'_AdminPassword',
93 'label' =>
'config-admin-password',
95 $this->parent->getPasswordBox( [
96 'var' =>
'_AdminPasswordConfirm',
97 'label' =>
'config-admin-password-confirm'
99 $this->parent->getTextBox( [
100 'var' =>
'_AdminEmail',
104 'label' =>
'config-admin-email',
105 'help' => $this->parent->getHelpBox(
'config-admin-email-help' )
107 $this->parent->getCheckBox( [
108 'var' =>
'_Subscribe',
109 'label' =>
'config-subscribe',
110 'help' => $this->parent->getHelpBox(
'config-subscribe-help' )
112 $this->parent->getCheckBox( [
113 'var' =>
'wgPingback',
114 'label' =>
'config-pingback',
115 'help' => $this->parent->getHelpBox(
116 'config-pingback-help',
117 FormatJson::encode( $pingbackInfo,
true )
121 $this->getFieldsetEnd() .
122 $this->parent->getInfoBox(
wfMessage(
'config-almost-done' )->plain() ) .
126 $this->parent->getRadioSet( [
127 'var' =>
'_SkipOptional',
128 'itemLabelPrefix' =>
'config-optional-',
129 'values' => [
'continue',
'skip' ]
134 $this->
setVar(
'wgMetaNamespace', $metaNS );
148 $this->parent->setVarsFromRequest( [
'wgSitename',
'_NamespaceType',
149 '_AdminName',
'_AdminPassword',
'_AdminPasswordConfirm',
'_AdminEmail',
150 '_Subscribe',
'_SkipOptional',
'wgMetaNamespace',
'wgPingback' ] );
153 if ( strval( $this->
getVar(
'wgSitename' ) ) ===
'' ) {
154 $this->parent->showError(
'config-site-name-blank' );
159 $nsType = $this->
getVar(
'_NamespaceType' );
160 if ( $nsType ==
'site-name' ) {
161 $name = $this->
getVar(
'wgSitename' );
164 $name = preg_replace(
'/[\[\]\{\}|#<>%+? ]/',
'_', $name );
165 $name = str_replace(
'&',
'&', $name );
166 $name = preg_replace(
'/__+/',
'_', $name );
167 $name = ucfirst( trim( $name,
'_' ) );
168 } elseif ( $nsType ==
'generic' ) {
169 $name =
wfMessage(
'config-ns-generic' )->text();
171 $name = $this->
getVar(
'wgMetaNamespace' );
175 if ( strpos( $name,
':' ) !==
false ) {
179 $title = Title::newFromText( $name );
181 $good = $nsType ==
'site-name';
183 $name =
$title->getDBkey();
188 $this->parent->showError(
'config-ns-invalid', $name );
193 $nsIndex = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $name );
194 if ( $nsIndex !==
false && $nsIndex !==
NS_PROJECT ) {
195 $this->parent->showError(
'config-ns-conflict', $name );
199 $this->
setVar(
'wgMetaNamespace', $name );
202 $name = $this->
getVar(
'_AdminName' );
203 if ( strval( $name ) ===
'' ) {
204 $this->parent->showError(
'config-admin-name-blank' );
208 $userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
209 $cname = $userNameUtils->getCanonical( $name, UserRigorOptions::RIGOR_CREATABLE );
210 if ( $cname ===
false ) {
211 $this->parent->showError(
'config-admin-name-invalid', $name );
214 $this->
setVar(
'_AdminName', $cname );
220 $pwd = $this->
getVar(
'_AdminPassword' );
227 $status = $upp->checkUserPasswordForGroups(
230 [
'bureaucrat',
'sysop',
'interface-admin' ]
232 $valid = $status->isGood() ?
true : $status->getMessage();
234 $valid =
'config-admin-name-invalid';
236 if ( strval( $pwd ) ===
'' ) {
238 $msg =
'config-admin-password-blank';
239 } elseif ( $pwd !== $this->
getVar(
'_AdminPasswordConfirm' ) ) {
240 $msg =
'config-admin-password-mismatch';
241 } elseif ( $valid !==
true ) {
244 if ( $msg !==
false ) {
245 call_user_func( [ $this->parent,
'showError' ], $msg );
246 $this->
setVar(
'_AdminPassword',
'' );
247 $this->
setVar(
'_AdminPasswordConfirm',
'' );
252 $email = $this->
getVar(
'_AdminEmail' );
253 if ( $email && !Sanitizer::validateEmail( $email ) ) {
254 $this->parent->showError(
'config-admin-error-bademail' );
259 if ( !$email && $this->
getVar(
'_Subscribe' ) ) {
260 $this->parent->showError(
'config-subscribe-noemail' );