From: Roan Kattouw Date: Tue, 4 Sep 2007 14:44:46 +0000 (+0000) Subject: (bug 10980) Add exclude redirects on backlinks X-Git-Tag: 1.31.0-rc.0~51526 X-Git-Url: http://git.cyclocoop.org/%22%20.%20generer_url_ecrire%28%22suivi_revisions%22%2C%22id_auteur=%24connecte%22%29%20.%20%22?a=commitdiff_plain;h=7722bc1314ab177835be11358375c817dbca8258;p=lhc%2Fweb%2Fwiklou.git (bug 10980) Add exclude redirects on backlinks --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index e6e41c62cf..7f768f11a7 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -497,6 +497,7 @@ Full API documentation is available at http://www.mediawiki.org/wiki/API * (bug 11115) Adding SHA1 hash to imageinfo query * (bug 10898) API does not return an edit token for non-existent pages * (bug 10890) Timestamp support for categorymembers query +* (bug 10980) Add exclude redirects on backlinks == Maintenance script changes since 1.10 == diff --git a/includes/api/ApiQueryBacklinks.php b/includes/api/ApiQueryBacklinks.php index b4f4380dfe..7e4bb721a1 100644 --- a/includes/api/ApiQueryBacklinks.php +++ b/includes/api/ApiQueryBacklinks.php @@ -102,7 +102,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $redirect = $this->params['redirect']; if ($redirect) - ApiBase :: dieDebug(__METHOD__, 'Redirect has not been implemented', 'notimplemented'); + $this->dieDebug('Redirect has not been implemented', 'notimplemented'); $this->processContinue(); @@ -124,13 +124,15 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { $this->addWhereFld($this->bl_title, $this->rootTitle->getDBkey()); $this->addWhereFld('page_namespace', $this->params['namespace']); + if($this->params['filterredir'] == 'redirects') + $this->addWhereFld('page_is_redirect', 1); + if($this->params['filterredir'] == 'nonredirects') + $this->addWhereFld('page_is_redirect', 0); + $limit = $this->params['limit']; $this->addOption('LIMIT', $limit +1); $this->addOption('ORDER BY', $this->bl_sort); - if ($redirect) - $this->addWhereFld('page_is_redirect', 0); - $db = $this->getDB(); if (!is_null($this->params['continue'])) { $plfrm = intval($this->contID); @@ -322,6 +324,14 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { ApiBase :: PARAM_ISMULTI => true, ApiBase :: PARAM_TYPE => 'namespace' ), + 'filterredir' => array( + ApiBase :: PARAM_DFLT => 'all', + ApiBase :: PARAM_TYPE => array( + 'all', + 'redirects', + 'nonredirects' + ) + ), 'redirect' => false, 'limit' => array ( ApiBase :: PARAM_DFLT => 10, @@ -338,6 +348,7 @@ class ApiQueryBacklinks extends ApiQueryGeneratorBase { '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 (not implemented)', 'limit' => 'How many total pages to return.' );