From: Yuri Astrakhan Date: Sun, 3 Jun 2007 14:18:00 +0000 (+0000) Subject: API: fixed bug 10109 PostgreSQL API bug in ApiQueryWatchlist::run X-Git-Tag: 1.31.0-rc.0~52710 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmes_infos.php?a=commitdiff_plain;h=d5ea71a9e01a9ad2db8cbcb1036fe85f82c81406;p=lhc%2Fweb%2Fwiklou.git API: fixed bug 10109 PostgreSQL API bug in ApiQueryWatchlist::run --- 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);