r79657 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r79656‎ | r79657 | r79658 >
Date:19:28, 5 January 2011
Author:reedy
Status:ok (Comments)
Tags:
Comment:
Refactor out protocol preperation to ApiQueryExtLinksUsage::prepareProtocols()
Modified paths:
  • /trunk/phase3/includes/api/ApiQueryExtLinksUsage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/api/ApiQueryExtLinksUsage.php
@@ -154,12 +154,6 @@
155155 }
156156
157157 public function getAllowedParams() {
158 - global $wgUrlProtocols;
159 - $protocols = array( '' );
160 - foreach ( $wgUrlProtocols as $p ) {
161 - $protocols[] = substr( $p, 0, strpos( $p, ':' ) );
162 - }
163 -
164158 return array(
165159 'prop' => array(
166160 ApiBase::PARAM_ISMULTI => true,
@@ -174,7 +168,7 @@
175169 ApiBase::PARAM_TYPE => 'integer'
176170 ),
177171 'protocol' => array(
178 - ApiBase::PARAM_TYPE => $protocols,
 172+ ApiBase::PARAM_TYPE => self::prepareProtocols(),
179173 ApiBase::PARAM_DFLT => '',
180174 ),
181175 'query' => null,
@@ -192,6 +186,15 @@
193187 );
194188 }
195189
 190+ public static function prepareProtocols() {
 191+ global $wgUrlProtocols;
 192+ $protocols = array( '' );
 193+ foreach ( $wgUrlProtocols as $p ) {
 194+ $protocols[] = substr( $p, 0, strpos( $p, ':' ) );
 195+ }
 196+ return $protocols;
 197+ }
 198+
196199 public function getParamDescription() {
197200 $p = $this->getModulePrefix();
198201 return array(

Comments

#Comment by Jack Phoenix (talk | contribs)   19:34, 5 January 2011

+ return $protocols; You really like those spaces, don't you? ;-)

#Comment by Reedy (talk | contribs)   19:50, 5 January 2011

BAHHH

Fixed in the next revisions

Status & tagging log