30 if ( $this->
getVar(
'_SkipOptional' ) ==
'skip' ) {
34 if ( $this->parent->request->wasPosted() && $this->submit() ) {
38 $emailwrapperStyle = $this->
getVar(
'wgEnableEmail' ) ?
'' :
'display: none';
45 $this->parent->getRadioSet( [
46 'var' =>
'_RightsProfile',
47 'label' =>
'config-profile',
48 'itemLabelPrefix' =>
'config-profile-',
49 'values' => array_keys( $this->parent->rightsProfiles ),
51 $this->parent->getInfoBox(
wfMessage(
'config-profile-help' )->
plain() ) .
59 $this->parent->getRadioSet( [
60 'var' =>
'_LicenseCode',
61 'label' =>
'config-license',
62 'itemLabelPrefix' =>
'config-license-',
63 'values' => array_keys( $this->parent->licenses ),
64 'commonAttribs' => [
'class' =>
'licenseRadio' ],
66 $this->getCCChooser() .
67 $this->parent->getHelpBox(
'config-license-help' ) .
70 $this->getFieldsetStart(
'config-email-settings' ) .
71 $this->parent->getCheckBox( [
72 'var' =>
'wgEnableEmail',
73 'label' =>
'config-enable-email',
74 'attribs' => [
'class' =>
'showHideRadio',
'rel' =>
'emailwrapper' ],
76 $this->parent->getHelpBox(
'config-enable-email-help' ) .
77 "<div id=\"emailwrapper\" style=\"$emailwrapperStyle\">" .
78 $this->parent->getTextBox( [
79 'var' =>
'wgPasswordSender',
80 'label' =>
'config-email-sender'
82 $this->parent->getHelpBox(
'config-email-sender-help' ) .
83 $this->parent->getCheckBox( [
84 'var' =>
'wgEnableUserEmail',
85 'label' =>
'config-email-user',
87 $this->parent->getHelpBox(
'config-email-user-help' ) .
88 $this->parent->getCheckBox( [
89 'var' =>
'wgEnotifUserTalk',
90 'label' =>
'config-email-usertalk',
92 $this->parent->getHelpBox(
'config-email-usertalk-help' ) .
93 $this->parent->getCheckBox( [
94 'var' =>
'wgEnotifWatchlist',
95 'label' =>
'config-email-watchlist',
97 $this->parent->getHelpBox(
'config-email-watchlist-help' ) .
98 $this->parent->getCheckBox( [
99 'var' =>
'wgEmailAuthentication',
100 'label' =>
'config-email-auth',
102 $this->parent->getHelpBox(
'config-email-auth-help' ) .
104 $this->getFieldsetEnd()
107 $skins = $this->parent->findExtensions(
'skins' );
111 $chosenSkinName = $this->
getVar(
'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) );
114 $radioButtons = $this->parent->getRadioElements( [
115 'var' =>
'wgDefaultSkin',
116 'itemLabels' =>
array_fill_keys( $skinNames,
'config-skins-use-as-default' ),
117 'values' => $skinNames,
118 'value' => $chosenSkinName,
121 foreach ( $skins as $skin => $info ) {
122 if (
isset( $info[
'screenshots'] ) ) {
128 '<div class="config-skins-item">' .
129 $this->parent->getCheckBox( [
130 'var' =>
"skin-$skin",
131 'rawtext' => $screenshotText,
132 'value' => $this->
getVar(
"skin-$skin",
true ),
134 '<div class="config-skins-use-as-default">' . $radioButtons[
strtolower( $skin )] .
'</div>' .
139 $this->parent->getWarningBox(
wfMessage(
'config-skins-missing' )->
plain() ) .
140 Html::hidden(
'config_wgDefaultSkin', $chosenSkinName );
143 $skinHtml .= $this->parent->getHelpBox(
'config-skins-help' ) .
147 $extensions = $this->parent->findExtensions();
156 foreach ( $extensions as
$ext => $info ) {
157 if ( !
isset( $info[
'type'] ) || !
isset( $types[$info[
'type']] ) ) {
161 $info[
'type'] =
'other';
163 $extByType[$info[
'type']][
$ext] = $info;
166 foreach ( $types as
$type => $message ) {
170 $extHtml .= Html::element(
'h2', [], $message );
171 foreach ( $extByType[
$type] as
$ext => $info ) {
173 if (
isset( $info[
'url'] ) ) {
174 $urlText =
' ' . Html::element(
'a', [
'href' => $info[
'url'] ],
'(more information)' );
178 'class' =>
'config-ext-input'
182 if (
isset( $info[
'requires'][
'extensions'] ) ) {
183 $dependencyMap[
$ext][
'extensions'] = $info[
'requires'][
'extensions'];
184 $labelAttribs[
'class'] =
'mw-ext-with-dependencies';
186 if (
isset( $info[
'requires'][
'skins'] ) ) {
187 $dependencyMap[
$ext][
'skins'] = $info[
'requires'][
'skins'];
188 $labelAttribs[
'class'] =
'mw-ext-with-dependencies';
194 if (
isset( $dependencyMap[
$ext][
'extensions'] ) ) {
195 foreach ( $dependencyMap[
$ext][
'extensions'] as $name ) {
196 $links[] = Html::element(
198 [
'href' =>
"#config_ext-$name" ],
203 if (
isset( $dependencyMap[
$ext][
'skins'] ) ) {
204 foreach ( $dependencyMap[
$ext][
'skins'] as $name ) {
205 $links[] = Html::element(
207 [
'href' =>
"#config_skin-$name" ],
213 $text =
wfMessage(
'config-extensions-requires' )
219 $extHtml .= $this->parent->getCheckBox( [
223 'labelAttribs' => $labelAttribs,
228 $extHtml .= $this->parent->getHelpBox(
'config-extensions-help' ) .
232 $this->
addHTML( Html::inlineScript(
233 'var extDependencyMap = ' . Xml::encodeJsVar( $dependencyMap )
238 $this->
setVar(
'wgDeletedDirectory',
240 '/', DIRECTORY_SEPARATOR,
241 $this->
getVar(
'wgDeletedDirectory' )
245 $uploadwrapperStyle = $this->
getVar(
'wgEnableUploads' ) ?
'' :
'display: none';
249 $this->parent->getCheckBox( [
250 'var' =>
'wgEnableUploads',
251 'label' =>
'config-upload-enable',
252 'attribs' => [
'class' =>
'showHideRadio',
'rel' =>
'uploadwrapper' ],
253 'help' => $this->parent->getHelpBox(
'config-upload-help' )
255 '<div id="uploadwrapper" style="' . $uploadwrapperStyle .
'">' .
256 $this->parent->getTextBox( [
257 'var' =>
'wgDeletedDirectory',
258 'label' =>
'config-upload-deleted',
259 'attribs' => [
'dir' =>
'ltr' ],
260 'help' => $this->parent->getHelpBox(
'config-upload-deleted-help' )
263 $this->parent->getTextBox( [
265 'label' =>
'config-logo',
266 'attribs' => [
'dir' =>
'ltr' ],
267 'help' => $this->parent->getHelpBox(
'config-logo-help' )
271 $this->parent->getCheckBox( [
272 'var' =>
'wgUseInstantCommons',
273 'label' =>
'config-instantcommons',
274 'help' => $this->parent->getHelpBox(
'config-instantcommons-help' )
276 $this->getFieldsetEnd()
279 $caches = [
'none' ];
280 $cachevalDefault =
'none';
282 if ( count( $this->
getVar(
'_Caches' ) ) ) {
285 $cachevalDefault =
'accel';
287 $caches[] =
'memcached';
290 $cacheval = $this->
getVar(
'_MainCacheType' );
297 $hidden = ( $cacheval ==
'memcached' ) ?
'' :
'display: none';
305 $this->parent->getRadioSet( [
306 'var' =>
'_MainCacheType',
307 'label' =>
'config-cache-options',
308 'itemLabelPrefix' =>
'config-cache-',
310 'value' => $cacheval,
312 $this->parent->getHelpBox(
'config-cache-help' ) .
313 "<div id=\"config-memcachewrapper\" style=\"$hidden\">" .
314 $this->parent->getTextArea( [
315 'var' =>
'_MemCachedServers',
316 'label' =>
'config-memcached-servers',
317 'help' => $this->parent->getHelpBox(
'config-memcached-help' )
320 $this->getFieldsetEnd()
466 $this->parent->setVarsFromRequest( [
'_RightsProfile',
'_LicenseCode',
467 'wgEnableEmail',
'wgPasswordSender',
'wgEnableUploads',
'wgLogo',
468 'wgEnableUserEmail',
'wgEnotifUserTalk',
'wgEnotifWatchlist',
469 'wgEmailAuthentication',
'_MainCacheType',
'_MemCachedServers',
470 'wgUseInstantCommons',
'wgDefaultSkin' ] );
475 reset( $this->parent->rightsProfiles );
476 $this->
setVar(
'_RightsProfile',
key( $this->parent->rightsProfiles ) );
480 if (
$code ==
'cc-choose' ) {
481 if ( !$this->
getVar(
'_CCDone' ) ) {
482 $this->parent->showError(
'config-cc-not-chosen' );
490 $entry = $this->parent->licenses[
$code];
491 $this->
setVar(
'wgRightsText',
493 $this->
setVar(
'wgRightsUrl', $entry[
'url'] );
494 $this->
setVar(
'wgRightsIcon', $entry[
'icon'] );
496 $this->
setVar(
'wgRightsText',
'' );
497 $this->
setVar(
'wgRightsUrl',
'' );
498 $this->
setVar(
'wgRightsIcon',
'' );
501 $skinsAvailable =
array_keys( $this->parent->findExtensions(
'skins' ) );
502 $skinsToInstall = [];
503 foreach ( $skinsAvailable as $skin ) {
504 $this->parent->setVarsFromRequest( [
"skin-$skin" ] );
505 if ( $this->
getVar(
"skin-$skin" ) ) {
506 $skinsToInstall[] =
$skin;
509 $this->parent->setVar(
'_Skins', $skinsToInstall );
511 if ( !$skinsToInstall && $skinsAvailable ) {
512 $this->parent->showError(
'config-skins-must-enable-some' );
515 $defaultSkin = $this->
getVar(
'wgDefaultSkin' );
516 $skinsToInstallLowercase =
array_map(
'strtolower', $skinsToInstall );
517 if ( $skinsToInstall &&
array_search( $defaultSkin, $skinsToInstallLowercase ) ===
false ) {
518 $this->parent->showError(
'config-skins-must-enable-default' );
522 $extsAvailable =
array_keys( $this->parent->findExtensions() );
524 foreach ( $extsAvailable as
$ext ) {
525 $this->parent->setVarsFromRequest( [
"ext-$ext" ] );
526 if ( $this->
getVar(
"ext-$ext" ) ) {
527 $extsToInstall[] =
$ext;
530 $this->parent->setVar(
'_Extensions', $extsToInstall );
532 if ( $this->
getVar(
'_MainCacheType' ) ==
'memcached' ) {
533 $memcServers = explode(
"\n", $this->
getVar(
'_MemCachedServers' ) );
534 if ( !$memcServers ) {
535 $this->parent->showError(
'config-memcache-needservers' );
539 foreach ( $memcServers as $server ) {
540 $memcParts = explode(
":", $server, 2 );
541 if ( !
isset( $memcParts[0] )
542 || ( !IP::isValid( $memcParts[0] )
545 $this->parent->showError(
'config-memcache-badip', $memcParts[0] );
548 $this->parent->showError(
'config-memcache-noport', $memcParts[0] );
550 }
elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
551 $this->parent->showError(
'config-memcache-badport', 1, 65535 );