From 0f3eb80d98d96d4eaaba0a519b3af797fb153b03 Mon Sep 17 00:00:00 2001 From: River Tarnell Date: Fri, 29 Jul 2005 05:44:49 +0000 Subject: [PATCH] after going to 'next' and then 'previous', the very latest edit would not be displayed. --- includes/SpecialContributions.php | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/includes/SpecialContributions.php b/includes/SpecialContributions.php index 5e5e1fa0d0..0dda760f5a 100644 --- a/includes/SpecialContributions.php +++ b/includes/SpecialContributions.php @@ -22,20 +22,27 @@ class contribs_finder { $this->offset = $offset; } - function get_edit_limits() { + function get_edit_limit($dir) { list($index, $usercond) = $this->get_user_cond(); $use_index = $this->dbr->useIndexClause($index); extract($this->dbr->tableNames('revision')); - $sql = "SELECT MIN(rev_timestamp) as earliest, MAX(rev_timestamp) as latest " . - "FROM $revision $use_index WHERE " . $usercond; + $sql = "SELECT rev_timestamp " . + " FROM $revision $use_index " . + " WHERE " . $usercond . + " ORDER BY rev_timestamp $dir LIMIT 1"; - $res = $this->dbr->query($sql, "contribs_finder::get_edit_limits"); - $rows = array(); + $res = $this->dbr->query($sql, "contribs_finder::get_edit_limit"); while ($o = $this->dbr->fetchObject($res)) - $rows[] = $o; - $row = $rows[count($rows) - 1]; - return array($row->earliest, $row->latest); + $row = $o; + return $row->rev_timestamp; + } + + function get_edit_limits() { + return array( + $this->get_edit_limit("ASC"), + $this->get_edit_limit("DESC") + ); } function get_user_cond() { @@ -65,7 +72,7 @@ class contribs_finder { $sql = "SELECT rev_timestamp FROM $page, $revision $use_index " . "WHERE page_id = rev_page AND rev_timestamp > '" . $this->offset . "' AND " . "rev_user_text = " . $this->dbr->addQuotes($this->username); - $sql .= " ORDER BY rev_timestamp ASC LIMIT " . $this->limit; + $sql .= " ORDER BY rev_timestamp ASC LIMIT " . ($this->limit+1); $res = $this->dbr->query($sql); $rows = array(); while ($obj = $this->dbr->fetchObject($res)) @@ -99,7 +106,7 @@ class contribs_finder { $limitQuery = "LIMIT {$this->limit}"; if ($this->offset) - $offsetQuery = "AND rev_timestamp < '{$this->offset}'"; + $offsetQuery = "AND rev_timestamp <= '{$this->offset}'"; $use_index = $this->dbr->useIndexClause($index); $sql = "SELECT -- 2.20.1