From 6d97c46db4275d836df0e14d6a5b6d98d73c8b9b Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 17 Jul 2008 09:26:01 +0000 Subject: [PATCH] Revert r37748 "(bug 14020) Added an API interface to Special:Unwatchedpages in the form of the apfilterwatched parameter to list=allpages. If $wgMiserMode is true or if the user doesn't have the 'unwatchedpages' right, apfilterwatched is ignored and a warning is output." This is broken -- watched page filter results in a huge wash of duplicate rows -- one for each watcher for each page. --- RELEASE-NOTES | 1 - includes/api/ApiQueryAllpages.php | 35 ++----------------------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 6c18eaa37b..6db1ed51e4 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -530,7 +530,6 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * Added flag "top" to list=usercontribs if the user is the last contributor to the page * list=exturlusage in "list all links" mode can now filter by protocol -* (bug 14020) Added apfilterwatched parameter to list=allpages === Languages updated in 1.13 === diff --git a/includes/api/ApiQueryAllpages.php b/includes/api/ApiQueryAllpages.php index 3176a87019..c4ac486cf6 100644 --- a/includes/api/ApiQueryAllpages.php +++ b/includes/api/ApiQueryAllpages.php @@ -51,6 +51,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { } private function run($resultPageSet = null) { + $db = $this->getDB(); $params = $this->extractRequestParams(); @@ -96,29 +97,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $this->dieUsage('prlevel may not be used without prtype', 'params'); } - // Only allow watched page filtering if the user has the 'unwatchedpages' permission - // $wgMiserMode disables this - global $wgUser, $wgMiserMode; - if ($wgUser->isAllowed('unwatchedpages') && !$wgMiserMode) { - if($params['filterwatched'] != 'all') { - $this->addTables('watchlist'); - $this->addJoinConds(array('watchlist' => array('LEFT JOIN', array( - 'wl_namespace = page_namespace', - 'wl_title = page_title')))); - } - if($params['filterwatched'] == 'unwatched') { - $this->addWhere('wl_title IS NULL'); - } - else if ($params['filterwatched'] == 'watched') { - $this->addWhere('wl_title IS NOT NULL'); - } - } - else if($params['filterwatched'] != 'all') { - if($wgMiserMode) - $this->setWarning('apfilterwatched is disabled on this wiki for performance reasons'); - else - $this->setWarning('You don\'t have permission to filter by watched status'); - } if($params['filterlanglinks'] == 'withoutlanglinks') { $this->addTables('langlinks'); $this->addJoinConds(array('langlinks' => array('LEFT JOIN', 'page_id=ll_from'))); @@ -130,7 +108,7 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { $forceNameTitleIndex = false; } if ($forceNameTitleIndex) - $this->addOption('USE INDEX', array('page' => 'name_title')); + $this->addOption('USE INDEX', 'name_title'); if (is_null($resultPageSet)) { $this->addFields(array ( @@ -228,14 +206,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { 'all' ), ApiBase :: PARAM_DFLT => 'all' - ), - 'filterwatched' => array( - ApiBase :: PARAM_TYPE => array( - 'watched', - 'unwatched', - 'all' - ), - ApiBase :: PARAM_DFLT => 'all' ) ); } @@ -252,7 +222,6 @@ class ApiQueryAllpages extends ApiQueryGeneratorBase { 'prtype' => 'Limit to protected pages only', 'prlevel' => 'The protection level (must be used with apprtype= parameter)', 'filterlanglinks' => 'Filter based on whether a page has langlinks', - 'filterwatched' => 'Filter based on whther a page is watched (requires \'unwatchedpages\' right)', 'limit' => 'How many total pages to return.' ); } -- 2.20.1