/**
* @ingroup Pager
*/
+use MediaWiki\Linker\LinkRenderer;
use MediaWiki\MediaWikiServices;
class NewFilesPager extends RangeChronologicalPager {
/**
* @param IContextSource $context
* @param FormOptions $opts
+ * @param LinkRenderer $linkRenderer
*/
- public function __construct( IContextSource $context, FormOptions $opts ) {
- parent::__construct( $context );
+ public function __construct( IContextSource $context, FormOptions $opts,
+ LinkRenderer $linkRenderer
+ ) {
+ parent::__construct( $context, $linkRenderer );
$this->opts = $opts;
$this->setLimit( $opts->getValue( 'limit' ) );
function getQueryInfo() {
$opts = $this->opts;
$conds = [];
- $imgQuery = LocalFile::getQueryInfo();
- $tables = $imgQuery['tables'];
- $fields = [ 'img_name', 'img_timestamp' ] + $imgQuery['fields'];
+ $actorQuery = ActorMigration::newMigration()->getJoin( 'img_user' );
+ $tables = [ 'image' ] + $actorQuery['tables'];
+ $fields = [ 'img_name', 'img_timestamp' ] + $actorQuery['fields'];
$options = [];
- $jconds = $imgQuery['joins'];
+ $jconds = $actorQuery['joins'];
$user = $opts->getValue( 'user' );
if ( $user !== '' ) {
->getWhere( wfGetDB( DB_REPLICA ), 'img_user', User::newFromName( $user, false ) )['conds'];
}
- if ( $opts->getValue( 'newbies' ) ) {
- // newbie = most recent 1% of users
- $dbr = wfGetDB( DB_REPLICA );
- $max = $dbr->selectField( 'user', 'max(user_id)', '', __METHOD__ );
- $conds[] = $imgQuery['fields']['img_user'] . ' >' . (int)( $max - $max / 100 );
-
- // there's no point in looking for new user activity in a far past;
- // beyond a certain point, we'd just end up scanning the rest of the
- // table even though the users we're looking for didn't yet exist...
- // see T140537, (for ContribsPages, but similar to this)
- $conds[] = 'img_timestamp > ' .
- $dbr->addQuotes( $dbr->timestamp( wfTimestamp() - 30 * 24 * 60 * 60 ) );
- }
-
if ( !$opts->getValue( 'showbots' ) ) {
$groupsWithBotPermission = MediaWikiServices::getInstance()
->getPermissionManager()
'LEFT JOIN',
[
'ug_group' => $groupsWithBotPermission,
- 'ug_user = ' . $imgQuery['fields']['img_user'],
+ 'ug_user = ' . $actorQuery['fields']['img_user'],
'ug_expiry IS NULL OR ug_expiry >= ' . $dbr->addQuotes( $dbr->timestamp() )
]
];
}
if ( $opts->getValue( 'hidepatrolled' ) ) {
- global $wgActorTableSchemaMigrationStage;
-
$tables[] = 'recentchanges';
$conds['rc_type'] = RC_LOG;
$conds['rc_log_type'] = 'upload';
$conds['rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
$conds['rc_namespace'] = NS_FILE;
- if ( $wgActorTableSchemaMigrationStage & SCHEMA_COMPAT_READ_NEW ) {
- $jcond = 'rc_actor = ' . $imgQuery['fields']['img_actor'];
- } else {
- $rcQuery = ActorMigration::newMigration()->getJoin( 'rc_user' );
- $tables += $rcQuery['tables'];
- $jconds += $rcQuery['joins'];
- $jcond = $rcQuery['fields']['rc_user'] . ' = ' . $imgQuery['fields']['img_user'];
- }
$jconds['recentchanges'] = [
'JOIN',
[
'rc_title = img_name',
- $jcond,
+ 'rc_actor = ' . $actorQuery['fields']['img_actor'],
'rc_timestamp = img_timestamp'
]
];