X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiQueryExtLinksUsage.php;h=98380d66c758a8b0c1b9adc8d31dcd12f45d6fb5;hb=90bf090dd3f4465a8fb95aacb69fb0c304bc153a;hp=42b398ba92595d5ab5d23cdcbe0ff893f3837885;hpb=03362607569f2d5e026bbbbc9724e7b1fdc2aa96;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index 42b398ba92..98380d66c7 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -121,8 +121,12 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ApiQueryBase::addTitleInfo( $vals, $title ); } if ( $fld_url ) { - // We *could* run this through wfExpandUrl() but I think it's better to output the link verbatim, even if it's protocol-relative --Roan - $vals['url'] = $row->el_to; + $to = $row->el_to; + // expand protocol-relative urls + if( $params['expandurl'] ) { + $to = wfExpandUrl( $to, PROTO_CANONICAL ); + } + $vals['url'] = $to; } $fit = $result->addValue( array( 'query', $this->getModuleName() ), null, $vals ); if ( !$fit ) { @@ -169,7 +173,8 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ApiBase::PARAM_MIN => 1, ApiBase::PARAM_MAX => ApiBase::LIMIT_BIG1, ApiBase::PARAM_MAX2 => ApiBase::LIMIT_BIG2 - ) + ), + 'expandurl' => false, ); } @@ -218,7 +223,8 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ), 'query' => 'Search string without protocol. See [[Special:LinkSearch]]. Leave empty to list all external links', 'namespace' => 'The page namespace(s) to enumerate.', - 'limit' => 'How many pages to return.' + 'limit' => 'How many pages to return.', + 'expandurl' => 'Expand protocol-relative urls with the canonical protocol', ); if ( $wgMiserMode ) { @@ -266,8 +272,4 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { public function getHelpUrls() { return 'https://www.mediawiki.org/wiki/API:Exturlusage'; } - - public function getVersion() { - return __CLASS__ . ': $Id$'; - } }