From 98800054d935491ac1b9685143a55112c34a07b5 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sun, 14 Dec 2008 03:53:05 +0000 Subject: [PATCH] Make boundary inclusion optional in getHistory() --- includes/filerepo/File.php | 3 ++- includes/filerepo/LocalFile.php | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/includes/filerepo/File.php b/includes/filerepo/File.php index 4969647e82..9335799766 100644 --- a/includes/filerepo/File.php +++ b/includes/filerepo/File.php @@ -683,8 +683,9 @@ abstract class File { * @param $limit integer Limit of rows to return * @param $start timestamp Only revisions older than $start will be returned * @param $end timestamp Only revisions newer than $end will be returned + * @param $inc bool Include the endpoints of the time range */ - function getHistory($limit = null, $start = null, $end = null) { + function getHistory($limit = null, $start = null, $end = null, $inc=true) { return array(); } diff --git a/includes/filerepo/LocalFile.php b/includes/filerepo/LocalFile.php index 36f72c1aeb..dfd8332125 100644 --- a/includes/filerepo/LocalFile.php +++ b/includes/filerepo/LocalFile.php @@ -624,18 +624,18 @@ class LocalFile extends File /** purgeDescription inherited */ /** purgeEverything inherited */ - function getHistory($limit = null, $start = null, $end = null) { + function getHistory($limit = null, $start = null, $end = null, $inc = true) { $dbr = $this->repo->getSlaveDB(); $tables = array('oldimage'); - $join_conds = array(); $fields = OldLocalFile::selectFields(); - $conds = $opts = array(); + $conds = $opts = $join_conds = array(); + $eq = $inc ? "=" : ""; $conds[] = "oi_name = " . $dbr->addQuotes( $this->title->getDBKey() ); if( $start ) { - $conds[] = "oi_timestamp <= " . $dbr->addQuotes( $dbr->timestamp( $start ) ); + $conds[] = "oi_timestamp <$eq " . $dbr->addQuotes( $dbr->timestamp( $start ) ); } if( $end ) { - $conds[] = "oi_timestamp >= " . $dbr->addQuotes( $dbr->timestamp( $end ) ); + $conds[] = "oi_timestamp >$eq " . $dbr->addQuotes( $dbr->timestamp( $end ) ); } if( $limit ) { $opts['LIMIT'] = $limit; -- 2.20.1