API: Normalize input URL in ApiQueryExtLinksUsage
authorBrad Jorsch <bjorsch@wikimedia.org>
Sat, 26 Mar 2016 22:14:43 +0000 (18:14 -0400)
committerBrad Jorsch <bjorsch@wikimedia.org>
Sat, 26 Mar 2016 22:14:43 +0000 (18:14 -0400)
This matches the behavior of Special:LinkSearch, and makes it more
likely to give sensible results for non-normalized input.

Bug: T130912
Change-Id: I2f60dd48fdfc24108110a24ad41b297ece7f33df

includes/api/ApiQueryExtLinksUsage.php

index 404fc19..9b05537 100644 (file)
@@ -66,6 +66,9 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                        $this->addWhereFld( 'page_namespace', $params['namespace'] );
                }
 
+               // Normalize query to match the normalization applied for the externallinks table
+               $query = Parser::normalizeLinkUrl( $query );
+
                $whereQuery = $this->prepareUrlQuerySearchString( $query, $protocol );
 
                if ( $whereQuery !== null ) {