10use MediaWiki\Cache\LinkBatchFactory;
34 private LinkBatchFactory $linkBatchFactory;
35 private int $migrationStage;
40 LinkBatchFactory $linkBatchFactory,
48 parent::__construct( $context, $linkRenderer );
51 $this->groupPermissionsLookup = $groupPermissionsLookup;
52 $this->linkBatchFactory = $linkBatchFactory;
64 $this->migrationStage = $context->
getConfig()->get(
75 $tables = [
'image' ];
76 $nameField =
'img_name';
77 $actorField =
'img_actor';
78 $timestampField =
'img_timestamp';
82 $tables = [
'file',
'filerevision' ];
83 $nameField =
'file_name';
84 $actorField =
'fr_actor';
85 $timestampField =
'fr_timestamp';
86 $jconds = [
'filerevision' => [
'JOIN',
'file_latest=fr_id' ] ];
89 $fields = [
'img_name' => $nameField,
'img_timestamp' => $timestampField,
'actor_user',
'actor_name' ];
91 $jconds[
'actor'] = [
'JOIN',
'actor_id=' . $actorField ];
95 $conds[
'actor_name'] = $user;
99 $groupsWithBotPermission = $this->groupPermissionsLookup->getGroupsWithPermission(
'bot' );
101 if ( count( $groupsWithBotPermission ) ) {
102 $tables[] =
'user_groups';
103 $conds[
'ug_group'] =
null;
104 $jconds[
'user_groups'] = [
107 'ug_group' => $groupsWithBotPermission,
108 'ug_user = actor_user',
109 $dbr->expr(
'ug_expiry',
'=',
null )->or(
'ug_expiry',
'>=', $dbr->timestamp() )
116 $tables[] =
'recentchanges';
117 $conds[
'rc_source'] = RecentChange::SRC_LOG;
118 $conds[
'rc_log_type'] =
'upload';
119 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
120 $conds[
'rc_namespace'] =
NS_FILE;
122 $jconds[
'recentchanges'] = [
125 'rc_title = ' . $nameField,
126 'rc_actor = ' . $actorField,
127 'rc_timestamp = ' . $timestampField,
136 $tables[] =
'filetypes';
137 $jconds[
'filetypes'] = [
'JOIN',
'file_type = ft_id' ];
146 if ( $user ===
'' ) {
147 $options[] =
'STRAIGHT_JOIN';
153 'join_conds' => $jconds,
155 'options' => $options,
163 return [ [
'img_timestamp',
'img_name' ] ];
168 if ( !$this->gallery ) {
170 $mode = $this->
getRequest()->getVal(
'gallerymode',
null );
172 $this->gallery = ImageGalleryBase::factory( $mode, $this->
getContext() );
175 $this->gallery = ImageGalleryBase::factory(
false, $this->
getContext() );
184 return $this->gallery->toHTML();
189 $this->mResult->seek( 0 );
190 $lb = $this->linkBatchFactory->newLinkBatch()->setCaller( __METHOD__ );
191 foreach ( $this->mResult as $row ) {
192 if ( $row->actor_user ) {
193 $lb->add(
NS_USER, $row->actor_name );
201 $username = $row->actor_name;
203 if ( ExternalUserNames::isExternal( $username ) ) {
204 $ul = htmlspecialchars( $username );
211 $time = $this->
getLanguage()->userTimeAndDate( $row->img_timestamp, $this->getUser() );
216 . htmlspecialchars( $time )
221 ImageGalleryBase::LOADING_LAZY
232class_alias( NewFilesPager::class,
'NewFilesPager' );
235class_alias( NewFilesPager::class,
'MediaWiki\\Pager\\NewFilesPager' );
const SCHEMA_COMPAT_READ_OLD
getContext()
Get the base IContextSource object.
A class containing constants representing the names of configuration variables.
const FileSchemaMigrationStage
Name constant for the FileSchemaMigrationStage setting, for use with Config::get()
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.