r44558 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44557‎ | r44558 | r44559 >
Date:03:53, 14 December 2008
Author:aaron
Status:ok
Tags:
Comment:
Make boundary inclusion optional in getHistory()
Modified paths:
  • /trunk/phase3/includes/filerepo/File.php (modified) (history)
  • /trunk/phase3/includes/filerepo/LocalFile.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/filerepo/LocalFile.php
@@ -624,18 +624,18 @@
625625 /** purgeDescription inherited */
626626 /** purgeEverything inherited */
627627
628 - function getHistory($limit = null, $start = null, $end = null) {
 628+ function getHistory($limit = null, $start = null, $end = null, $inc = true) {
629629 $dbr = $this->repo->getSlaveDB();
630630 $tables = array('oldimage');
631 - $join_conds = array();
632631 $fields = OldLocalFile::selectFields();
633 - $conds = $opts = array();
 632+ $conds = $opts = $join_conds = array();
 633+ $eq = $inc ? "=" : "";
634634 $conds[] = "oi_name = " . $dbr->addQuotes( $this->title->getDBKey() );
635635 if( $start ) {
636 - $conds[] = "oi_timestamp <= " . $dbr->addQuotes( $dbr->timestamp( $start ) );
 636+ $conds[] = "oi_timestamp <$eq " . $dbr->addQuotes( $dbr->timestamp( $start ) );
637637 }
638638 if( $end ) {
639 - $conds[] = "oi_timestamp >= " . $dbr->addQuotes( $dbr->timestamp( $end ) );
 639+ $conds[] = "oi_timestamp >$eq " . $dbr->addQuotes( $dbr->timestamp( $end ) );
640640 }
641641 if( $limit ) {
642642 $opts['LIMIT'] = $limit;
Index: trunk/phase3/includes/filerepo/File.php
@@ -683,8 +683,9 @@
684684 * @param $limit integer Limit of rows to return
685685 * @param $start timestamp Only revisions older than $start will be returned
686686 * @param $end timestamp Only revisions newer than $end will be returned
 687+ * @param $inc bool Include the endpoints of the time range
687688 */
688 - function getHistory($limit = null, $start = null, $end = null) {
 689+ function getHistory($limit = null, $start = null, $end = null, $inc=true) {
689690 return array();
690691 }
691692

Status & tagging log