Merge "API: Fix ApiQueryBacklinks logic and use *_from_namespace"
[lhc/web/wiklou.git] / includes / api / ApiQueryExtLinksUsage.php
index 070681c..faabb92 100644 (file)
@@ -59,9 +59,8 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                $this->addOption( 'USE INDEX', 'el_index' );
                $this->addWhere( 'page_id=el_from' );
 
-               global $wgMiserMode;
                $miser_ns = array();
-               if ( $wgMiserMode ) {
+               if ( $this->getConfig()->get( 'MiserMode' ) ) {
                        $miser_ns = $params['namespace'];
                } else {
                        $this->addWhereFld( 'page_namespace', $params['namespace'] );
@@ -209,7 +208,6 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
        }
 
        public function getParamDescription() {
-               global $wgMiserMode;
                $p = $this->getModulePrefix();
                $desc = array(
                        'prop' => array(
@@ -230,7 +228,7 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                        'expandurl' => 'Expand protocol-relative URLs with the canonical protocol',
                );
 
-               if ( $wgMiserMode ) {
+               if ( $this->getConfig()->get( 'MiserMode' ) ) {
                        $desc['namespace'] = array(
                                $desc['namespace'],
                                "NOTE: Due to \$wgMiserMode, using this may result in fewer than \"{$p}limit\" results",
@@ -241,31 +239,10 @@ class ApiQueryExtLinksUsage extends ApiQueryGeneratorBase {
                return $desc;
        }
 
-       public function getResultProperties() {
-               return array(
-                       'ids' => array(
-                               'pageid' => 'integer'
-                       ),
-                       'title' => array(
-                               'ns' => 'namespace',
-                               'title' => 'string'
-                       ),
-                       'url' => array(
-                               'url' => 'string'
-                       )
-               );
-       }
-
        public function getDescription() {
                return 'Enumerate pages that contain a given URL.';
        }
 
-       public function getPossibleErrors() {
-               return array_merge( parent::getPossibleErrors(), array(
-                       array( 'code' => 'bad_query', 'info' => 'Invalid query' ),
-               ) );
-       }
-
        public function getExamples() {
                return array(
                        'api.php?action=query&list=exturlusage&euquery=www.mediawiki.org'