30 if ( $this->
getVar(
'_SkipOptional' ) ==
'skip' ) {
34 if ( $this->parent->request->wasPosted() ) {
40 $emailwrapperStyle = $this->
getVar(
'wgEnableEmail' ) ?
'' :
'display: none';
47 $this->parent->getRadioSet( [
48 'var' =>
'_RightsProfile',
49 'label' =>
'config-profile',
50 'itemLabelPrefix' =>
'config-profile-',
51 'values' => array_keys( $this->parent->rightsProfiles ),
53 $this->parent->getInfoBox(
wfMessage(
'config-profile-help' )->
plain() ) .
61 $this->parent->getRadioSet( [
62 'var' =>
'_LicenseCode',
63 'label' =>
'config-license',
64 'itemLabelPrefix' =>
'config-license-',
65 'values' => array_keys( $this->parent->licenses ),
66 'commonAttribs' => [
'class' =>
'licenseRadio' ],
68 $this->getCCChooser() .
69 $this->parent->getHelpBox(
'config-license-help' ) .
72 $this->getFieldsetStart(
'config-email-settings' ) .
73 $this->parent->getCheckBox( [
74 'var' =>
'wgEnableEmail',
75 'label' =>
'config-enable-email',
76 'attribs' => [
'class' =>
'showHideRadio',
'rel' =>
'emailwrapper' ],
78 $this->parent->getHelpBox(
'config-enable-email-help' ) .
79 "<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" .
80 $this->parent->getTextBox( [
81 'var' =>
'wgPasswordSender',
82 'label' =>
'config-email-sender'
84 $this->parent->getHelpBox(
'config-email-sender-help' ) .
85 $this->parent->getCheckBox( [
86 'var' =>
'wgEnableUserEmail',
87 'label' =>
'config-email-user',
89 $this->parent->getHelpBox(
'config-email-user-help' ) .
90 $this->parent->getCheckBox( [
91 'var' =>
'wgEnotifUserTalk',
92 'label' =>
'config-email-usertalk',
94 $this->parent->getHelpBox(
'config-email-usertalk-help' ) .
95 $this->parent->getCheckBox( [
96 'var' =>
'wgEnotifWatchlist',
97 'label' =>
'config-email-watchlist',
99 $this->parent->getHelpBox(
'config-email-watchlist-help' ) .
100 $this->parent->getCheckBox( [
101 'var' =>
'wgEmailAuthentication',
102 'label' =>
'config-email-auth',
104 $this->parent->getHelpBox(
'config-email-auth-help' ) .
106 $this->getFieldsetEnd()
109 $skins = $this->parent->findExtensions(
'skins' );
112 $skinNames = array_map(
'strtolower', array_keys( $skins ) );
113 $chosenSkinName = $this->
getVar(
'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) );
116 $radioButtons = $this->parent->getRadioElements( [
117 'var' =>
'wgDefaultSkin',
118 'itemLabels' => array_fill_keys( $skinNames,
'config-skins-use-as-default' ),
119 'values' => $skinNames,
120 'value' => $chosenSkinName,
123 foreach ( $skins as $skin => $info ) {
124 if ( isset( $info[
'screenshots'] ) ) {
127 $screenshotText = htmlspecialchars( $skin );
130 '<div class="config-skins-item">' .
131 $this->parent->getCheckBox( [
132 'var' =>
"skin-$skin",
133 'rawtext' => $screenshotText,
134 'value' => $this->
getVar(
"skin-$skin",
true ),
136 '<div class="config-skins-use-as-default">' . $radioButtons[strtolower( $skin )] .
'</div>' .
141 $this->parent->getWarningBox(
wfMessage(
'config-skins-missing' )->
plain() ) .
142 Html::hidden(
'config_wgDefaultSkin', $chosenSkinName );
145 $skinHtml .= $this->parent->getHelpBox(
'config-skins-help' ) .
149 $extensions = $this->parent->findExtensions();
158 foreach ( $extensions as
$ext => $info ) {
159 if ( !isset( $info[
'type'] ) || !isset( $types[$info[
'type']] ) ) {
163 $info[
'type'] =
'other';
165 $extByType[$info[
'type']][
$ext] = $info;
168 foreach ( $types as
$type => $message ) {
169 if ( !isset( $extByType[
$type] ) ) {
172 $extHtml .= Html::element(
'h2', [], $message );
173 foreach ( $extByType[
$type] as
$ext => $info ) {
175 if ( isset( $info[
'url'] ) ) {
176 $urlText =
' ' . Html::element(
'a', [
'href' => $info[
'url'] ],
'(more information)' );
180 'class' =>
'config-ext-input'
184 if ( isset( $info[
'requires'][
'extensions'] ) ) {
185 $dependencyMap[
$ext][
'extensions'] = $info[
'requires'][
'extensions'];
186 $labelAttribs[
'class'] =
'mw-ext-with-dependencies';
188 if ( isset( $info[
'requires'][
'skins'] ) ) {
189 $dependencyMap[
$ext][
'skins'] = $info[
'requires'][
'skins'];
190 $labelAttribs[
'class'] =
'mw-ext-with-dependencies';
192 if ( isset( $dependencyMap[
$ext] ) ) {
196 if ( isset( $dependencyMap[
$ext][
'extensions'] ) ) {
197 foreach ( $dependencyMap[
$ext][
'extensions'] as $name ) {
198 $links[] = Html::element(
200 [
'href' =>
"#config_ext-$name" ],
205 if ( isset( $dependencyMap[
$ext][
'skins'] ) ) {
206 foreach ( $dependencyMap[
$ext][
'skins'] as $name ) {
207 $links[] = Html::element(
209 [
'href' =>
"#config_skin-$name" ],
215 $text =
wfMessage(
'config-extensions-requires' )
221 $extHtml .= $this->parent->getCheckBox( [
225 'labelAttribs' => $labelAttribs,
230 $extHtml .= $this->parent->getHelpBox(
'config-extensions-help' ) .
234 $this->
addHTML( Html::inlineScript(
235 'var extDependencyMap = ' . Xml::encodeJsVar( $dependencyMap )
240 $this->
setVar(
'wgDeletedDirectory',
242 '/', DIRECTORY_SEPARATOR,
243 $this->
getVar(
'wgDeletedDirectory' )
247 $uploadwrapperStyle = $this->
getVar(
'wgEnableUploads' ) ?
'' :
'display: none';
251 $this->parent->getCheckBox( [
252 'var' =>
'wgEnableUploads',
253 'label' =>
'config-upload-enable',
254 'attribs' => [
'class' =>
'showHideRadio',
'rel' =>
'uploadwrapper' ],
255 'help' => $this->parent->getHelpBox(
'config-upload-help' )
257 '<div id="uploadwrapper" style="' . $uploadwrapperStyle .
'">' .
258 $this->parent->getTextBox( [
259 'var' =>
'wgDeletedDirectory',
260 'label' =>
'config-upload-deleted',
261 'attribs' => [
'dir' =>
'ltr' ],
262 'help' => $this->parent->getHelpBox(
'config-upload-deleted-help' )
265 $this->parent->getTextBox( [
267 'label' =>
'config-logo',
268 'attribs' => [
'dir' =>
'ltr' ],
269 'help' => $this->parent->getHelpBox(
'config-logo-help' )
273 $this->parent->getCheckBox( [
274 'var' =>
'wgUseInstantCommons',
275 'label' =>
'config-instantcommons',
276 'help' => $this->parent->getHelpBox(
'config-instantcommons-help' )
278 $this->getFieldsetEnd()
281 $caches = [
'none' ];
282 $cachevalDefault =
'none';
284 if ( count( $this->
getVar(
'_Caches' ) ) ) {
287 $cachevalDefault =
'accel';
289 $caches[] =
'memcached';
292 $cacheval = $this->
getVar(
'_MainCacheType' );
297 $cacheval = $cachevalDefault;
299 $hidden = ( $cacheval ==
'memcached' ) ?
'' :
'display: none';
307 $this->parent->getRadioSet( [
308 'var' =>
'_MainCacheType',
309 'label' =>
'config-cache-options',
310 'itemLabelPrefix' =>
'config-cache-',
312 'value' => $cacheval,
314 $this->parent->getHelpBox(
'config-cache-help' ) .
315 "<div id=\"config-memcachewrapper\" style=\"$hidden\">" .
316 $this->parent->getTextArea( [
317 'var' =>
'_MemCachedServers',
318 'label' =>
'config-memcached-servers',
319 'help' => $this->parent->getHelpBox(
'config-memcached-help' )
322 $this->getFieldsetEnd()
468 $this->parent->setVarsFromRequest( [
'_RightsProfile',
'_LicenseCode',
469 'wgEnableEmail',
'wgPasswordSender',
'wgEnableUploads',
'wgLogo',
470 'wgEnableUserEmail',
'wgEnotifUserTalk',
'wgEnotifWatchlist',
471 'wgEmailAuthentication',
'_MainCacheType',
'_MemCachedServers',
472 'wgUseInstantCommons',
'wgDefaultSkin' ] );
476 if ( !array_key_exists( $this->
getVar(
'_RightsProfile' ), $this->parent->rightsProfiles ) ) {
477 reset( $this->parent->rightsProfiles );
478 $this->
setVar(
'_RightsProfile',
key( $this->parent->rightsProfiles ) );
482 if (
$code ==
'cc-choose' ) {
483 if ( !$this->
getVar(
'_CCDone' ) ) {
484 $this->parent->showError(
'config-cc-not-chosen' );
487 } elseif ( array_key_exists(
$code, $this->parent->licenses ) ) {
492 $entry = $this->parent->licenses[
$code];
493 if ( isset( $entry[
'text'] ) ) {
494 $this->
setVar(
'wgRightsText', $entry[
'text'] );
498 $this->
setVar(
'wgRightsUrl', $entry[
'url'] );
499 $this->
setVar(
'wgRightsIcon', $entry[
'icon'] );
501 $this->
setVar(
'wgRightsText',
'' );
502 $this->
setVar(
'wgRightsUrl',
'' );
503 $this->
setVar(
'wgRightsIcon',
'' );
506 $skinsAvailable = array_keys( $this->parent->findExtensions(
'skins' ) );
507 $skinsToInstall = [];
508 foreach ( $skinsAvailable as $skin ) {
509 $this->parent->setVarsFromRequest( [
"skin-$skin" ] );
510 if ( $this->
getVar(
"skin-$skin" ) ) {
511 $skinsToInstall[] =
$skin;
514 $this->parent->setVar(
'_Skins', $skinsToInstall );
516 if ( !$skinsToInstall && $skinsAvailable ) {
517 $this->parent->showError(
'config-skins-must-enable-some' );
520 $defaultSkin = $this->
getVar(
'wgDefaultSkin' );
521 $skinsToInstallLowercase = array_map(
'strtolower', $skinsToInstall );
522 if ( $skinsToInstall && array_search( $defaultSkin, $skinsToInstallLowercase ) ===
false ) {
523 $this->parent->showError(
'config-skins-must-enable-default' );
527 $extsAvailable = array_keys( $this->parent->findExtensions() );
529 foreach ( $extsAvailable as
$ext ) {
530 $this->parent->setVarsFromRequest( [
"ext-$ext" ] );
531 if ( $this->
getVar(
"ext-$ext" ) ) {
532 $extsToInstall[] =
$ext;
535 $this->parent->setVar(
'_Extensions', $extsToInstall );
537 if ( $this->
getVar(
'_MainCacheType' ) ==
'memcached' ) {
538 $memcServers = explode(
"\n", $this->
getVar(
'_MemCachedServers' ) );
539 if ( !$memcServers ) {
540 $this->parent->showError(
'config-memcache-needservers' );
544 foreach ( $memcServers as $server ) {
545 $memcParts = explode(
":", $server, 2 );
546 if ( !isset( $memcParts[0] )
547 || ( !IP::isValid( $memcParts[0] )
548 && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) )
550 $this->parent->showError(
'config-memcache-badip', $memcParts[0] );
552 } elseif ( !isset( $memcParts[1] ) ) {
553 $this->parent->showError(
'config-memcache-noport', $memcParts[0] );
555 } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
556 $this->parent->showError(
'config-memcache-badport', 1, 65535 );