From 7e5449b4d218251865946e6625c205e8bcd40fdc Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Tue, 18 Mar 2008 19:31:02 +0000 Subject: [PATCH] API: * (bug 13418) Disable eiredirect because it's useless (see also Bugzilla) * (bug 13419) Make gblredirect actually work --- RELEASE-NOTES | 2 ++ includes/api/ApiQueryBacklinks.php | 29 +++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 756665ad3e..2fa88f4387 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -118,6 +118,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * (bug 13371) Build page set from image hashes * Mark non-existent messages in meta=allmessages as missing * (bug 13390) One invalid title no longer kills an entire API query +* (bug 13419) Fix gblredirect so it actually works +* (bug 13418) Disable eiredirect because it's useless === Languages updated in 1.13 === diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index f5d11d7975..d5c9fea510 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -104,9 +104,10 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { list($tblpage, $tbllinks) = $db->tableNamesN('page', $this->bl_table); $this->addTables("$tbllinks JOIN $tblpage ON {$this->bl_from}=page_id"); if(is_null($resultPageSet)) - $this->addFields(array('page_id', 'page_title', 'page_namespace', 'page_is_redirect')); + $this->addFields(array('page_id', 'page_title', 'page_namespace')); else $this->addFields($resultPageSet->getPageTableFields()); + $this->addFields('page_is_redirect'); $this->addWhereFld($this->bl_title, $this->rootTitle->getDbKey()); if($this->hasNS) $this->addWhereFld($this->bl_ns, $this->rootTitle->getNamespace()); @@ -185,7 +186,11 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { if (is_null($resultPageSet)) $this->extractRowInfo($row); else + { + if($row->page_is_redirect) + $this->redirTitles[] = Title::makeTitle($row->page_namespace, $row->page_title); $resultPageSet->processDbRow($row); + } } $db->freeResult($res); @@ -316,8 +321,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { } public function getAllowedParams() { - - return array ( + $retval = array ( 'title' => null, 'continue' => null, 'namespace' => array ( @@ -332,7 +336,6 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { 'nonredirects' ) ), - 'redirect' => false, 'limit' => array ( ApiBase :: PARAM_DFLT => 10, ApiBase :: PARAM_TYPE => 'limit', @@ -341,17 +344,27 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { ApiBase :: PARAM_MAX2 => ApiBase :: LIMIT_BIG2 ) ); + if($this->getModuleName() == 'embeddedin') + return $retval; + $retval['redirect'] = false; + return $retval; } public function getParamDescription() { - return array ( + $retval = array ( 'title' => 'Title to search. If null, titles= parameter will be used instead, but will be obsolete soon.', 'continue' => 'When more results are available, use this to continue.', 'namespace' => 'The namespace to enumerate.', - 'filterredir' => 'How to filter for redirects', - 'redirect' => 'If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.', - 'limit' => "How many total pages to return. If {$this->bl_code}redirect is enabled, limit applies to each level separately." + 'filterredir' => 'How to filter for redirects' ); + if($this->getModuleName() != 'embeddedin') + return array_merge($retval, array( + 'redirect' => 'If linking page is a redirect, find all pages that link to that redirect as well. Maximum limit is halved.', + 'limit' => "How many total pages to return. If {$this->bl_code}redirect is enabled, limit applies to each level separately." + )); + return array_merge($retval, array( + 'limit' => "How many total pages to return." + )); } public function getDescription() { -- 2.20.1