41 $r = $this->parent->request;
42 if ( $r->wasPosted() && $this->submit() ) {
52 if ( $this->
getVar(
'wgSitename' ) ==
'MediaWiki' ) {
53 $this->
setVar(
'wgSitename',
'' );
58 $metaNS = $this->
getVar(
'wgMetaNamespace' );
61 wfMessage(
'config-ns-other-default' )->inContentLanguage()->text()
72 $this->parent->getTextBox( [
73 'var' =>
'wgSitename',
74 'label' =>
'config-site-name',
75 'help' => $this->parent->getHelpBox(
'config-site-name-help' )
80 $this->parent->getRadioSet( [
81 'var' =>
'_NamespaceType',
82 'label' =>
'config-project-namespace',
83 'itemLabelPrefix' =>
'config-ns-',
84 'values' => [
'site-name',
'generic',
'other' ],
85 'commonAttribs' => [
'class' =>
'enableForOther',
86 'rel' =>
'config_wgMetaNamespace' ],
87 'help' => $this->parent->getHelpBox(
'config-project-namespace-help' )
89 $this->parent->getTextBox( [
90 'var' =>
'wgMetaNamespace',
92 'attribs' => [
'class' =>
'enabledByOther' ]
94 $this->getFieldsetStart(
'config-admin-box' ) .
95 $this->parent->getTextBox( [
96 'var' =>
'_AdminName',
97 'label' =>
'config-admin-name',
98 'help' => $this->parent->getHelpBox(
'config-admin-help' )
100 $this->parent->getPasswordBox( [
101 'var' =>
'_AdminPassword',
102 'label' =>
'config-admin-password',
104 $this->parent->getPasswordBox( [
105 'var' =>
'_AdminPasswordConfirm',
106 'label' =>
'config-admin-password-confirm'
108 $this->parent->getTextBox( [
109 'var' =>
'_AdminEmail',
113 'label' =>
'config-admin-email',
114 'help' => $this->parent->getHelpBox(
'config-admin-email-help' )
116 $this->parent->getCheckBox( [
117 'var' =>
'_Subscribe',
118 'label' =>
'config-subscribe',
119 'help' => $this->parent->getHelpBox(
'config-subscribe-help' )
121 $this->parent->getCheckBox( [
122 'var' =>
'wgPingback',
123 'label' =>
'config-pingback',
124 'help' => $this->parent->getHelpBox(
125 'config-pingback-help',
126 FormatJson::encode( $pingbackInfo,
true )
130 $this->getFieldsetEnd() .
131 $this->parent->getInfoBox(
wfMessage(
'config-almost-done' )->plain() ) .
135 $this->parent->getRadioSet( [
136 'var' =>
'_SkipOptional',
137 'itemLabelPrefix' =>
'config-optional-',
138 'values' => [
'continue',
'skip' ]
143 $this->
setVar(
'wgMetaNamespace', $metaNS );
157 $this->parent->setVarsFromRequest( [
'wgSitename',
'_NamespaceType',
158 '_AdminName',
'_AdminPassword',
'_AdminPasswordConfirm',
'_AdminEmail',
159 '_Subscribe',
'_SkipOptional',
'wgMetaNamespace',
'wgPingback' ] );
162 if ( strval( $this->
getVar(
'wgSitename' ) ) ===
'' ) {
163 $this->parent->showError(
'config-site-name-blank' );
168 $nsType = $this->
getVar(
'_NamespaceType' );
169 if ( $nsType ==
'site-name' ) {
170 $name = $this->
getVar(
'wgSitename' );
173 $name = preg_replace(
'/[\[\]\{\}|#<>%+? ]/',
'_', $name );
174 $name = str_replace(
'&',
'&', $name );
175 $name = preg_replace(
'/__+/',
'_', $name );
176 $name = ucfirst( trim( $name,
'_' ) );
177 } elseif ( $nsType ==
'generic' ) {
178 $name =
wfMessage(
'config-ns-generic' )->text();
180 $name = $this->
getVar(
'wgMetaNamespace' );
184 if ( strpos( $name,
':' ) !==
false ) {
188 $title = Title::newFromText( $name );
190 $good = $nsType ==
'site-name';
192 $name = $title->getDBkey();
197 $this->parent->showError(
'config-ns-invalid', $name );
203 if ( $nsIndex !==
false && $nsIndex !==
NS_PROJECT ) {
204 $this->parent->showError(
'config-ns-conflict', $name );
208 $this->
setVar(
'wgMetaNamespace', $name );
211 $name = $this->
getVar(
'_AdminName' );
212 if ( strval( $name ) ===
'' ) {
213 $this->parent->showError(
'config-admin-name-blank' );
218 $cname = $userNameUtils->getCanonical( $name, UserRigorOptions::RIGOR_CREATABLE );
219 if ( $cname ===
false ) {
220 $this->parent->showError(
'config-admin-name-invalid', $name );
223 $this->
setVar(
'_AdminName', $cname );
229 $pwd = $this->
getVar(
'_AdminPassword' );
230 $user = User::newFromName( $cname );
236 $status = $upp->checkUserPasswordForGroups(
239 [
'bureaucrat',
'sysop',
'interface-admin' ]
241 $valid = $status->isGood() ? true : $status->getMessage();
243 $valid =
'config-admin-name-invalid';
245 if ( strval( $pwd ) ===
'' ) {
247 $msg =
'config-admin-password-blank';
248 } elseif ( $pwd !== $this->
getVar(
'_AdminPasswordConfirm' ) ) {
249 $msg =
'config-admin-password-mismatch';
250 } elseif ( $valid !==
true ) {
253 if ( $msg !==
false ) {
254 call_user_func( [ $this->parent,
'showError' ], $msg );
255 $this->
setVar(
'_AdminPassword',
'' );
256 $this->
setVar(
'_AdminPasswordConfirm',
'' );
261 $email = $this->
getVar(
'_AdminEmail' );
262 if ( $email && !Sanitizer::validateEmail( $email ) ) {
263 $this->parent->showError(
'config-admin-error-bademail' );
268 if ( !$email && $this->
getVar(
'_Subscribe' ) ) {
269 $this->parent->showError(
'config-subscribe-noemail' );