32 if ( $this->
getVar(
'_SkipOptional' ) ==
'skip' ) {
36 if ( $this->parent->request->wasPosted() && $this->submit() ) {
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' )->value;
110 '@phan-var array[] $skins';
113 $skinNames = array_map(
'strtolower', array_keys( $skins ) );
114 $chosenSkinName = $this->
getVar(
'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) );
117 $radioButtons = $this->parent->getRadioElements( [
118 'var' =>
'wgDefaultSkin',
119 'itemLabels' => array_fill_keys( $skinNames,
'config-skins-use-as-default' ),
120 'values' => $skinNames,
121 'value' => $chosenSkinName,
124 foreach ( $skins as $skin => $info ) {
125 if ( isset( $info[
'screenshots'] ) ) {
128 $screenshotText = htmlspecialchars( $skin );
131 '<div class="config-skins-item">' .
132 $this->parent->getCheckBox( [
133 'var' =>
"skin-$skin",
134 'rawtext' => $screenshotText,
135 'value' => $this->
getVar(
"skin-$skin",
true ),
137 '<div class="config-skins-use-as-default">' . $radioButtons[strtolower( $skin )] .
'</div>' .
142 Html::warningBox(
wfMessage(
'config-skins-missing' )->plain(),
'config-warning-box' ) .
143 Html::hidden(
'config_wgDefaultSkin', $chosenSkinName );
146 $skinHtml .= $this->parent->getHelpBox(
'config-skins-help' ) .
150 $extensions = $this->parent->findExtensions()->value;
151 '@phan-var array[] $extensions';
160 foreach ( $extensions as
$ext => $info ) {
161 if ( !isset( $info[
'type'] ) || !isset( $types[$info[
'type']] ) ) {
165 $info[
'type'] =
'other';
167 $extByType[$info[
'type']][
$ext] = $info;
170 foreach ( $types as
$type => $message ) {
171 if ( !isset( $extByType[
$type] ) ) {
174 $extHtml .= Html::element(
'h2', [], $message );
175 foreach ( $extByType[
$type] as
$ext => $info ) {
177 if ( isset( $info[
'url'] ) ) {
178 $urlText =
' ' . Html::element(
'a', [
'href' => $info[
'url'] ],
'(more information)' );
182 'class' =>
'config-ext-input'
186 if ( isset( $info[
'requires'][
'extensions'] ) ) {
187 $dependencyMap[
$ext][
'extensions'] = $info[
'requires'][
'extensions'];
188 $labelAttribs[
'class'] =
'mw-ext-with-dependencies';
190 if ( isset( $info[
'requires'][
'skins'] ) ) {
191 $dependencyMap[
$ext][
'skins'] = $info[
'requires'][
'skins'];
192 $labelAttribs[
'class'] =
'mw-ext-with-dependencies';
194 if ( isset( $dependencyMap[
$ext] ) ) {
198 if ( isset( $dependencyMap[
$ext][
'extensions'] ) ) {
199 foreach ( $dependencyMap[
$ext][
'extensions'] as $name ) {
200 $links[] = Html::element(
202 [
'href' =>
"#config_ext-$name" ],
207 if ( isset( $dependencyMap[
$ext][
'skins'] ) ) {
208 foreach ( $dependencyMap[
$ext][
'skins'] as $name ) {
209 $links[] = Html::element(
211 [
'href' =>
"#config_skin-$name" ],
217 $text =
wfMessage(
'config-extensions-requires' )
223 $extHtml .= $this->parent->getCheckBox( [
226 'attribs' => $attribs,
227 'labelAttribs' => $labelAttribs,
232 $extHtml .= $this->parent->getHelpBox(
'config-extensions-help' ) .
236 $this->
addHTML( Html::inlineScript(
237 'var extDependencyMap = ' . Xml::encodeJsVar( $dependencyMap )
242 $this->
setVar(
'wgDeletedDirectory',
244 '/', DIRECTORY_SEPARATOR,
245 $this->
getVar(
'wgDeletedDirectory' )
249 $uploadwrapperStyle = $this->
getVar(
'wgEnableUploads' ) ?
'' :
'display: none';
253 $this->parent->getCheckBox( [
254 'var' =>
'wgEnableUploads',
255 'label' =>
'config-upload-enable',
256 'attribs' => [
'class' =>
'showHideRadio',
'rel' =>
'uploadwrapper' ],
257 'help' => $this->parent->getHelpBox(
'config-upload-help' )
259 '<div id="uploadwrapper" style="' . $uploadwrapperStyle .
'">' .
260 $this->parent->getTextBox( [
261 'var' =>
'wgDeletedDirectory',
262 'label' =>
'config-upload-deleted',
263 'attribs' => [
'dir' =>
'ltr' ],
264 'help' => $this->parent->getHelpBox(
'config-upload-deleted-help' )
267 $this->parent->getTextBox( [
269 'label' =>
'config-logo',
270 'attribs' => [
'dir' =>
'ltr' ],
271 'help' => $this->parent->getHelpBox(
'config-logo-help' )
275 $this->parent->getCheckBox( [
276 'var' =>
'wgUseInstantCommons',
277 'label' =>
'config-instantcommons',
278 'help' => $this->parent->getHelpBox(
'config-instantcommons-help' )
280 $this->getFieldsetEnd()
283 $caches = [
'none' ];
284 $cachevalDefault =
'none';
286 if ( count( $this->
getVar(
'_Caches' ) ) ) {
289 $cachevalDefault =
'accel';
291 $caches[] =
'memcached';
294 $cacheval = $this->
getVar(
'_MainCacheType' );
299 $cacheval = $cachevalDefault;
301 $hidden = ( $cacheval ==
'memcached' ) ?
'' :
'display: none';
305 # Object cache settings
309 $this->parent->getRadioSet( [
310 'var' =>
'_MainCacheType',
311 'label' =>
'config-cache-options',
312 'itemLabelPrefix' =>
'config-cache-',
314 'value' => $cacheval,
316 $this->parent->getHelpBox(
'config-cache-help' ) .
317 "<div id=\"config-memcachewrapper\" style=\"$hidden\">" .
318 $this->parent->getTextArea( [
319 'var' =>
'_MemCachedServers',
320 'label' =>
'config-memcached-servers',
321 'help' => $this->parent->getHelpBox(
'config-memcached-help' )
324 $this->getFieldsetEnd()
476 $this->parent->setVarsFromRequest( [
'_RightsProfile',
'_LicenseCode',
477 'wgEnableEmail',
'wgPasswordSender',
'wgEnableUploads',
'_Logo',
478 'wgEnableUserEmail',
'wgEnotifUserTalk',
'wgEnotifWatchlist',
479 'wgEmailAuthentication',
'_MainCacheType',
'_MemCachedServers',
480 'wgUseInstantCommons',
'wgDefaultSkin' ] );
484 if ( !array_key_exists( $this->
getVar(
'_RightsProfile' ), $this->parent->rightsProfiles ) ) {
485 reset( $this->parent->rightsProfiles );
486 $this->
setVar(
'_RightsProfile', key( $this->parent->rightsProfiles ) );
491 if ( strval( $this->
getVar(
'_Logo' ) ) ===
'' ) {
492 $this->parent->showError(
'config-install-logo-blank' );
496 $code = $this->
getVar(
'_LicenseCode' );
497 if ( $code ==
'cc-choose' ) {
498 if ( !$this->
getVar(
'_CCDone' ) ) {
499 $this->parent->showError(
'config-cc-not-chosen' );
502 } elseif ( array_key_exists( $code, $this->parent->licenses ) ) {
507 $entry = $this->parent->licenses[$code];
508 $this->
setVar(
'wgRightsText',
509 $entry[
'text'] ??
wfMessage(
'config-license-' . $code )->text() );
510 $this->
setVar(
'wgRightsUrl', $entry[
'url'] );
511 $this->
setVar(
'wgRightsIcon', $entry[
'icon'] );
513 $this->
setVar(
'wgRightsText',
'' );
514 $this->
setVar(
'wgRightsUrl',
'' );
515 $this->
setVar(
'wgRightsIcon',
'' );
518 $skinsAvailable = array_keys( $this->parent->findExtensions(
'skins' )->value );
519 $skinsToInstall = [];
520 foreach ( $skinsAvailable as $skin ) {
521 $this->parent->setVarsFromRequest( [
"skin-$skin" ] );
522 if ( $this->
getVar(
"skin-$skin" ) ) {
523 $skinsToInstall[] = $skin;
526 $this->parent->setVar(
'_Skins', $skinsToInstall );
528 if ( !$skinsToInstall && $skinsAvailable ) {
529 $this->parent->showError(
'config-skins-must-enable-some' );
532 $defaultSkin = $this->
getVar(
'wgDefaultSkin' );
533 $skinsToInstallLowercase = array_map(
'strtolower', $skinsToInstall );
534 if ( $skinsToInstall && array_search( $defaultSkin, $skinsToInstallLowercase ) ===
false ) {
535 $this->parent->showError(
'config-skins-must-enable-default' );
539 $extsAvailable = array_keys( $this->parent->findExtensions()->value );
541 foreach ( $extsAvailable as
$ext ) {
542 $this->parent->setVarsFromRequest( [
"ext-$ext" ] );
543 if ( $this->
getVar(
"ext-$ext" ) ) {
544 $extsToInstall[] =
$ext;
547 $this->parent->setVar(
'_Extensions', $extsToInstall );
549 if ( $this->
getVar(
'_MainCacheType' ) ==
'memcached' ) {
550 $memcServers = explode(
"\n", $this->
getVar(
'_MemCachedServers' ) );
551 if ( !$memcServers ) {
552 $this->parent->showError(
'config-memcache-needservers' );
556 foreach ( $memcServers as $server ) {
557 $memcParts = explode(
":", $server, 2 );
558 if ( !isset( $memcParts[0] )
559 || ( !IPUtils::isValid( $memcParts[0] )
560 && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) )
562 $this->parent->showError(
'config-memcache-badip', $memcParts[0] );
564 } elseif ( !isset( $memcParts[1] ) ) {
565 $this->parent->showError(
'config-memcache-noport', $memcParts[0] );
567 } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
568 $this->parent->showError(
'config-memcache-badport', 1, 65535 );