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'] ) ) {
209 foreach ( $dependencyMap[
$ext][
'skins'] as $name ) {
210 $links[] = Html::element(
212 [
'href' =>
"#config_skin-$name" ],
219 $text =
wfMessage(
'config-extensions-requires' )
225 $extHtml .= $this->parent->getCheckBox( [
228 'attribs' => $attribs,
229 'labelAttribs' => $labelAttribs,
234 $extHtml .= $this->parent->getHelpBox(
'config-extensions-help' ) .
238 $this->
addHTML( Html::inlineScript(
239 'var extDependencyMap = ' . Xml::encodeJsVar( $dependencyMap )
244 $this->
setVar(
'wgDeletedDirectory',
246 '/', DIRECTORY_SEPARATOR,
247 $this->
getVar(
'wgDeletedDirectory' )
251 $uploadwrapperStyle = $this->
getVar(
'wgEnableUploads' ) ?
'' :
'display: none';
255 $this->parent->getCheckBox( [
256 'var' =>
'wgEnableUploads',
257 'label' =>
'config-upload-enable',
258 'attribs' => [
'class' =>
'showHideRadio',
'rel' =>
'uploadwrapper' ],
259 'help' => $this->parent->getHelpBox(
'config-upload-help' )
261 '<div id="uploadwrapper" style="' . $uploadwrapperStyle .
'">' .
262 $this->parent->getTextBox( [
263 'var' =>
'wgDeletedDirectory',
264 'label' =>
'config-upload-deleted',
265 'attribs' => [
'dir' =>
'ltr' ],
266 'help' => $this->parent->getHelpBox(
'config-upload-deleted-help' )
269 $this->parent->getTextBox( [
271 'label' =>
'config-logo',
272 'attribs' => [
'dir' =>
'ltr' ],
273 'help' => $this->parent->getHelpBox(
'config-logo-help' )
277 $this->parent->getCheckBox( [
278 'var' =>
'wgUseInstantCommons',
279 'label' =>
'config-instantcommons',
280 'help' => $this->parent->getHelpBox(
'config-instantcommons-help' )
282 $this->getFieldsetEnd()
285 $caches = [
'none' ];
286 $cachevalDefault =
'none';
288 if ( count( $this->
getVar(
'_Caches' ) ) ) {
291 $cachevalDefault =
'accel';
293 $caches[] =
'memcached';
296 $cacheval = $this->
getVar(
'_MainCacheType' );
301 $cacheval = $cachevalDefault;
303 $hidden = ( $cacheval ==
'memcached' ) ?
'' :
'display: none';
307 # Object cache settings
311 $this->parent->getRadioSet( [
312 'var' =>
'_MainCacheType',
313 'label' =>
'config-cache-options',
314 'itemLabelPrefix' =>
'config-cache-',
316 'value' => $cacheval,
318 $this->parent->getHelpBox(
'config-cache-help' ) .
319 "<div id=\"config-memcachewrapper\" style=\"$hidden\">" .
320 $this->parent->getTextArea( [
321 'var' =>
'_MemCachedServers',
322 'label' =>
'config-memcached-servers',
323 'help' => $this->parent->getHelpBox(
'config-memcached-help' )
326 $this->getFieldsetEnd()
478 $this->parent->setVarsFromRequest( [
'_RightsProfile',
'_LicenseCode',
479 'wgEnableEmail',
'wgPasswordSender',
'wgEnableUploads',
'_Logo',
480 'wgEnableUserEmail',
'wgEnotifUserTalk',
'wgEnotifWatchlist',
481 'wgEmailAuthentication',
'_MainCacheType',
'_MemCachedServers',
482 'wgUseInstantCommons',
'wgDefaultSkin' ] );
486 if ( !array_key_exists( $this->
getVar(
'_RightsProfile' ), $this->parent->rightsProfiles ) ) {
487 reset( $this->parent->rightsProfiles );
488 $this->
setVar(
'_RightsProfile', key( $this->parent->rightsProfiles ) );
493 if ( strval( $this->
getVar(
'_Logo' ) ) ===
'' ) {
494 $this->parent->showError(
'config-install-logo-blank' );
498 $code = $this->
getVar(
'_LicenseCode' );
499 if ( $code ==
'cc-choose' ) {
500 if ( !$this->
getVar(
'_CCDone' ) ) {
501 $this->parent->showError(
'config-cc-not-chosen' );
504 } elseif ( array_key_exists( $code, $this->parent->licenses ) ) {
509 $entry = $this->parent->licenses[$code];
510 $this->
setVar(
'wgRightsText',
511 $entry[
'text'] ??
wfMessage(
'config-license-' . $code )->text() );
512 $this->
setVar(
'wgRightsUrl', $entry[
'url'] );
513 $this->
setVar(
'wgRightsIcon', $entry[
'icon'] );
515 $this->
setVar(
'wgRightsText',
'' );
516 $this->
setVar(
'wgRightsUrl',
'' );
517 $this->
setVar(
'wgRightsIcon',
'' );
520 $skinsAvailable = array_keys( $this->parent->findExtensions(
'skins' )->value );
521 $skinsToInstall = [];
522 foreach ( $skinsAvailable as $skin ) {
523 $this->parent->setVarsFromRequest( [
"skin-$skin" ] );
524 if ( $this->
getVar(
"skin-$skin" ) ) {
525 $skinsToInstall[] = $skin;
528 $this->parent->setVar(
'_Skins', $skinsToInstall );
530 if ( !$skinsToInstall && $skinsAvailable ) {
531 $this->parent->showError(
'config-skins-must-enable-some' );
534 $defaultSkin = $this->
getVar(
'wgDefaultSkin' );
535 $skinsToInstallLowercase = array_map(
'strtolower', $skinsToInstall );
536 if ( $skinsToInstall && array_search( $defaultSkin, $skinsToInstallLowercase ) ===
false ) {
537 $this->parent->showError(
'config-skins-must-enable-default' );
541 $extsAvailable = array_keys( $this->parent->findExtensions()->value );
543 foreach ( $extsAvailable as
$ext ) {
544 $this->parent->setVarsFromRequest( [
"ext-$ext" ] );
545 if ( $this->
getVar(
"ext-$ext" ) ) {
546 $extsToInstall[] =
$ext;
549 $this->parent->setVar(
'_Extensions', $extsToInstall );
551 if ( $this->
getVar(
'_MainCacheType' ) ==
'memcached' ) {
552 $memcServers = explode(
"\n", $this->
getVar(
'_MemCachedServers' ) );
553 if ( !$memcServers ) {
554 $this->parent->showError(
'config-memcache-needservers' );
558 foreach ( $memcServers as $server ) {
559 $memcParts = explode(
":", $server, 2 );
560 if ( !isset( $memcParts[0] )
561 || ( !IPUtils::isValid( $memcParts[0] )
562 && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) )
564 $this->parent->showError(
'config-memcache-badip', $memcParts[0] );
566 } elseif ( !isset( $memcParts[1] ) ) {
567 $this->parent->showError(
'config-memcache-noport', $memcParts[0] );
569 } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
570 $this->parent->showError(
'config-memcache-badport', 1, 65535 );