From: Bryan Tong Minh Date: Fri, 25 Mar 2011 21:05:43 +0000 (+0000) Subject: (bug 28070) Fix watchlist RSS for databases that store timestamps in a real timestamp... X-Git-Tag: 1.31.0-rc.0~31187 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=ebb8b7447dc1ea18850f7442964de045aba36d56;p=lhc%2Fweb%2Fwiklou.git (bug 28070) Fix watchlist RSS for databases that store timestamps in a real timestamp field by using Database::timestamp(). Tested by Dan Nessett on 1.16. Not tested on trunk, but no reason why it should not work. --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 482654efde..64dffcb9e8 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -283,6 +283,8 @@ PHP if you have not done so prior to upgrading MediaWiki. * (bug 27586) Remove duplication of props in ApiQueryStashImageInfo by using ApiQueryImageInfo * (bug 28226) prop=extlinks&eloffset should be an integer +* (bug 28070) Fix watchlist RSS for databases that store timestamps in a + real timestamp field. === Languages updated in 1.18 === diff --git a/includes/api/ApiQueryWatchlist.php b/includes/api/ApiQueryWatchlist.php index 0cc53a32c6..17e8e0c204 100644 --- a/includes/api/ApiQueryWatchlist.php +++ b/includes/api/ApiQueryWatchlist.php @@ -128,8 +128,12 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { 'wl_user' => $userId, 'rc_deleted' => 0, ) ); + + $db = $this->getDB(); - $this->addWhereRange( 'rc_timestamp', $params['dir'], $params['start'], $params['end'] ); + $this->addWhereRange( 'rc_timestamp', $params['dir'], + $db->timestamp( $params['start'] ), + $db->timestamp( $params['end'] ) ); $this->addWhereFld( 'wl_namespace', $params['namespace'] ); $this->addWhereIf( 'rc_this_oldid=page_latest', !$params['allrev'] ); @@ -175,7 +179,7 @@ class ApiQueryWatchlist extends ApiQueryGeneratorBase { $this->addWhere( 'rc_user_text != ' . $this->getDB()->addQuotes( $params['excludeuser'] ) ); } - $db = $this->getDB(); + // This is an index optimization for mysql, as done in the Special:Watchlist page $this->addWhereIf( "rc_timestamp > ''", !isset( $params['start'] ) && !isset( $params['end'] ) && $db->getType() == 'mysql' );