Index: trunk/phase3/includes/api/ApiQueryExtLinksUsage.php |
— | — | @@ -54,7 +54,7 @@ |
55 | 55 | |
56 | 56 | // Find the right prefix |
57 | 57 | global $wgUrlProtocols; |
58 | | - if(!is_null($protocol) && !empty($protocol) && !in_array($protocol, $wgUrlProtocols)) |
| 58 | + if(!is_null($protocol) && $protocol != '' && !in_array($protocol, $wgUrlProtocols)) |
59 | 59 | { |
60 | 60 | foreach ($wgUrlProtocols as $p) { |
61 | 61 | if( substr( $p, 0, strlen( $protocol ) ) === $protocol ) { |
— | — | @@ -63,8 +63,6 @@ |
64 | 64 | } |
65 | 65 | } |
66 | 66 | } |
67 | | - else |
68 | | - $protocol = null; |
69 | 67 | |
70 | 68 | $db = $this->getDb(); |
71 | 69 | $this->addTables(array('page','externallinks')); // must be in this order for 'USE INDEX' |
— | — | @@ -74,17 +72,12 @@ |
75 | 73 | |
76 | 74 | if(!is_null($query) || $query != '') |
77 | 75 | { |
78 | | - if(is_null($protocol)) |
79 | | - $protocol = 'http'; |
80 | | - |
81 | | - $likeQuery = LinkFilter::makeLike($query, $protocol); |
| 76 | + $likeQuery = LinkFilter::makeLike($query , $protocol); |
82 | 77 | if (!$likeQuery) |
83 | 78 | $this->dieUsage('Invalid query', 'bad_query'); |
84 | 79 | $likeQuery = substr($likeQuery, 0, strpos($likeQuery,'%')+1); |
85 | 80 | $this->addWhere('el_index LIKE ' . $db->addQuotes( $likeQuery )); |
86 | 81 | } |
87 | | - else if(!is_null($protocol)) |
88 | | - $this->addWhere('el_index LIKE ' . $db->addQuotes( "$protocol%" )); |
89 | 82 | |
90 | 83 | $prop = array_flip($params['prop']); |
91 | 84 | $fld_ids = isset($prop['ids']); |
— | — | @@ -146,7 +139,7 @@ |
147 | 140 | |
148 | 141 | public function getAllowedParams() { |
149 | 142 | global $wgUrlProtocols; |
150 | | - $protocols = array(''); |
| 143 | + $protocols = array(); |
151 | 144 | foreach ($wgUrlProtocols as $p) { |
152 | 145 | $protocols[] = substr($p, 0, strpos($p,':')); |
153 | 146 | } |
— | — | @@ -166,7 +159,7 @@ |
167 | 160 | ), |
168 | 161 | 'protocol' => array ( |
169 | 162 | ApiBase :: PARAM_TYPE => $protocols, |
170 | | - ApiBase :: PARAM_DFLT => '', |
| 163 | + ApiBase :: PARAM_DFLT => 'http', |
171 | 164 | ), |
172 | 165 | 'query' => null, |
173 | 166 | 'namespace' => array ( |
— | — | @@ -187,9 +180,8 @@ |
188 | 181 | return array ( |
189 | 182 | 'prop' => 'What pieces of information to include', |
190 | 183 | 'offset' => 'Used for paging. Use the value returned for "continue"', |
191 | | - 'protocol' => array( 'Protocol of the url. If empty and euquery set, the protocol is http.', |
192 | | - 'Leave both this and euquery empty to list all external links'), |
193 | | - 'query' => 'Search string without protocol. See [[Special:LinkSearch]]. Leave empty to list all external links', |
| 184 | + 'protocol' => 'Protocol of the url', |
| 185 | + 'query' => 'Search string without protocol. See [[Special:LinkSearch]]. Leave empty to list all external links (euprotocol will be ignored)', |
194 | 186 | 'namespace' => 'The page namespace(s) to enumerate.', |
195 | 187 | 'limit' => 'How many entries to return.' |
196 | 188 | ); |
Index: trunk/phase3/RELEASE-NOTES |
— | — | @@ -540,7 +540,6 @@ |
541 | 541 | prop={links,templatelinks,langlinks,extlinks,categories,images} |
542 | 542 | * Added flag "top" to list=usercontribs if the user is the last contributor to |
543 | 543 | the page |
544 | | -* list=exturlusage in "list all links" mode can now filter by protocol |
545 | 544 | |
546 | 545 | === Languages updated in 1.13 === |
547 | 546 | |