From 1730a179290798d421959f6c09238495d6bbb573 Mon Sep 17 00:00:00 2001 From: saper Date: Fri, 23 Oct 2015 23:29:38 +0200 Subject: [PATCH] Installer: use _MainCacheType form variable Do not use "wgMainCacheType" form variable name that contains values that cannot be assigned to $wgMainCacheType Bug: T116375 Change-Id: I83459c8006cc4c1bcdeaa0d78a1230687c95db46 --- includes/installer/Installer.php | 1 - includes/installer/LocalSettingsGenerator.php | 8 ++++---- includes/installer/WebInstallerPage.php | 8 ++++---- mw-config/config.js | 4 ++-- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 064bd6df4f..c46b3c2c60 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -164,7 +164,6 @@ abstract class Installer { 'wgRightsIcon', 'wgRightsText', 'wgRightsUrl', - 'wgMainCacheType', 'wgEnableEmail', 'wgEnableUserEmail', 'wgEnotifUserTalk', diff --git a/includes/installer/LocalSettingsGenerator.php b/includes/installer/LocalSettingsGenerator.php index 5a2dd1a205..8953bd106f 100644 --- a/includes/installer/LocalSettingsGenerator.php +++ b/includes/installer/LocalSettingsGenerator.php @@ -62,8 +62,8 @@ class LocalSettingsGenerator { 'wgLanguageCode', 'wgEnableEmail', 'wgEnableUserEmail', 'wgDiff3', 'wgEnotifUserTalk', 'wgEnotifWatchlist', 'wgEmailAuthentication', 'wgDBtype', 'wgSecretKey', 'wgRightsUrl', 'wgSitename', 'wgRightsIcon', - 'wgRightsText', 'wgMainCacheType', 'wgEnableUploads', - 'wgMainCacheType', '_MemCachedServers', 'wgDBserver', 'wgDBuser', + 'wgRightsText', '_MainCacheType', 'wgEnableUploads', + '_MemCachedServers', 'wgDBserver', 'wgDBuser', 'wgDBpassword', 'wgUseInstantCommons', 'wgUpgradeKey', 'wgDefaultSkin', 'wgMetaNamespace', 'wgLogo', ), @@ -290,12 +290,12 @@ class LocalSettingsGenerator { $serverSetting .= "\$wgServer = \"{$this->values['wgServer']}\";\n"; } - switch ( $this->values['wgMainCacheType'] ) { + switch ( $this->values['_MainCacheType'] ) { case 'anything': case 'db': case 'memcached': case 'accel': - $cacheType = 'CACHE_' . strtoupper( $this->values['wgMainCacheType'] ); + $cacheType = 'CACHE_' . strtoupper( $this->values['_MainCacheType'] ); break; case 'none': default: diff --git a/includes/installer/WebInstallerPage.php b/includes/installer/WebInstallerPage.php index 0d11463c62..191c752bb1 100644 --- a/includes/installer/WebInstallerPage.php +++ b/includes/installer/WebInstallerPage.php @@ -1131,7 +1131,7 @@ class WebInstallerOptions extends WebInstallerPage { $caches[] = 'memcached'; // We'll hide/show this on demand when the value changes, see config.js. - $cacheval = $this->getVar( 'wgMainCacheType' ); + $cacheval = $this->getVar( '_MainCacheType' ); if ( !$cacheval ) { // We need to set a default here; but don't hardcode it // or we lose it every time we reload the page for validation @@ -1147,7 +1147,7 @@ class WebInstallerOptions extends WebInstallerPage { // For grep: The following messages are used as the item labels: // config-cache-none, config-cache-accel, config-cache-memcached $this->parent->getRadioSet( array( - 'var' => 'wgMainCacheType', + 'var' => '_MainCacheType', 'label' => 'config-cache-options', 'itemLabelPrefix' => 'config-cache-', 'values' => $caches, @@ -1285,7 +1285,7 @@ class WebInstallerOptions extends WebInstallerPage { $this->parent->setVarsFromRequest( array( '_RightsProfile', '_LicenseCode', 'wgEnableEmail', 'wgPasswordSender', 'wgEnableUploads', 'wgLogo', 'wgEnableUserEmail', 'wgEnotifUserTalk', 'wgEnotifWatchlist', - 'wgEmailAuthentication', 'wgMainCacheType', '_MemCachedServers', + 'wgEmailAuthentication', '_MainCacheType', '_MemCachedServers', 'wgUseInstantCommons', 'wgDefaultSkin' ) ); $retVal = true; @@ -1351,7 +1351,7 @@ class WebInstallerOptions extends WebInstallerPage { } $this->parent->setVar( '_Extensions', $extsToInstall ); - if ( $this->getVar( 'wgMainCacheType' ) == 'memcached' ) { + if ( $this->getVar( '_MainCacheType' ) == 'memcached' ) { $memcServers = explode( "\n", $this->getVar( '_MemCachedServers' ) ); if ( !$memcServers ) { $this->parent->showError( 'config-memcache-needservers' ); diff --git a/mw-config/config.js b/mw-config/config.js index fb637f7906..8b2d6e5ab4 100644 --- a/mw-config/config.js +++ b/mw-config/config.js @@ -96,9 +96,9 @@ $( '#config_wgSitename' ).on( 'keyup change', syncText ).each( syncText ); // Show/Hide memcached servers when needed - $( 'input[name$="config_wgMainCacheType"]' ).change( function () { + $( 'input[name$="config__MainCacheType"]' ).change( function () { var $memc = $( '#config-memcachewrapper' ); - if ( $( 'input[name$="config_wgMainCacheType"]:checked' ).val() === 'memcached' ) { + if ( $( 'input[name$="config__MainCacheType"]:checked' ).val() === 'memcached' ) { $memc.show( 'slow' ); } else { $memc.hide( 'slow' ); -- 2.20.1