*/
protected $mTitle;
+ /**
+ * @since 1.14
+ * @var ImagePage
+ */
+ public $mImagePage;
+
+ /**
+ * @since 1.14
+ * @var File[]
+ */
+ public $mHist;
+
+ /**
+ * @since 1.14
+ * @var int[]
+ */
+ public $mRange;
+
/**
* @param ImagePage $imagePage
*/
- function __construct( $imagePage ) {
+ public function __construct( $imagePage ) {
parent::__construct( $imagePage->getContext() );
$this->mImagePage = $imagePage;
$this->mTitle = clone $imagePage->getTitle();
$this->mTitle->setFragment( '#filehistory' );
$this->mImg = null;
- $this->mHist = array();
- $this->mRange = array( 0, 0 ); // display range
+ $this->mHist = [];
+ $this->mRange = [ 0, 0 ]; // display range
+
+ // Only display 10 revisions at once by default, otherwise the list is overwhelming
+ $this->mLimitsShown = array_merge( [ 10 ], $this->mLimitsShown );
+ $this->mDefaultLimit = 10;
+ list( $this->mLimit, /* $offset */ ) =
+ $this->mRequest->getLimitOffset( $this->mDefaultLimit, '' );
}
/**
* @return Title
*/
- function getTitle() {
+ public function getTitle() {
return $this->mTitle;
}
- function getQueryInfo() {
+ public function getQueryInfo() {
return false;
}
/**
* @return string
*/
- function getIndexField() {
+ public function getIndexField() {
return '';
}
* @param object $row
* @return string
*/
- function formatRow( $row ) {
+ public function formatRow( $row ) {
return '';
}
/**
* @return string
*/
- function getBody() {
+ public function getBody() {
$s = '';
$this->doQuery();
if ( count( $this->mHist ) ) {
return $s;
}
- function doQuery() {
+ public function doQuery() {
if ( $this->mQueryDone ) {
return;
}
// The current rev may not meet the offset/limit
$numRows = count( $this->mHist );
if ( $numRows <= $this->mLimit && $this->mImg->getTimestamp() > $this->mOffset ) {
- $this->mHist = array_merge( array( $this->mImg ), $this->mHist );
+ $this->mHist = array_merge( [ $this->mImg ], $this->mHist );
}
} else {
// The current rev may not meet the offset
# Index value of bottom item in the list
$lastIndex = $this->mHist[1]->getTimestamp();
# Display range
- $this->mRange = array( 1, $numRows - 1 );
+ $this->mRange = [ 1, $numRows - 1 ];
} else {
# Index value of item past the index
$this->mPastTheEndIndex = $this->mHist[$numRows - 1]->getTimestamp();
# Index value of bottom item in the list
$lastIndex = $this->mHist[$numRows - 2]->getTimestamp();
# Display range
- $this->mRange = array( 0, $numRows - 2 );
+ $this->mRange = [ 0, $numRows - 2 ];
}
} else {
# Setting indexes to an empty string means that they will be
$lastIndex = $this->mIsBackwards ?
$this->mHist[0]->getTimestamp() : $this->mHist[$numRows - 1]->getTimestamp();
# Display range
- $this->mRange = array( 0, $numRows - 1 );
+ $this->mRange = [ 0, $numRows - 1 ];
}
} else {
$firstIndex = '';