From: Sam Reed Date: Wed, 5 Jan 2011 19:28:00 +0000 (+0000) Subject: Refactor out protocol preperation to ApiQueryExtLinksUsage::prepareProtocols() X-Git-Tag: 1.31.0-rc.0~32800 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/supprimer.php?a=commitdiff_plain;h=f6c4df5eef18d971d827d74ba47f0884f53416ff;p=lhc%2Fweb%2Fwiklou.git Refactor out protocol preperation to ApiQueryExtLinksUsage::prepareProtocols() --- diff --git a/includes/api/ApiQueryExtLinksUsage.php b/includes/api/ApiQueryExtLinksUsage.php index 7bfa9cc9ee..1e26a9ac8e 100644 --- a/includes/api/ApiQueryExtLinksUsage.php +++ b/includes/api/ApiQueryExtLinksUsage.php @@ -154,12 +154,6 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { } public function getAllowedParams() { - global $wgUrlProtocols; - $protocols = array( '' ); - foreach ( $wgUrlProtocols as $p ) { - $protocols[] = substr( $p, 0, strpos( $p, ':' ) ); - } - return array( 'prop' => array( ApiBase::PARAM_ISMULTI => true, @@ -174,7 +168,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ApiBase::PARAM_TYPE => 'integer' ), 'protocol' => array( - ApiBase::PARAM_TYPE => $protocols, + ApiBase::PARAM_TYPE => self::prepareProtocols(), ApiBase::PARAM_DFLT => '', ), 'query' => null, @@ -192,6 +186,15 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase { ); } + public static function prepareProtocols() { + global $wgUrlProtocols; + $protocols = array( '' ); + foreach ( $wgUrlProtocols as $p ) { + $protocols[] = substr( $p, 0, strpos( $p, ':' ) ); + } + return $protocols; + } + public function getParamDescription() { $p = $this->getModulePrefix(); return array(