MediaWiki  master
ImageListPager.php
Go to the documentation of this file.
1 <?php
27 
31 class ImageListPager extends TablePager {
32 
33  protected $mFieldNames = null;
34 
35  // Subclasses should override buildQueryConds instead of using $mQueryConds variable.
36  protected $mQueryConds = [];
37 
38  protected $mUserName = null;
39 
45  protected $mUser = null;
46 
47  protected $mSearch = '';
48 
49  protected $mIncluding = false;
50 
51  protected $mShowAll = false;
52 
53  protected $mTableName = 'image';
54 
56  private $localRepo;
57 
60 
62  private $commentStore;
63 
65  private $actorMigration;
66 
68  private $userCache;
69 
73  private const INDEX_FIELDS = [
74  'img_timestamp' => [ 'img_timestamp', 'img_name' ],
75  'img_name' => [ 'img_name' ],
76  'img_size' => [ 'img_size', 'img_name' ],
77  ];
78 
93  public function __construct(
95  $userName,
96  $search,
97  $including,
98  $showAll,
100  RepoGroup $repoGroup,
102  ILoadBalancer $loadBalancer,
106  ) {
107  $this->setContext( $context );
108 
109  $this->mIncluding = $including;
110  $this->mShowAll = $showAll;
111  $dbr = $loadBalancer->getConnectionRef( ILoadBalancer::DB_REPLICA );
112 
113  if ( $userName !== null && $userName !== '' ) {
114  $nt = Title::makeTitleSafe( NS_USER, $userName );
115  if ( $nt === null ) {
116  $this->outputUserDoesNotExist( $userName );
117  } else {
118  $this->mUserName = $nt->getText();
119  $user = User::newFromName( $this->mUserName, false );
120  if ( $user ) {
121  $this->mUser = $user;
122  }
123  if ( !$user || ( $user->isAnon() && !User::isIP( $user->getName() ) ) ) {
124  $this->outputUserDoesNotExist( $userName );
125  }
126  }
127  }
128 
129  if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) {
130  $this->mSearch = $search;
131  $nt = Title::newFromText( $this->mSearch );
132 
133  if ( $nt ) {
134  $this->mQueryConds[] = 'LOWER(img_name)' .
135  $dbr->buildLike( $dbr->anyString(),
136  strtolower( $nt->getDBkey() ), $dbr->anyString() );
137  }
138  }
139 
140  if ( !$including ) {
141  if ( $this->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) {
142  $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
143  } else {
144  $this->mDefaultDirection = IndexPager::DIR_ASCENDING;
145  }
146  } else {
147  $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
148  }
149  // Set database before parent constructor to avoid setting it there with wfGetDB
150  $this->mDb = $dbr;
151 
152  parent::__construct( $context, $linkRenderer );
153  $this->localRepo = $repoGroup->getLocalRepo();
154  $this->permissionManager = $permissionManager;
155  $this->commentStore = $commentStore;
156  $this->actorMigration = $actorMigration;
157  $this->userCache = $userCache;
158  }
159 
165  public function getRelevantUser() {
166  return $this->mUser;
167  }
168 
174  protected function outputUserDoesNotExist( $userName ) {
175  $this->getOutput()->wrapWikiMsg(
176  "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
177  [
178  'listfiles-userdoesnotexist',
179  wfEscapeWikiText( $userName ),
180  ]
181  );
182  }
183 
191  protected function buildQueryConds( $table ) {
192  $prefix = $table === 'image' ? 'img' : 'oi';
193  $conds = [];
194 
195  if ( $this->mUserName !== null ) {
196  // getQueryInfoReal() should have handled the tables and joins.
197  $dbr = $this->getDatabase();
198  $actorWhere = $this->actorMigration->getWhere(
199  $dbr,
200  $prefix . '_user',
201  User::newFromName( $this->mUserName, false ),
202  // oldimage doesn't have an index on oi_user, while image does. Set $useId accordingly.
203  $prefix === 'img'
204  );
205  $conds[] = $actorWhere['conds'];
206  }
207 
208  if ( $this->mSearch !== '' ) {
209  $nt = Title::newFromText( $this->mSearch );
210  if ( $nt ) {
211  $dbr = $this->getDatabase();
212  $conds[] = 'LOWER(' . $prefix . '_name)' .
213  $dbr->buildLike( $dbr->anyString(),
214  strtolower( $nt->getDBkey() ), $dbr->anyString() );
215  }
216  }
217 
218  if ( $table === 'oldimage' ) {
219  // Don't want to deal with revdel.
220  // Future fixme: Show partial information as appropriate.
221  // Would have to be careful about filtering by username when username is deleted.
222  $conds['oi_deleted'] = 0;
223  }
224 
225  // Add mQueryConds in case anyone was subclassing and using the old variable.
226  return $conds + $this->mQueryConds;
227  }
228 
235  protected function getFieldNames() {
236  if ( !$this->mFieldNames ) {
237  $this->mFieldNames = [
238  'img_timestamp' => $this->msg( 'listfiles_date' )->text(),
239  'img_name' => $this->msg( 'listfiles_name' )->text(),
240  'thumb' => $this->msg( 'listfiles_thumb' )->text(),
241  'img_size' => $this->msg( 'listfiles_size' )->text(),
242  ];
243  if ( $this->mUserName === null ) {
244  // Do not show username if filtering by username
245  $this->mFieldNames['img_user_text'] = $this->msg( 'listfiles_user' )->text();
246  }
247  // img_description down here, in order so that its still after the username field.
248  $this->mFieldNames['img_description'] = $this->msg( 'listfiles_description' )->text();
249 
250  if ( !$this->getConfig()->get( 'MiserMode' ) && !$this->mShowAll ) {
251  $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
252  }
253  if ( $this->mShowAll ) {
254  $this->mFieldNames['top'] = $this->msg( 'listfiles-latestversion' )->text();
255  }
256  }
257 
258  return $this->mFieldNames;
259  }
260 
261  protected function isFieldSortable( $field ) {
262  if ( $this->mIncluding ) {
263  return false;
264  }
265  $sortable = array_keys( self::INDEX_FIELDS );
266  /* For reference, the indicies we can use for sorting are:
267  * On the image table: img_user_timestamp/img_usertext_timestamp/img_actor_timestamp,
268  * img_size, img_timestamp
269  * On oldimage: oi_usertext_timestamp/oi_actor_timestamp, oi_name_timestamp
270  *
271  * In particular that means we cannot sort by timestamp when not filtering
272  * by user and including old images in the results. Which is sad.
273  */
274  if ( $this->getConfig()->get( 'MiserMode' ) && $this->mUserName !== null ) {
275  // If we're sorting by user, the index only supports sorting by time.
276  if ( $field === 'img_timestamp' ) {
277  return true;
278  } else {
279  return false;
280  }
281  } elseif ( $this->getConfig()->get( 'MiserMode' )
282  && $this->mShowAll /* && mUserName === null */
283  ) {
284  // no oi_timestamp index, so only alphabetical sorting in this case.
285  if ( $field === 'img_name' ) {
286  return true;
287  } else {
288  return false;
289  }
290  }
291 
292  return in_array( $field, $sortable );
293  }
294 
295  public function getQueryInfo() {
296  // Hacky Hacky Hacky - I want to get query info
297  // for two different tables, without reimplementing
298  // the pager class.
299  $qi = $this->getQueryInfoReal( $this->mTableName );
300 
301  return $qi;
302  }
303 
314  protected function getQueryInfoReal( $table ) {
315  $dbr = $this->getDatabase();
316  $prefix = $table === 'oldimage' ? 'oi' : 'img';
317 
318  $tables = [ $table ];
319  $fields = array_keys( $this->getFieldNames() );
320  $fields = array_combine( $fields, $fields );
321  unset( $fields['img_description'] );
322  unset( $fields['img_user_text'] );
323 
324  if ( $table === 'oldimage' ) {
325  foreach ( $fields as $id => $field ) {
326  if ( substr( $id, 0, 4 ) === 'img_' ) {
327  $fields[$id] = $prefix . substr( $field, 3 );
328  }
329  }
330  $fields['top'] = $dbr->addQuotes( 'no' );
331  } elseif ( $this->mShowAll ) {
332  $fields['top'] = $dbr->addQuotes( 'yes' );
333  }
334  $fields['thumb'] = $prefix . '_name';
335 
336  $options = $join_conds = [];
337 
338  # Description field
339  $commentQuery = $this->commentStore->getJoin( $prefix . '_description' );
340  $tables += $commentQuery['tables'];
341  $fields += $commentQuery['fields'];
342  $join_conds += $commentQuery['joins'];
343  $fields['description_field'] = $dbr->addQuotes( "{$prefix}_description" );
344 
345  # User fields
346  $actorQuery = $this->actorMigration->getJoin( $prefix . '_user' );
347  $tables += $actorQuery['tables'];
348  $join_conds += $actorQuery['joins'];
349  $fields['img_user'] = $actorQuery['fields'][$prefix . '_user'];
350  $fields['img_user_text'] = $actorQuery['fields'][$prefix . '_user_text'];
351  $fields['img_actor'] = $actorQuery['fields'][$prefix . '_actor'];
352 
353  # Depends on $wgMiserMode
354  # Will also not happen if mShowAll is true.
355  if ( isset( $fields['count'] ) ) {
356  $fields['count'] = $dbr->buildSelectSubquery(
357  'oldimage',
358  'COUNT(oi_archive_name)',
359  'oi_name = img_name',
360  __METHOD__
361  );
362  }
363 
364  return [
365  'tables' => $tables,
366  'fields' => $fields,
367  'conds' => $this->buildQueryConds( $table ),
368  'options' => $options,
369  'join_conds' => $join_conds
370  ];
371  }
372 
385  public function reallyDoQuery( $offset, $limit, $order ) {
386  $dbr = $this->getDatabase();
387  $prevTableName = $this->mTableName;
388  $this->mTableName = 'image';
389  list( $tables, $fields, $conds, $fname, $options, $join_conds ) =
390  $this->buildQueryInfo( $offset, $limit, $order );
391  $imageRes = $dbr->select( $tables, $fields, $conds, $fname, $options, $join_conds );
392  $this->mTableName = $prevTableName;
393 
394  if ( !$this->mShowAll ) {
395  return $imageRes;
396  }
397 
398  $this->mTableName = 'oldimage';
399 
400  # Hacky...
401  $oldIndex = $this->mIndexField;
402  foreach ( $this->mIndexField as &$index ) {
403  if ( substr( $index, 0, 4 ) !== 'img_' ) {
404  throw new MWException( "Expected to be sorting on an image table field" );
405  }
406  $index = 'oi_' . substr( $index, 4 );
407  }
408 
409  list( $tables, $fields, $conds, $fname, $options, $join_conds ) =
410  $this->buildQueryInfo( $offset, $limit, $order );
411  $oldimageRes = $dbr->select( $tables, $fields, $conds, $fname, $options, $join_conds );
412 
413  $this->mTableName = $prevTableName;
414  $this->mIndexField = $oldIndex;
415 
416  return $this->combineResult( $imageRes, $oldimageRes, $limit, $order );
417  }
418 
430  protected function combineResult( $res1, $res2, $limit, $ascending ) {
431  $res1->rewind();
432  $res2->rewind();
433  $topRes1 = $res1->next();
434  $topRes2 = $res2->next();
435  $resultArray = [];
436  for ( $i = 0; $i < $limit && $topRes1 && $topRes2; $i++ ) {
437  if ( strcmp( $topRes1->{$this->mIndexField[0]}, $topRes2->{$this->mIndexField[0]} ) > 0 ) {
438  if ( !$ascending ) {
439  $resultArray[] = $topRes1;
440  $topRes1 = $res1->next();
441  } else {
442  $resultArray[] = $topRes2;
443  $topRes2 = $res2->next();
444  }
445  } elseif ( !$ascending ) {
446  $resultArray[] = $topRes2;
447  $topRes2 = $res2->next();
448  } else {
449  $resultArray[] = $topRes1;
450  $topRes1 = $res1->next();
451  }
452  }
453 
454  for ( ; $i < $limit && $topRes1; $i++ ) {
455  $resultArray[] = $topRes1;
456  $topRes1 = $res1->next();
457  }
458 
459  for ( ; $i < $limit && $topRes2; $i++ ) {
460  $resultArray[] = $topRes2;
461  $topRes2 = $res2->next();
462  }
463 
464  return new FakeResultWrapper( $resultArray );
465  }
466 
467  public function getIndexField() {
468  return [ self::INDEX_FIELDS[$this->mSort] ];
469  }
470 
471  public function getDefaultSort() {
472  if ( $this->mShowAll && $this->getConfig()->get( 'MiserMode' ) && $this->mUserName === null ) {
473  // Unfortunately no index on oi_timestamp.
474  return 'img_name';
475  } else {
476  return 'img_timestamp';
477  }
478  }
479 
480  protected function doBatchLookups() {
481  $userIds = [];
482  $this->mResult->seek( 0 );
483  foreach ( $this->mResult as $row ) {
484  $userIds[] = $row->img_user;
485  }
486  # Do a link batch query for names and userpages
487  $this->userCache->doQuery( $userIds, [ 'userpage' ], __METHOD__ );
488  }
489 
504  public function formatValue( $field, $value ) {
505  $linkRenderer = $this->getLinkRenderer();
506  switch ( $field ) {
507  case 'thumb':
508  $opt = [ 'time' => wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) ];
509  $file = $this->localRepo->findFile( $value, $opt );
510  // If statement for paranoia
511  if ( $file ) {
512  $thumb = $file->transform( [ 'width' => 180, 'height' => 360 ] );
513  if ( $thumb ) {
514  return $thumb->toHtml( [ 'desc-link' => true ] );
515  } else {
516  return $this->msg( 'thumbnail_error', '' )->escaped();
517  }
518  } else {
519  return htmlspecialchars( $value );
520  }
521  case 'img_timestamp':
522  // We may want to make this a link to the "old" version when displaying old files
523  return htmlspecialchars( $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ) );
524  case 'img_name':
525  static $imgfile = null;
526  if ( $imgfile === null ) {
527  $imgfile = $this->msg( 'imgfile' )->text();
528  }
529 
530  // Weird files can maybe exist? T24227
531  $filePage = Title::makeTitleSafe( NS_FILE, $value );
532  if ( $filePage ) {
533  $link = $linkRenderer->makeKnownLink(
534  $filePage,
535  $filePage->getText()
536  );
537  $download = Xml::element(
538  'a',
539  [ 'href' => $this->localRepo->newFile( $filePage )->getUrl() ],
540  $imgfile
541  );
542  $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
543 
544  // Add delete links if allowed
545  // From https://github.com/Wikia/app/pull/3859
546  if ( $this->permissionManager->userCan( 'delete', $this->getUser(), $filePage ) ) {
547  $deleteMsg = $this->msg( 'listfiles-delete' )->text();
548 
549  $delete = $linkRenderer->makeKnownLink(
550  $filePage, $deleteMsg, [], [ 'action' => 'delete' ]
551  );
552  $delete = $this->msg( 'parentheses' )->rawParams( $delete )->escaped();
553 
554  return "$link $download $delete";
555  }
556 
557  return "$link $download";
558  } else {
559  return htmlspecialchars( $value );
560  }
561  case 'img_user_text':
562  if ( $this->mCurrentRow->img_user ) {
563  $name = $this->userCache->getProp( $this->mCurrentRow->img_user, 'name' );
564  $link = $linkRenderer->makeLink(
565  Title::makeTitle( NS_USER, $name ),
566  $name
567  );
568  } else {
569  $link = htmlspecialchars( $value );
570  }
571 
572  return $link;
573  case 'img_size':
574  return htmlspecialchars( $this->getLanguage()->formatSize( $value ) );
575  case 'img_description':
576  $field = $this->mCurrentRow->description_field;
577  $value = $this->commentStore->getComment( $field, $this->mCurrentRow )->text;
578  return Linker::formatComment( $value );
579  case 'count':
580  return $this->getLanguage()->formatNum( intval( $value ) + 1 );
581  case 'top':
582  // Messages: listfiles-latestversion-yes, listfiles-latestversion-no
583  return $this->msg( 'listfiles-latestversion-' . $value )->escaped();
584  default:
585  throw new MWException( "Unknown field '$field'" );
586  }
587  }
588 
589  public function getForm() {
590  $formDescriptor = [];
591  $formDescriptor['limit'] = [
592  'type' => 'select',
593  'name' => 'limit',
594  'label-message' => 'table_pager_limit_label',
595  'options' => $this->getLimitSelectList(),
596  'default' => $this->mLimit,
597  ];
598 
599  if ( !$this->getConfig()->get( 'MiserMode' ) ) {
600  $formDescriptor['ilsearch'] = [
601  'type' => 'text',
602  'name' => 'ilsearch',
603  'id' => 'mw-ilsearch',
604  'label-message' => 'listfiles_search_for',
605  'default' => $this->mSearch,
606  'size' => '40',
607  'maxlength' => '255',
608  ];
609  }
610 
611  $formDescriptor['user'] = [
612  'type' => 'user',
613  'name' => 'user',
614  'id' => 'mw-listfiles-user',
615  'label-message' => 'username',
616  'default' => $this->mUserName,
617  'size' => '40',
618  'maxlength' => '255',
619  ];
620 
621  $formDescriptor['ilshowall'] = [
622  'type' => 'check',
623  'name' => 'ilshowall',
624  'id' => 'mw-listfiles-show-all',
625  'label-message' => 'listfiles-show-all',
626  'default' => $this->mShowAll,
627  ];
628 
629  $query = $this->getRequest()->getQueryValues();
630  unset( $query['title'] );
631  unset( $query['limit'] );
632  unset( $query['ilsearch'] );
633  unset( $query['ilshowall'] );
634  unset( $query['user'] );
635 
636  HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() )
637  ->setMethod( 'get' )
638  ->setId( 'mw-listfiles-form' )
639  ->setTitle( $this->getTitle() )
640  ->setSubmitTextMsg( 'table_pager_limit_submit' )
641  ->setWrapperLegendMsg( 'listfiles' )
642  ->addHiddenFields( $query )
643  ->prepareForm()
644  ->displayForm( '' );
645  }
646 
647  protected function getTableClass() {
648  return parent::getTableClass() . ' listfiles';
649  }
650 
651  protected function getNavClass() {
652  return parent::getNavClass() . ' listfiles_nav';
653  }
654 
655  protected function getSortHeaderClass() {
656  return parent::getSortHeaderClass() . ' listfiles_sort';
657  }
658 
659  public function getPagingQueries() {
660  $queries = parent::getPagingQueries();
661  if ( $this->mUserName !== null ) {
662  # Append the username to the query string
663  foreach ( $queries as &$query ) {
664  if ( $query !== false ) {
665  $query['user'] = $this->mUserName;
666  }
667  }
668  }
669 
670  return $queries;
671  }
672 
673  public function getDefaultQuery() {
674  $queries = parent::getDefaultQuery();
675  if ( !isset( $queries['user'] ) && $this->mUserName !== null ) {
676  $queries['user'] = $this->mUserName;
677  }
678 
679  return $queries;
680  }
681 
682  public function getTitle() {
683  return SpecialPage::getTitleFor( 'Listfiles' );
684  }
685 }
ImageListPager\reallyDoQuery
reallyDoQuery( $offset, $limit, $order)
Override reallyDoQuery to mix together two queries.
Definition: ImageListPager.php:385
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:37
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:70
ImageListPager\__construct
__construct(IContextSource $context, $userName, $search, $including, $showAll, LinkRenderer $linkRenderer, RepoGroup $repoGroup, PermissionManager $permissionManager, ILoadBalancer $loadBalancer, CommentStore $commentStore, ActorMigration $actorMigration, UserCache $userCache)
Definition: ImageListPager.php:93
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:328
ImageListPager\$mSearch
$mSearch
Definition: ImageListPager.php:47
UserCache
Definition: UserCache.php:32
ImageListPager\getSortHeaderClass
getSortHeaderClass()
Stable to override.
Definition: ImageListPager.php:655
ImageListPager\getPagingQueries
getPagingQueries()
Get a URL query array for the prev, next, first and last links.
Definition: ImageListPager.php:659
MediaWiki\Linker\LinkRenderer
Class that generates HTML links for pages.
Definition: LinkRenderer.php:41
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1815
ImageListPager\getNavClass
getNavClass()
Stable to override.
Definition: ImageListPager.php:651
getUser
getUser()
ImageListPager\$mUser
User null $mUser
The relevant user.
Definition: ImageListPager.php:45
ImageListPager\$permissionManager
PermissionManager $permissionManager
Definition: ImageListPager.php:59
IndexPager\getDatabase
getDatabase()
Get the Database object in use.
Definition: IndexPager.php:244
NS_FILE
const NS_FILE
Definition: Defines.php:75
CommentStore
Handle database storage of comments such as edit summaries and log reasons.
Definition: CommentStore.php:42
$file
if(PHP_SAPI !='cli-server') if(!isset( $_SERVER['SCRIPT_FILENAME'])) $file
Item class for a filearchive table row.
Definition: router.php:42
User\newFromName
static newFromName( $name, $validate='valid')
Definition: User.php:545
IndexPager\$linkRenderer
LinkRenderer $linkRenderer
Definition: IndexPager.php:167
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:106
ContextSource\getRequest
getRequest()
Definition: ContextSource.php:79
ImageListPager\doBatchLookups
doBatchLookups()
Called from getBody(), before getStartBody() is called and after doQuery() was called.
Definition: ImageListPager.php:480
ActorMigration
This class handles the logic for the actor table migration and should always be used in lieu of direc...
Definition: ActorMigration.php:41
Wikimedia\Rdbms\FakeResultWrapper
Overloads the relevant methods of the real ResultsWrapper so it doesn't go anywhere near an actual da...
Definition: FakeResultWrapper.php:11
getContext
getContext()
IndexPager\DIR_ASCENDING
const DIR_ASCENDING
Backwards-compatible constant for $mDefaultDirection field (do not change)
Definition: IndexPager.php:78
Wikimedia\Rdbms\ILoadBalancer\getConnectionRef
getConnectionRef( $i, $groups=[], $domain=false, $flags=0)
Get a live database handle reference for a real or virtual (DB_MASTER/DB_REPLICA) server index.
ImageListPager\$actorMigration
ActorMigration $actorMigration
Definition: ImageListPager.php:65
ImageListPager\getIndexField
getIndexField()
Returns the name of the index field.If the pager supports multiple orders, it may return an array of ...
Definition: ImageListPager.php:467
$dbr
$dbr
Definition: testCompression.php:54
IndexPager\$mIndexField
string string[] $mIndexField
The index to actually be used for ordering.
Definition: IndexPager.php:110
ImageListPager\getFieldNames
getFieldNames()
The array keys (but not the array values) are used in sql.
Definition: ImageListPager.php:235
MWException
MediaWiki exception.
Definition: MWException.php:29
ImageListPager\outputUserDoesNotExist
outputUserDoesNotExist( $userName)
Add a message to the output stating that the user doesn't exist.
Definition: ImageListPager.php:174
ImageListPager\$userCache
UserCache $userCache
Definition: ImageListPager.php:68
ImageListPager\getQueryInfo
getQueryInfo()
Provides all parameters needed for the main paged query.
Definition: ImageListPager.php:295
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:24
IndexPager\buildQueryInfo
buildQueryInfo( $offset, $limit, $order)
Build variables to use by the database wrapper.
Definition: IndexPager.php:464
ContextSource\getOutput
getOutput()
Definition: ContextSource.php:124
ImageListPager\$mShowAll
$mShowAll
Definition: ImageListPager.php:51
TablePager
Table-based display with a user-selectable sort order Stable to extend.
Definition: TablePager.php:31
ImageListPager\getTitle
getTitle()
Definition: ImageListPager.php:682
Xml\element
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
Definition: Xml.php:41
User\isIP
static isIP( $name)
Does the string match an anonymous IP address?
Definition: User.php:956
ImageListPager\INDEX_FIELDS
const INDEX_FIELDS
The unique sort fields for the sort options for unique pagniate.
Definition: ImageListPager.php:73
ImageListPager\$mTableName
$mTableName
Definition: ImageListPager.php:53
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:591
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
ImageListPager\combineResult
combineResult( $res1, $res2, $limit, $ascending)
Combine results from 2 tables.
Definition: ImageListPager.php:430
ContextSource\setContext
setContext(IContextSource $context)
Definition: ContextSource.php:61
ImageListPager\$commentStore
CommentStore $commentStore
Definition: ImageListPager.php:62
ImageListPager\getTableClass
getTableClass()
TablePager relies on mw-datatable for styling, see T214208.
Definition: ImageListPager.php:647
ContextSource\msg
msg( $key,... $params)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:187
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:617
MediaWiki\Permissions\PermissionManager
A service class for checking permissions To obtain an instance, use MediaWikiServices::getInstance()-...
Definition: PermissionManager.php:50
ImageListPager\getDefaultSort
getDefaultSort()
The database field name used as a default sort order.
Definition: ImageListPager.php:471
RepoGroup\getLocalRepo
getLocalRepo()
Get the local repository, i.e.
Definition: RepoGroup.php:357
ImageListPager\getQueryInfoReal
getQueryInfoReal( $table)
Actually get the query info.
Definition: ImageListPager.php:314
ImageListPager\$mIncluding
$mIncluding
Definition: ImageListPager.php:49
ImageListPager\$mQueryConds
$mQueryConds
Definition: ImageListPager.php:36
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1494
ImageListPager\buildQueryConds
buildQueryConds( $table)
Build the where clause of the query.
Definition: ImageListPager.php:191
ImageListPager\isFieldSortable
isFieldSortable( $field)
Return true if the named field should be sortable by the UI, false otherwise.
Definition: ImageListPager.php:261
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:55
Linker\formatComment
static formatComment( $comment, $title=null, $local=false, $wikiId=null)
This function is called by all recent changes variants, by the page history, and by the user contribu...
Definition: Linker.php:1199
IndexPager\DIR_DESCENDING
const DIR_DESCENDING
Backwards-compatible constant for $mDefaultDirection field (do not change)
Definition: IndexPager.php:80
ImageListPager
Definition: ImageListPager.php:31
getTitle
getTitle()
Definition: RevisionSearchResultTrait.php:81
ImageListPager\$localRepo
LocalRepo $localRepo
Definition: ImageListPager.php:56
RepoGroup
Prioritized list of file repositories.
Definition: RepoGroup.php:31
NS_USER
const NS_USER
Definition: Defines.php:71
ImageListPager\getRelevantUser
getRelevantUser()
Get the user relevant to the ImageList.
Definition: ImageListPager.php:165
ImageListPager\formatValue
formatValue( $field, $value)
Definition: ImageListPager.php:504
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:56
HTMLForm\factory
static factory( $displayFormat,... $arguments)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:316
LocalRepo
A repository that stores files in the local filesystem and registers them in the wiki's own database.
Definition: LocalRepo.php:37
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition: ILoadBalancer.php:81
ImageListPager\getDefaultQuery
getDefaultQuery()
Get an array of query parameters that should be put into self-links.
Definition: ImageListPager.php:673
ImageListPager\getForm
getForm()
Definition: ImageListPager.php:589
ImageListPager\$mUserName
$mUserName
Definition: ImageListPager.php:38
ImageListPager\$mFieldNames
$mFieldNames
Definition: ImageListPager.php:33