From 85eee307b22944f74b5e1e5476d3274ff6083b8e Mon Sep 17 00:00:00 2001 From: Chad Horohoe Date: Tue, 2 Sep 2008 15:15:54 +0000 Subject: [PATCH] Fully deprecate $wgProxyKey. Has been marked as deprecated since 1.4, but never seems to have been done. Sites with $wgProxyKey set will continue to use the setting (added a fallback in Setup). Fixes bugs 9258 and 12089. --- RELEASE-NOTES | 3 +++ config/index.php | 2 +- includes/DefaultSettings.php | 2 -- includes/ProxyTools.php | 4 ++-- includes/Setup.php | 4 ++++ includes/User.php | 4 +--- includes/specials/SpecialBlockme.php | 4 ++-- 7 files changed, 13 insertions(+), 10 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 988663543e..19b60ceb1b 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -46,6 +46,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * $wgAllowExternalImagesFrom may now be an array of multiple strings. * Introduced $wgEnableImageWhitelist to toggle the on-wiki external image whitelist on or off. +* $wgProxyKey has been fully deprecated (marked as such since 1.4, never + seems to have been completed). $wgSecretKey is the official documented + setting now. === New features in 1.14 === diff --git a/config/index.php b/config/index.php index a0d7f4fbe4..785ec21a86 100644 --- a/config/index.php +++ b/config/index.php @@ -1706,7 +1706,7 @@ if ( \$wgCommandLineMode ) { \$wgLanguageCode = \"{$slconf['LanguageCode']}\"; -\$wgProxyKey = \"$secretKey\"; +\$wgSecretKey = \"$secretKey\"; ## Default skin: you can change the default skin. Use the internal symbolic ## names, ie 'standard', 'nostalgia', 'cologneblue', 'monobook': diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index ef02aae090..64a0cab881 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -1357,8 +1357,6 @@ $wgProxyMemcExpiry = 86400; $wgSecretKey = false; /** big list of banned IP addresses, in the keys not the values */ $wgProxyList = array(); -/** deprecated */ -$wgProxyKey = false; /** Number of accounts each IP address may create, 0 to disable. * Requires memcached */ diff --git a/includes/ProxyTools.php b/includes/ProxyTools.php index 759857d683..a89283c3bc 100644 --- a/includes/ProxyTools.php +++ b/includes/ProxyTools.php @@ -138,7 +138,7 @@ function wfIsTrustedProxy( $ip ) { function wfProxyCheck() { global $wgBlockOpenProxies, $wgProxyPorts, $wgProxyScriptPath; global $wgMemc, $wgProxyMemcExpiry; - global $wgProxyKey; + global $wgSecretKey; if ( !$wgBlockOpenProxies ) { return; @@ -154,7 +154,7 @@ function wfProxyCheck() { # Fork the processes if ( !$skip ) { $title = SpecialPage::getTitleFor( 'Blockme' ); - $iphash = md5( $ip . $wgProxyKey ); + $iphash = md5( $ip . $wgSecretKey ); $url = $title->getFullURL( 'ip='.$iphash ); foreach ( $wgProxyPorts as $port ) { diff --git a/includes/Setup.php b/includes/Setup.php index ecc6deff73..148af48d1c 100644 --- a/includes/Setup.php +++ b/includes/Setup.php @@ -150,6 +150,10 @@ require_once( "$IP/includes/StubObject.php" ); wfProfileOut( $fname.'-includes' ); wfProfileIn( $fname.'-misc1' ); +# Override SecretKey with ProxyKey if a site is using the old setting +if ( isset( $wgProxyKey ) ) { + $wgSecretKey = $wgProxyKey; +} $wgIP = false; # Load on demand # Can't stub this one, it sets up $_GET and $_REQUEST in its constructor diff --git a/includes/User.php b/includes/User.php index 5fa2ff5c28..25791e4d5d 100644 --- a/includes/User.php +++ b/includes/User.php @@ -1650,13 +1650,11 @@ class User { * @private */ function setToken( $token = false ) { - global $wgSecretKey, $wgProxyKey; + global $wgSecretKey; $this->load(); if ( !$token ) { if ( $wgSecretKey ) { $key = $wgSecretKey; - } elseif ( $wgProxyKey ) { - $key = $wgProxyKey; } else { $key = microtime(); } diff --git a/includes/specials/SpecialBlockme.php b/includes/specials/SpecialBlockme.php index f222e3c63e..81d368405c 100644 --- a/includes/specials/SpecialBlockme.php +++ b/includes/specials/SpecialBlockme.php @@ -8,11 +8,11 @@ * */ function wfSpecialBlockme() { - global $wgRequest, $wgBlockOpenProxies, $wgOut, $wgProxyKey; + global $wgRequest, $wgBlockOpenProxies, $wgOut, $wgSecretKey; $ip = wfGetIP(); - if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgProxyKey ) ) { + if( !$wgBlockOpenProxies || $wgRequest->getText( 'ip' ) != md5( $ip . $wgSecretKey ) ) { $wgOut->addWikiMsg( 'proxyblocker-disabled' ); return; } -- 2.20.1