From d5ea71a9e01a9ad2db8cbcb1036fe85f82c81406 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Sun, 3 Jun 2007 14:18:00 +0000 Subject: [PATCH] API: fixed bug 10109 PostgreSQL API bug in ApiQueryWatchlist::run --- includes/api/ApiQueryWatchlist.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 6e42d48a2e..f61a769170 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -48,10 +48,11 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->run($resultPageSet); } - private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false, $fld_timestamp = false, $fld_user = false, $fld_comment = false; + private $fld_ids = false, $fld_title = false, $fld_patrol = false, $fld_flags = false, + $fld_timestamp = false, $fld_user = false, $fld_comment = false; private function run($resultPageSet = null) { - global $wgUser; + global $wgUser, $wgDBtype; $this->selectNamedDB('watchlist', DB_SLAVE, 'watchlist'); @@ -132,7 +133,9 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->addWhereRange('rc_timestamp', $dir, $start, $end); $this->addWhereFld('wl_namespace', $namespace); $this->addWhereIf('rc_this_oldid=page_latest', !$allrev); - $this->addWhereIf("rc_timestamp > ''", !isset ($start) && !isset ($end)); + + # This is a index optimization for mysql, as done in the Special:Watchlist page + $this->addWhereIf("rc_timestamp > ''", !isset ($start) && !isset ($end) && $wgDBtype == 'mysql'); $this->addOption('LIMIT', $limit +1); -- 2.20.1