* @ingroup Pager
*/
class LogPager extends ReverseChronologicalPager {
- private $type = '', $user = '', $title = '', $pattern = '', $year = '', $month = '';
+ private $type = '', $user = '', $title = '', $pattern = '';
public $mLogEventsList;
/**
* constructor
$this->limitType( $type );
$this->limitUser( $user );
$this->limitTitle( $title, $pattern );
- $this->limitDate( $y, $m );
+ $this->getDateCond( $y, $m );
}
function getDefaultQuery() {
$query = parent::getDefaultQuery();
$query['type'] = $this->type;
- $query['month'] = $this->month;
- $query['year'] = $this->year;
+ $query['month'] = $this->mMonth;
+ $query['year'] = $this->mYear;
return $query;
}
}
}
- /**
- * Set the log reader to return only entries from given date.
- * @param int $year
- * @param int $month
- * @private
- */
- function limitDate( $year, $month ) {
- $year = intval($year);
- $month = intval($month);
-
- $this->year = ($year > 0 && $year < 10000) ? $year : '';
- $this->month = ($month > 0 && $month < 13) ? $month : '';
-
- if( $this->year || $this->month ) {
- // Assume this year if only a month is given
- if( $this->year ) {
- $year_start = $this->year;
- } else {
- $year_start = substr( wfTimestampNow(), 0, 4 );
- $thisMonth = gmdate( 'n' );
- if( $this->month > $thisMonth ) {
- // Future contributions aren't supposed to happen. :)
- $year_start--;
- }
- }
-
- if( $this->month ) {
- $month_end = str_pad($this->month + 1, 2, '0', STR_PAD_LEFT);
- $year_end = $year_start;
- } else {
- $month_end = 0;
- $year_end = $year_start + 1;
- }
- $ts_end = str_pad($year_end . $month_end, 14, '0' );
-
- $this->mOffset = $ts_end;
- }
- }
-
function getQueryInfo() {
$this->mConds[] = 'user_id = log_user';
# Don't use the wrong logging index
}
public function getYear() {
- return $this->year;
+ return $this->mYear;
}
public function getMonth() {
- return $this->month;
+ return $this->mMonth;
}
}