48 private int $migrationStage;
61 parent::__construct( $context, $linkRenderer );
64 $this->groupPermissionsLookup = $groupPermissionsLookup;
65 $this->linkBatchFactory = $linkBatchFactory;
77 $this->migrationStage = $context->
getConfig()->get(
87 $tables = [
'image' ];
88 $nameField =
'img_name';
89 $actorField =
'img_actor';
90 $timestampField =
'img_timestamp';
94 $tables = [
'file',
'filerevision' ];
95 $nameField =
'file_name';
96 $actorField =
'fr_actor';
97 $timestampField =
'fr_timestamp';
98 $jconds = [
'filerevision' => [
'JOIN',
'file_latest=fr_id' ] ];
101 $fields = [
'img_name' => $nameField,
'img_timestamp' => $timestampField,
'actor_user',
'actor_name' ];
103 $jconds[
'actor'] = [
'JOIN',
'actor_id=' . $actorField ];
106 if ( $user !==
'' ) {
107 $conds[
'actor_name'] = $user;
111 $groupsWithBotPermission = $this->groupPermissionsLookup->getGroupsWithPermission(
'bot' );
113 if ( count( $groupsWithBotPermission ) ) {
114 $tables[] =
'user_groups';
115 $conds[
'ug_group'] =
null;
116 $jconds[
'user_groups'] = [
119 'ug_group' => $groupsWithBotPermission,
120 'ug_user = actor_user',
121 $dbr->expr(
'ug_expiry',
'=',
null )->or(
'ug_expiry',
'>=', $dbr->timestamp() )
128 $tables[] =
'recentchanges';
129 $conds[
'rc_type'] =
RC_LOG;
130 $conds[
'rc_log_type'] =
'upload';
131 $conds[
'rc_patrolled'] = RecentChange::PRC_UNPATROLLED;
132 $conds[
'rc_namespace'] =
NS_FILE;
134 $jconds[
'recentchanges'] = [
137 'rc_title = ' . $nameField,
138 'rc_actor = ' . $actorField,
139 'rc_timestamp = ' . $timestampField,
148 $tables[] =
'filetypes';
149 $jconds[
'filetypes'] = [
'JOIN',
'file_type = ft_id' ];
158 if ( $user ===
'' ) {
159 $options[] =
'STRAIGHT_JOIN';
165 'join_conds' => $jconds,
167 'options' => $options,
174 return [ [
'img_timestamp',
'img_name' ] ];
178 if ( !$this->gallery ) {
180 $mode = $this->
getRequest()->getVal(
'gallerymode',
null );
182 $this->gallery = ImageGalleryBase::factory( $mode, $this->
getContext() );
185 $this->gallery = ImageGalleryBase::factory(
false, $this->
getContext() );
193 return $this->gallery->toHTML();
197 $this->mResult->seek( 0 );
198 $lb = $this->linkBatchFactory->newLinkBatch();
199 foreach ( $this->mResult as $row ) {
200 if ( $row->actor_user ) {
201 $lb->add(
NS_USER, $row->actor_name );
208 $username = $row->actor_name;
210 if ( ExternalUserNames::isExternal( $username ) ) {
211 $ul = htmlspecialchars( $username );
218 $time = $this->
getLanguage()->userTimeAndDate( $row->img_timestamp, $this->getUser() );
221 Title::makeTitle(
NS_FILE, $row->img_name ),
223 . htmlspecialchars( $time )
228 ImageGalleryBase::LOADING_LAZY
239class_alias( NewFilesPager::class,
'NewFilesPager' );
const SCHEMA_COMPAT_READ_OLD
Class for exceptions thrown by ImageGalleryBase::factory().
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.