From f6c4df5eef18d971d827d74ba47f0884f53416ff Mon Sep 17 00:00:00 2001 From: Sam Reed Date: Wed, 5 Jan 2011 19:28:00 +0000 Subject: [PATCH] Refactor out protocol preperation to ApiQueryExtLinksUsage::prepareProtocols() --- includes/api/ApiQueryExtLinksUsage.php | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) 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( -- 2.20.1