Remove deprecated handling of array keys for $wgProxyList
authorThalia <thalia.e.chan@googlemail.com>
Wed, 24 Jul 2019 17:17:36 +0000 (18:17 +0100)
committerThalia <thalia.e.chan@googlemail.com>
Wed, 24 Jul 2019 20:45:45 +0000 (21:45 +0100)
Change-Id: Ic9cc2a5585180ab57fd361342cbac8210b094a5c

RELEASE-NOTES-1.34
includes/DefaultSettings.php
includes/block/BlockManager.php
tests/phpunit/includes/block/BlockManagerTest.php
tests/phpunit/includes/user/UserTest.php

index 7a24818..9330d10 100644 (file)
@@ -396,6 +396,9 @@ because of Phabricator reports.
   PermissionManager::getUserPermissions() instead.
 * The LocalisationCacheRecache hook no longer allows purging of message blobs
   to be prevented. Modifying the $purgeBlobs parameter now has no effect.
+* The use of $wgProxyList with IP addresses in the array keys, deprecated in
+  1.30, was removed. Instead, $wgProxyList should be an array with IP addresses
+  as the values, or a string path to a file containing one IP address per line.
 
 === Other changes in 1.34 ===
 * …
index 6a1f7b5..d23cc7b 100644 (file)
@@ -6002,9 +6002,8 @@ $wgSecretKey = false;
  * Big list of banned IP addresses.
  *
  * This can have the following formats:
- * - An array of addresses, either in the values
- *   or the keys (for backward compatibility, deprecated since 1.30)
- * - A string, in that case this is the path to a file
+ * - An array of addresses
+ * - A string, in which case this is the path to a file
  *   containing the list of IP addresses, one per line
  */
 $wgProxyList = [];
index 68141a1..c82ed1c 100644 (file)
@@ -293,32 +293,7 @@ class BlockManager {
                        $proxyList = array_map( 'trim', file( $proxyList ) );
                }
 
-               $resultProxyList = [];
-               $deprecatedIPEntries = [];
-
-               // backward compatibility: move all ip addresses in keys to values
-               foreach ( $proxyList as $key => $value ) {
-                       $keyIsIP = IP::isIPAddress( $key );
-                       $valueIsIP = IP::isIPAddress( $value );
-                       if ( $keyIsIP && !$valueIsIP ) {
-                               $deprecatedIPEntries[] = $key;
-                               $resultProxyList[] = $key;
-                       } elseif ( $keyIsIP && $valueIsIP ) {
-                               $deprecatedIPEntries[] = $key;
-                               $resultProxyList[] = $key;
-                               $resultProxyList[] = $value;
-                       } else {
-                               $resultProxyList[] = $value;
-                       }
-               }
-
-               if ( $deprecatedIPEntries ) {
-                       wfDeprecated(
-                               'IP addresses in the keys of $wgProxyList (found the following IP addresses in keys: ' .
-                               implode( ', ', $deprecatedIPEntries ) . ', please move them to values)', '1.30' );
-               }
-
-               $proxyListIPSet = new IPSet( $resultProxyList );
+               $proxyListIPSet = new IPSet( $proxyList );
                return $proxyListIPSet->match( $ip );
        }
 
index b8f60c4..f42777c 100644 (file)
@@ -160,27 +160,6 @@ class BlockManagerTest extends MediaWikiTestCase {
                ];
        }
 
-       /**
-        * @covers ::isLocallyBlockedProxy
-        */
-       public function testIsLocallyBlockedProxyDeprecated() {
-               $proxy = '1.2.3.4';
-
-               $this->hideDeprecated(
-                       'IP addresses in the keys of $wgProxyList (found the following IP ' .
-                       'addresses in keys: ' . $proxy . ', please move them to values)'
-               );
-
-               $blockManager = TestingAccessWrapper::newFromObject(
-                       $this->getBlockManager( [
-                               'wgProxyList' => [ $proxy => 'test' ]
-                       ] )
-               );
-
-               $ip = '1.2.3.4';
-               $this->assertTrue( $blockManager->isLocallyBlockedProxy( $ip ) );
-       }
-
        /**
         * @dataProvider provideIsDnsBlacklisted
         * @covers ::isDnsBlacklisted
index bb72315..62e8e23 100644 (file)
@@ -1021,18 +1021,6 @@ class UserTest extends MediaWikiTestCase {
                        ]
                );
                $this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
-
-               $this->hideDeprecated(
-                       'IP addresses in the keys of $wgProxyList (found the following IP ' .
-                       'addresses in keys: ' . $blockListEntry . ', please move them to values)'
-               );
-               $this->setMwGlobals(
-                       'wgProxyList',
-                       [
-                               $blockListEntry => 'test'
-                       ]
-               );
-               $this->assertTrue( User::isLocallyBlockedProxy( $ip ) );
        }
 
        /**