+ function getFirstOffset($id) {
+ $db =& wfGetDB(DB_SLAVE);
+ $sql = "SELECT MAX(rev_timestamp) AS lowest FROM revision WHERE rev_page = $id";
+ $res = $db->query($sql, "getFirstOffset");
+ $obj = $db->fetchObject($res);
+ return $obj->lowest;
+ }
+
+ function getLastOffset($id) {
+ $db =& wfGetDB(DB_SLAVE);
+ $sql = "SELECT MIN(rev_timestamp) AS lowest FROM revision WHERE rev_page = $id";
+ $res = $db->query($sql, "getLastOffset");
+ $obj = $db->fetchObject($res);
+ return $obj->lowest;
+ }
+
+ function getLastOffsetForPaging($id, $step = 50) {