X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fsite%2FMediaWikiPageNameNormalizer.php;h=1a079b4295cf0009844b801ce505d5b7825cf6ab;hb=5f1a4a3dfc049a742184d5690d211fb0321c9b9d;hp=2f7173677906ff749370ca7cb45a6dcf538cc446;hpb=4b73a8b6fbb6da651af850a7d667e6e8d59e6fce;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/site/MediaWikiPageNameNormalizer.php b/includes/site/MediaWikiPageNameNormalizer.php index 2f71736779..1a079b4295 100644 --- a/includes/site/MediaWikiPageNameNormalizer.php +++ b/includes/site/MediaWikiPageNameNormalizer.php @@ -34,6 +34,22 @@ use UtfNormal\Validator; */ class MediaWikiPageNameNormalizer { + /** + * @var Http + */ + private $http; + + /** + * @param Http|null $http + */ + public function __construct( Http $http = null ) { + if ( !$http ) { + $http = new Http(); + } + + $this->http = $http; + } + /** * Returns the normalized form of the given page title, using the * normalization rules of the given site. If the given title is a redirect, @@ -85,7 +101,7 @@ class MediaWikiPageNameNormalizer { // Go on call the external site // @todo we need a good way to specify a timeout here. - $ret = Http::get( $url, [], __METHOD__ ); + $ret = $this->http->get( $url, [], __METHOD__ ); if ( $ret === false ) { wfDebugLog( "MediaWikiSite", "call to external site failed: $url" );