45 private $groupPermissionsLookup;
48 private $linkBatchFactory;
69 parent::__construct( $context, $linkRenderer );
72 $this->groupPermissionsLookup = $groupPermissionsLookup;
73 $this->linkBatchFactory = $linkBatchFactory;
91 $tables = [
'image',
'actor' ];
92 $fields = [
'img_name',
'img_timestamp',
'actor_user',
'actor_name' ];
94 $jconds = [
'actor' => [
'JOIN',
'actor_id=img_actor' ] ];
98 $conds[
'actor_name'] = $user;
102 $groupsWithBotPermission = $this->groupPermissionsLookup->getGroupsWithPermission(
'bot' );
104 if ( count( $groupsWithBotPermission ) ) {
105 $tables[] =
'user_groups';
106 $conds[] =
'ug_group IS NULL';
107 $jconds[
'user_groups'] = [
110 'ug_group' => $groupsWithBotPermission,
111 'ug_user = actor_user',
112 'ug_expiry IS NULL OR ug_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() )
119 $tables[] =
'recentchanges';
120 $conds[
'rc_type'] =
RC_LOG;
121 $conds[
'rc_log_type'] =
'upload';
123 $conds[
'rc_namespace'] =
NS_FILE;
125 $jconds[
'recentchanges'] = [
128 'rc_title = img_name',
129 'rc_actor = img_actor',
130 'rc_timestamp = img_timestamp'
143 if ( $user ===
'' ) {
144 $options[] =
'STRAIGHT_JOIN';
150 'join_conds' => $jconds,
152 'options' => $options,
159 return [ [
'img_timestamp',
'img_name' ] ];
163 if ( !$this->gallery ) {
165 $mode = $this->
getRequest()->getVal(
'gallerymode',
null );
178 return $this->gallery->toHTML();
182 $this->mResult->seek( 0 );
183 $lb = $this->linkBatchFactory->newLinkBatch();
184 foreach ( $this->mResult as $row ) {
185 if ( $row->actor_user ) {
186 $lb->add(
NS_USER, $row->actor_name );
193 $username = $row->actor_name;
196 $ul = htmlspecialchars( $username );
203 $time = $this->
getLanguage()->userTimeAndDate( $row->img_timestamp, $this->getUser() );
206 Title::makeTitle(
NS_FILE, $row->img_name ),
208 . htmlspecialchars( $time )
getContext()
Get the base IContextSource object.
static isExternal( $username)
Tells whether the username is external or not.
static factory( $mode=false, IContextSource $context=null)
Get a new image gallery.
Class for exceptions thrown by ImageGalleryBase::factory().
Represents a page (or page fragment) title within MediaWiki.
Interface for objects which can provide a MediaWiki context on request.