*/
use MediaWiki\MediaWikiServices;
-class NewFilesPager extends ReverseChronologicalPager {
+class NewFilesPager extends RangeChronologicalPager {
/**
* @var ImageGalleryBase
* @param FormOptions $opts
*/
function __construct( IContextSource $context, FormOptions $opts ) {
- $this->opts = $opts;
+ parent::__construct( $context );
+ $this->opts = $opts;
$this->setLimit( $opts->getValue( 'limit' ) );
- parent::__construct( $context );
+ $startTimestamp = '';
+ $endTimestamp = '';
+ if ( $opts->getValue( 'start' ) ) {
+ $startTimestamp = $opts->getValue( 'start' ) . ' 00:00:00';
+ }
+ if ( $opts->getValue( 'end' ) ) {
+ $endTimestamp = $opts->getValue( 'end' ) . ' 23:59:59';
+ }
+ $this->getDateRangeCond( $startTimestamp, $endTimestamp );
}
function getQueryInfo() {
$fields = [ 'img_name', 'img_user', 'img_timestamp' ];
$options = [];
+ $user = $opts->getValue( 'user' );
+ if ( $user !== '' ) {
+ $userId = User::idFromName( $user );
+ if ( $userId ) {
+ $conds['img_user'] = $userId;
+ } else {
+ $conds['img_user_text'] = $user;
+ }
+ }
+
if ( !$opts->getValue( 'showbots' ) ) {
$groupsWithBotPermission = User::getGroupsWithPermission( 'bot' );