43 private $groupPermissionsLookup;
46 private $linkBatchFactory;
67 parent::__construct( $context, $linkRenderer );
70 $this->groupPermissionsLookup = $groupPermissionsLookup;
71 $this->linkBatchFactory = $linkBatchFactory;
89 $tables = [
'image',
'actor' ];
90 $fields = [
'img_name',
'img_timestamp',
'actor_user',
'actor_name' ];
92 $jconds = [
'actor' => [
'JOIN',
'actor_id=img_actor' ] ];
96 $conds[
'actor_name'] = $user;
100 $groupsWithBotPermission = $this->groupPermissionsLookup->getGroupsWithPermission(
'bot' );
102 if ( count( $groupsWithBotPermission ) ) {
103 $tables[] =
'user_groups';
104 $conds[] =
'ug_group IS NULL';
105 $jconds[
'user_groups'] = [
108 'ug_group' => $groupsWithBotPermission,
109 'ug_user = actor_user',
110 'ug_expiry IS NULL OR ug_expiry >= ' .
$dbr->addQuotes(
$dbr->timestamp() )
117 $tables[] =
'recentchanges';
118 $conds[
'rc_type'] =
RC_LOG;
119 $conds[
'rc_log_type'] =
'upload';
121 $conds[
'rc_namespace'] =
NS_FILE;
123 $jconds[
'recentchanges'] = [
126 'rc_title = img_name',
127 'rc_actor = img_actor',
128 'rc_timestamp = img_timestamp'
141 if ( $user ===
'' ) {
142 $options[] =
'STRAIGHT_JOIN';
148 'join_conds' => $jconds,
150 'options' => $options,
157 return 'img_timestamp';
161 if ( !$this->gallery ) {
163 $mode = $this->
getRequest()->getVal(
'gallerymode',
null );
176 return $this->gallery->toHTML();
180 $this->mResult->seek( 0 );
181 $lb = $this->linkBatchFactory->newLinkBatch();
182 foreach ( $this->mResult as $row ) {
183 if ( $row->actor_user ) {
184 $lb->add(
NS_USER, $row->actor_name );
191 $username = $row->actor_name;
194 $ul = htmlspecialchars( $username );
201 $time = $this->
getLanguage()->userTimeAndDate( $row->img_timestamp, $this->getUser() );
206 . 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.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Interface for objects which can provide a MediaWiki context on request.