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' )->value;
108 '@phan-var array[] $skins';
111 $skinNames = array_map(
'strtolower', array_keys( $skins ) );
112 $chosenSkinName = $this->
getVar(
'wgDefaultSkin', $this->parent->getDefaultSkin( $skinNames ) );
115 $radioButtons = $this->parent->getRadioElements( [
116 'var' =>
'wgDefaultSkin',
117 'itemLabels' => array_fill_keys( $skinNames,
'config-skins-use-as-default' ),
118 'values' => $skinNames,
119 'value' => $chosenSkinName,
122 foreach ( $skins as $skin => $info ) {
123 if ( isset( $info[
'screenshots'] ) ) {
126 $screenshotText = htmlspecialchars( $skin );
129 '<div class="config-skins-item">' .
130 $this->parent->getCheckBox( [
131 'var' =>
"skin-$skin",
132 'rawtext' => $screenshotText,
133 'value' => $this->
getVar(
"skin-$skin",
true ),
135 '<div class="config-skins-use-as-default">' . $radioButtons[strtolower( $skin )] .
'</div>' .
140 Html::warningBox(
wfMessage(
'config-skins-missing' )->plain(),
'config-warning-box' ) .
141 Html::hidden(
'config_wgDefaultSkin', $chosenSkinName );
144 $skinHtml .= $this->parent->getHelpBox(
'config-skins-help' ) .
148 $extensions = $this->parent->findExtensions()->value;
149 '@phan-var array[] $extensions';
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( [
224 'attribs' => $attribs,
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';
303 # Object cache settings
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()
473 $this->parent->setVarsFromRequest( [
'_RightsProfile',
'_LicenseCode',
474 'wgEnableEmail',
'wgPasswordSender',
'wgEnableUploads',
'wgLogo',
475 'wgEnableUserEmail',
'wgEnotifUserTalk',
'wgEnotifWatchlist',
476 'wgEmailAuthentication',
'_MainCacheType',
'_MemCachedServers',
477 'wgUseInstantCommons',
'wgDefaultSkin' ] );
481 if ( !array_key_exists( $this->
getVar(
'_RightsProfile' ), $this->parent->rightsProfiles ) ) {
482 reset( $this->parent->rightsProfiles );
483 $this->
setVar(
'_RightsProfile', key( $this->parent->rightsProfiles ) );
486 $code = $this->
getVar(
'_LicenseCode' );
487 if ( $code ==
'cc-choose' ) {
488 if ( !$this->
getVar(
'_CCDone' ) ) {
489 $this->parent->showError(
'config-cc-not-chosen' );
492 } elseif ( array_key_exists( $code, $this->parent->licenses ) ) {
497 $entry = $this->parent->licenses[$code];
498 $this->
setVar(
'wgRightsText',
499 $entry[
'text'] ??
wfMessage(
'config-license-' . $code )->text() );
500 $this->
setVar(
'wgRightsUrl', $entry[
'url'] );
501 $this->
setVar(
'wgRightsIcon', $entry[
'icon'] );
503 $this->
setVar(
'wgRightsText',
'' );
504 $this->
setVar(
'wgRightsUrl',
'' );
505 $this->
setVar(
'wgRightsIcon',
'' );
508 $skinsAvailable = array_keys( $this->parent->findExtensions(
'skins' )->value );
509 $skinsToInstall = [];
510 foreach ( $skinsAvailable as $skin ) {
511 $this->parent->setVarsFromRequest( [
"skin-$skin" ] );
512 if ( $this->
getVar(
"skin-$skin" ) ) {
513 $skinsToInstall[] = $skin;
516 $this->parent->setVar(
'_Skins', $skinsToInstall );
518 if ( !$skinsToInstall && $skinsAvailable ) {
519 $this->parent->showError(
'config-skins-must-enable-some' );
522 $defaultSkin = $this->
getVar(
'wgDefaultSkin' );
523 $skinsToInstallLowercase = array_map(
'strtolower', $skinsToInstall );
524 if ( $skinsToInstall && array_search( $defaultSkin, $skinsToInstallLowercase ) ===
false ) {
525 $this->parent->showError(
'config-skins-must-enable-default' );
529 $extsAvailable = array_keys( $this->parent->findExtensions()->value );
531 foreach ( $extsAvailable as
$ext ) {
532 $this->parent->setVarsFromRequest( [
"ext-$ext" ] );
533 if ( $this->
getVar(
"ext-$ext" ) ) {
534 $extsToInstall[] =
$ext;
537 $this->parent->setVar(
'_Extensions', $extsToInstall );
539 if ( $this->
getVar(
'_MainCacheType' ) ==
'memcached' ) {
540 $memcServers = explode(
"\n", $this->
getVar(
'_MemCachedServers' ) );
541 if ( !$memcServers ) {
542 $this->parent->showError(
'config-memcache-needservers' );
546 foreach ( $memcServers as $server ) {
547 $memcParts = explode(
":", $server, 2 );
548 if ( !isset( $memcParts[0] )
549 || ( !IP::isValid( $memcParts[0] )
550 && ( gethostbyname( $memcParts[0] ) == $memcParts[0] ) )
552 $this->parent->showError(
'config-memcache-badip', $memcParts[0] );
554 } elseif ( !isset( $memcParts[1] ) ) {
555 $this->parent->showError(
'config-memcache-noport', $memcParts[0] );
557 } elseif ( $memcParts[1] < 1 || $memcParts[1] > 65535 ) {
558 $this->parent->showError(
'config-memcache-badport', 1, 65535 );