31 $r = $this->parent->request;
32 if ( $r->wasPosted() && $this->submit() ) {
42 if ( $this->
getVar(
'wgSitename' ) ==
'MediaWiki' ) {
43 $this->
setVar(
'wgSitename',
'' );
48 $metaNS = $this->
getVar(
'wgMetaNamespace' );
51 wfMessage(
'config-ns-other-default' )->inContentLanguage()->text()
57 'DBtype' => $this->
getVar(
'wgDBtype' ),
62 $this->parent->getTextBox( [
63 'var' =>
'wgSitename',
64 'label' =>
'config-site-name',
65 'help' => $this->parent->getHelpBox(
'config-site-name-help' )
70 $this->parent->getRadioSet( [
71 'var' =>
'_NamespaceType',
72 'label' =>
'config-project-namespace',
73 'itemLabelPrefix' =>
'config-ns-',
74 'values' => [
'site-name',
'generic',
'other' ],
75 'commonAttribs' => [
'class' =>
'enableForOther',
76 'rel' =>
'config_wgMetaNamespace' ],
77 'help' => $this->parent->getHelpBox(
'config-project-namespace-help' )
79 $this->parent->getTextBox( [
80 'var' =>
'wgMetaNamespace',
82 'attribs' => [
'class' =>
'enabledByOther' ]
84 $this->getFieldsetStart(
'config-admin-box' ) .
85 $this->parent->getTextBox( [
86 'var' =>
'_AdminName',
87 'label' =>
'config-admin-name',
88 'help' => $this->parent->getHelpBox(
'config-admin-help' )
90 $this->parent->getPasswordBox( [
91 'var' =>
'_AdminPassword',
92 'label' =>
'config-admin-password',
94 $this->parent->getPasswordBox( [
95 'var' =>
'_AdminPasswordConfirm',
96 'label' =>
'config-admin-password-confirm'
98 $this->parent->getTextBox( [
99 'var' =>
'_AdminEmail',
103 'label' =>
'config-admin-email',
104 'help' => $this->parent->getHelpBox(
'config-admin-email-help' )
106 $this->parent->getCheckBox( [
107 'var' =>
'_Subscribe',
108 'label' =>
'config-subscribe',
109 'help' => $this->parent->getHelpBox(
'config-subscribe-help' )
111 $this->parent->getCheckBox( [
112 'var' =>
'wgPingback',
113 'label' =>
'config-pingback',
114 'help' => $this->parent->getHelpBox(
115 'config-pingback-help',
116 FormatJson::encode( $pingbackInfo,
true )
120 $this->getFieldsetEnd() .
121 $this->parent->getInfoBox(
wfMessage(
'config-almost-done' )->plain() ) .
125 $this->parent->getRadioSet( [
126 'var' =>
'_SkipOptional',
127 'itemLabelPrefix' =>
'config-optional-',
128 'values' => [
'continue',
'skip' ]
133 $this->
setVar(
'wgMetaNamespace', $metaNS );
147 $this->parent->setVarsFromRequest( [
'wgSitename',
'_NamespaceType',
148 '_AdminName',
'_AdminPassword',
'_AdminPasswordConfirm',
'_AdminEmail',
149 '_Subscribe',
'_SkipOptional',
'wgMetaNamespace',
'wgPingback' ] );
152 if ( strval( $this->
getVar(
'wgSitename' ) ) ===
'' ) {
153 $this->parent->showError(
'config-site-name-blank' );
158 $nsType = $this->
getVar(
'_NamespaceType' );
159 if ( $nsType ==
'site-name' ) {
160 $name = $this->
getVar(
'wgSitename' );
163 $name = preg_replace(
'/[\[\]\{\}|#<>%+? ]/',
'_', $name );
164 $name = str_replace(
'&',
'&', $name );
165 $name = preg_replace(
'/__+/',
'_', $name );
166 $name = ucfirst( trim( $name,
'_' ) );
167 } elseif ( $nsType ==
'generic' ) {
168 $name =
wfMessage(
'config-ns-generic' )->text();
170 $name = $this->
getVar(
'wgMetaNamespace' );
174 if ( strpos( $name,
':' ) !==
false ) {
178 $title = Title::newFromText( $name );
180 $good = $nsType ==
'site-name';
182 $name =
$title->getDBkey();
187 $this->parent->showError(
'config-ns-invalid', $name );
192 $nsIndex = MediaWikiServices::getInstance()->getContentLanguage()->getNsIndex( $name );
193 if ( $nsIndex !==
false && $nsIndex !==
NS_PROJECT ) {
194 $this->parent->showError(
'config-ns-conflict', $name );
198 $this->
setVar(
'wgMetaNamespace', $name );
201 $name = $this->
getVar(
'_AdminName' );
202 if ( strval( $name ) ===
'' ) {
203 $this->parent->showError(
'config-admin-name-blank' );
207 $userNameUtils = MediaWikiServices::getInstance()->getUserNameUtils();
208 $cname = $userNameUtils->getCanonical( $name, UserNameUtils::RIGOR_CREATABLE );
209 if ( $cname ===
false ) {
210 $this->parent->showError(
'config-admin-name-invalid', $name );
213 $this->
setVar(
'_AdminName', $cname );
219 $pwd = $this->
getVar(
'_AdminPassword' );
226 $status = $upp->checkUserPasswordForGroups(
229 [
'bureaucrat',
'sysop',
'interface-admin' ]
231 $valid = $status->isGood() ?
true : $status->getMessage();
233 $valid =
'config-admin-name-invalid';
235 if ( strval( $pwd ) ===
'' ) {
237 $msg =
'config-admin-password-blank';
238 } elseif ( $pwd !== $this->
getVar(
'_AdminPasswordConfirm' ) ) {
239 $msg =
'config-admin-password-mismatch';
240 } elseif ( $valid !==
true ) {
243 if ( $msg !==
false ) {
244 call_user_func( [ $this->parent,
'showError' ], $msg );
245 $this->
setVar(
'_AdminPassword',
'' );
246 $this->
setVar(
'_AdminPasswordConfirm',
'' );
251 $email = $this->
getVar(
'_AdminEmail' );
252 if ( $email && !Sanitizer::validateEmail( $email ) ) {
253 $this->parent->showError(
'config-admin-error-bademail' );
258 if ( !$email && $this->
getVar(
'_Subscribe' ) ) {
259 $this->parent->showError(
'config-subscribe-noemail' );