Installer: use _MainCacheType form variable
authorsaper <saper@saper.info>
Fri, 23 Oct 2015 21:29:38 +0000 (23:29 +0200)
committerAaron Schulz <aschulz@wikimedia.org>
Mon, 26 Oct 2015 17:10:13 +0000 (17:10 +0000)
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
includes/installer/LocalSettingsGenerator.php
includes/installer/WebInstallerPage.php
mw-config/config.js

index 064bd6d..c46b3c2 100644 (file)
@@ -164,7 +164,6 @@ abstract class Installer {
                'wgRightsIcon',
                'wgRightsText',
                'wgRightsUrl',
-               'wgMainCacheType',
                'wgEnableEmail',
                'wgEnableUserEmail',
                'wgEnotifUserTalk',
index 5a2dd1a..8953bd1 100644 (file)
@@ -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:
index 0d11463..191c752 100644 (file)
@@ -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' );
index fb637f7..8b2d6e5 100644 (file)
@@ -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' );