From bb519a91dfe64ab635c73e01636436c24c76ffc6 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Tue, 31 Dec 2013 15:31:26 -0800 Subject: [PATCH] Moved HashRing to /libs Change-Id: I0b74b386f7459f550816f99aa7e00970c3cff4c7 --- includes/AutoLoader.php | 2 +- includes/{utils => libs}/HashRing.php | 2 +- tests/phpunit/includes/{utils => libs}/HashRingTest.php | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename includes/{utils => libs}/HashRing.php (98%) rename tests/phpunit/includes/{utils => libs}/HashRingTest.php (100%) diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php index 09cbe827d3..2ec9907293 100644 --- a/includes/AutoLoader.php +++ b/includes/AutoLoader.php @@ -678,6 +678,7 @@ $wgAutoloadLocalClasses = array( 'CSSJanus_Tokenizer' => 'includes/libs/CSSJanus.php', 'CSSMin' => 'includes/libs/CSSMin.php', 'GenericArrayObject' => 'includes/libs/GenericArrayObject.php', + 'HashRing' => 'includes/libs/HashRing.php', 'HttpStatus' => 'includes/libs/HttpStatus.php', 'IEContentAnalyzer' => 'includes/libs/IEContentAnalyzer.php', 'IEUrlExtension' => 'includes/libs/IEUrlExtension.php', @@ -1071,7 +1072,6 @@ $wgAutoloadLocalClasses = array( 'ConfEditorToken' => 'includes/utils/ConfEditor.php', 'DoubleReplacer' => 'includes/utils/StringUtils.php', 'ExplodeIterator' => 'includes/utils/StringUtils.php', - 'HashRing' => 'includes/utils/HashRing.php', 'HashtableReplacer' => 'includes/utils/StringUtils.php', 'IP' => 'includes/utils/IP.php', 'MWCryptRand' => 'includes/utils/MWCryptRand.php', diff --git a/includes/utils/HashRing.php b/includes/libs/HashRing.php similarity index 98% rename from includes/utils/HashRing.php rename to includes/libs/HashRing.php index c152d410b0..6925c7fb6d 100644 --- a/includes/utils/HashRing.php +++ b/includes/libs/HashRing.php @@ -42,7 +42,7 @@ class HashRing { return $w > 0; } ); if ( !count( $map ) ) { - throw new MWException( "Ring is empty or all weights are zero." ); + throw new UnexpectedValueException( "Ring is empty or all weights are zero." ); } $this->sourceMap = $map; // Sort the locations based on the hash of their names diff --git a/tests/phpunit/includes/utils/HashRingTest.php b/tests/phpunit/includes/libs/HashRingTest.php similarity index 100% rename from tests/phpunit/includes/utils/HashRingTest.php rename to tests/phpunit/includes/libs/HashRingTest.php -- 2.20.1