diff options
author | Sam Reed <reedy@users.mediawiki.org> | 2011-02-27 21:31:47 +0000 |
---|---|---|
committer | Sam Reed <reedy@users.mediawiki.org> | 2011-02-27 21:31:47 +0000 |
commit | 573abcbd8c222ce114f81779a9d3af7ab20e7a84 (patch) | |
tree | c4666b0b59ebb1960fd8b10b876d9f36d26154cb /includes/api/ApiQueryExternalLinks.php | |
parent | c07330264d560d666ef3dbc48be8649c818ad804 (diff) | |
download | mediawikicore-573abcbd8c222ce114f81779a9d3af7ab20e7a84.tar.gz mediawikicore-573abcbd8c222ce114f81779a9d3af7ab20e7a84.zip |
Refactor out the duplication I left with a TODO in r79659
Notes
Notes:
http://mediawiki.org/wiki/Special:Code/MediaWiki/82915
Diffstat (limited to 'includes/api/ApiQueryExternalLinks.php')
-rw-r--r-- | includes/api/ApiQueryExternalLinks.php | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/includes/api/ApiQueryExternalLinks.php b/includes/api/ApiQueryExternalLinks.php index ba5c996b328e..c4f8790d9516 100644 --- a/includes/api/ApiQueryExternalLinks.php +++ b/includes/api/ApiQueryExternalLinks.php @@ -59,21 +59,10 @@ class ApiQueryExternalLinks extends ApiQueryBase { $this->addTables( 'externallinks' ); $this->addWhereFld( 'el_from', array_keys( $this->getPageSet()->getGoodTitles() ) ); - //TODO: Refactor out, duplicated from ApiQueryExtLinksUsage - if ( !is_null( $query ) || $query != '' ) { - if ( is_null( $protocol ) ) { - $protocol = 'http://'; - } - - $likeQuery = LinkFilter::makeLikeArray( $query, $protocol ); - if ( !$likeQuery ) { - $this->dieUsage( 'Invalid query', 'bad_query' ); - } + $whereQuery = $this->prepareUrlQuerySearchString( $db, $query, $protocol ); - $likeQuery = LinkFilter::keepOneWildcard( $likeQuery ); - $this->addWhere( 'el_index ' . $db->buildLike( $likeQuery ) ); - } elseif ( !is_null( $protocol ) ) { - $this->addWhere( 'el_index ' . $db->buildLike( "$protocol", $db->anyString() ) ); + if ( $whereQuery !== null ) { + $this->addWhere( $whereQuery ); } // Don't order by el_from if it's constant in the WHERE clause |