MediaWiki  1.32.5
ImageListPager.php
Go to the documentation of this file.
1 <?php
28 
29 class ImageListPager extends TablePager {
30 
31  protected $mFieldNames = null;
32 
33  // Subclasses should override buildQueryConds instead of using $mQueryConds variable.
34  protected $mQueryConds = [];
35 
36  protected $mUserName = null;
37 
43  protected $mUser = null;
44 
45  protected $mSearch = '';
46 
47  protected $mIncluding = false;
48 
49  protected $mShowAll = false;
50 
51  protected $mTableName = 'image';
52 
53  function __construct( IContextSource $context, $userName = null, $search = '',
54  $including = false, $showAll = false
55  ) {
56  $this->setContext( $context );
57  $this->mIncluding = $including;
58  $this->mShowAll = $showAll;
59 
60  if ( $userName !== null && $userName !== '' ) {
61  $nt = Title::makeTitleSafe( NS_USER, $userName );
62  if ( is_null( $nt ) ) {
63  $this->outputUserDoesNotExist( $userName );
64  } else {
65  $this->mUserName = $nt->getText();
66  $user = User::newFromName( $this->mUserName, false );
67  if ( $user ) {
68  $this->mUser = $user;
69  }
70  if ( !$user || ( $user->isAnon() && !User::isIP( $user->getName() ) ) ) {
71  $this->outputUserDoesNotExist( $userName );
72  }
73  }
74  }
75 
76  if ( $search !== '' && !$this->getConfig()->get( 'MiserMode' ) ) {
77  $this->mSearch = $search;
78  $nt = Title::newFromText( $this->mSearch );
79 
80  if ( $nt ) {
81  $dbr = wfGetDB( DB_REPLICA );
82  $this->mQueryConds[] = 'LOWER(img_name)' .
83  $dbr->buildLike( $dbr->anyString(),
84  strtolower( $nt->getDBkey() ), $dbr->anyString() );
85  }
86  }
87 
88  if ( !$including ) {
89  if ( $this->getRequest()->getText( 'sort', 'img_date' ) == 'img_date' ) {
90  $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
91  } else {
92  $this->mDefaultDirection = IndexPager::DIR_ASCENDING;
93  }
94  } else {
95  $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
96  }
97 
98  parent::__construct( $context );
99  }
100 
106  function getRelevantUser() {
107  return $this->mUser;
108  }
109 
115  protected function outputUserDoesNotExist( $userName ) {
116  $this->getOutput()->wrapWikiMsg(
117  "<div class=\"mw-userpage-userdoesnotexist error\">\n$1\n</div>",
118  [
119  'listfiles-userdoesnotexist',
120  wfEscapeWikiText( $userName ),
121  ]
122  );
123  }
124 
132  protected function buildQueryConds( $table ) {
133  $prefix = $table === 'image' ? 'img' : 'oi';
134  $conds = [];
135 
136  if ( !is_null( $this->mUserName ) ) {
137  // getQueryInfoReal() should have handled the tables and joins.
138  $dbr = wfGetDB( DB_REPLICA );
139  $actorWhere = ActorMigration::newMigration()->getWhere(
140  $dbr,
141  $prefix . '_user',
142  User::newFromName( $this->mUserName, false )
143  );
144  $conds[] = $actorWhere['conds'];
145  }
146 
147  if ( $this->mSearch !== '' ) {
148  $nt = Title::newFromText( $this->mSearch );
149  if ( $nt ) {
150  $dbr = wfGetDB( DB_REPLICA );
151  $conds[] = 'LOWER(' . $prefix . '_name)' .
152  $dbr->buildLike( $dbr->anyString(),
153  strtolower( $nt->getDBkey() ), $dbr->anyString() );
154  }
155  }
156 
157  if ( $table === 'oldimage' ) {
158  // Don't want to deal with revdel.
159  // Future fixme: Show partial information as appropriate.
160  // Would have to be careful about filtering by username when username is deleted.
161  $conds['oi_deleted'] = 0;
162  }
163 
164  // Add mQueryConds in case anyone was subclassing and using the old variable.
165  return $conds + $this->mQueryConds;
166  }
167 
174  function getFieldNames() {
175  if ( !$this->mFieldNames ) {
176  $this->mFieldNames = [
177  'img_timestamp' => $this->msg( 'listfiles_date' )->text(),
178  'img_name' => $this->msg( 'listfiles_name' )->text(),
179  'thumb' => $this->msg( 'listfiles_thumb' )->text(),
180  'img_size' => $this->msg( 'listfiles_size' )->text(),
181  ];
182  if ( is_null( $this->mUserName ) ) {
183  // Do not show username if filtering by username
184  $this->mFieldNames['img_user_text'] = $this->msg( 'listfiles_user' )->text();
185  }
186  // img_description down here, in order so that its still after the username field.
187  $this->mFieldNames['img_description'] = $this->msg( 'listfiles_description' )->text();
188 
189  if ( !$this->getConfig()->get( 'MiserMode' ) && !$this->mShowAll ) {
190  $this->mFieldNames['count'] = $this->msg( 'listfiles_count' )->text();
191  }
192  if ( $this->mShowAll ) {
193  $this->mFieldNames['top'] = $this->msg( 'listfiles-latestversion' )->text();
194  }
195  }
196 
197  return $this->mFieldNames;
198  }
199 
200  function isFieldSortable( $field ) {
201  if ( $this->mIncluding ) {
202  return false;
203  }
204  $sortable = [ 'img_timestamp', 'img_name', 'img_size' ];
205  /* For reference, the indicies we can use for sorting are:
206  * On the image table: img_user_timestamp/img_usertext_timestamp/img_actor_timestamp,
207  * img_size, img_timestamp
208  * On oldimage: oi_usertext_timestamp/oi_actor_timestamp, oi_name_timestamp
209  *
210  * In particular that means we cannot sort by timestamp when not filtering
211  * by user and including old images in the results. Which is sad.
212  */
213  if ( $this->getConfig()->get( 'MiserMode' ) && !is_null( $this->mUserName ) ) {
214  // If we're sorting by user, the index only supports sorting by time.
215  if ( $field === 'img_timestamp' ) {
216  return true;
217  } else {
218  return false;
219  }
220  } elseif ( $this->getConfig()->get( 'MiserMode' )
221  && $this->mShowAll /* && mUserName === null */
222  ) {
223  // no oi_timestamp index, so only alphabetical sorting in this case.
224  if ( $field === 'img_name' ) {
225  return true;
226  } else {
227  return false;
228  }
229  }
230 
231  return in_array( $field, $sortable );
232  }
233 
234  function getQueryInfo() {
235  // Hacky Hacky Hacky - I want to get query info
236  // for two different tables, without reimplementing
237  // the pager class.
238  $qi = $this->getQueryInfoReal( $this->mTableName );
239 
240  return $qi;
241  }
242 
253  protected function getQueryInfoReal( $table ) {
254  $prefix = $table === 'oldimage' ? 'oi' : 'img';
255 
256  $tables = [ $table ];
257  $fields = $this->getFieldNames();
258  unset( $fields['img_description'] );
259  unset( $fields['img_user_text'] );
260  $fields = array_keys( $fields );
261 
262  if ( $table === 'oldimage' ) {
263  foreach ( $fields as $id => &$field ) {
264  if ( substr( $field, 0, 4 ) !== 'img_' ) {
265  continue;
266  }
267  $field = $prefix . substr( $field, 3 ) . ' AS ' . $field;
268  }
269  $fields[array_search( 'top', $fields )] = "'no' AS top";
270  } else {
271  if ( $this->mShowAll ) {
272  $fields[array_search( 'top', $fields )] = "'yes' AS top";
273  }
274  }
275  $fields[array_search( 'thumb', $fields )] = $prefix . '_name AS thumb';
276 
277  $options = $join_conds = [];
278 
279  # Description field
280  $commentQuery = CommentStore::getStore()->getJoin( $prefix . '_description' );
281  $tables += $commentQuery['tables'];
282  $fields += $commentQuery['fields'];
283  $join_conds += $commentQuery['joins'];
284  $fields['description_field'] = "'{$prefix}_description'";
285 
286  # User fields
287  $actorQuery = ActorMigration::newMigration()->getJoin( $prefix . '_user' );
288  $tables += $actorQuery['tables'];
289  $join_conds += $actorQuery['joins'];
290  $fields['img_user'] = $actorQuery['fields'][$prefix . '_user'];
291  $fields['img_user_text'] = $actorQuery['fields'][$prefix . '_user_text'];
292  $fields['img_actor'] = $actorQuery['fields'][$prefix . '_actor'];
293 
294  # Depends on $wgMiserMode
295  # Will also not happen if mShowAll is true.
296  if ( isset( $this->mFieldNames['count'] ) ) {
297  $tables[] = 'oldimage';
298 
299  # Need to rewrite this one
300  foreach ( $fields as &$field ) {
301  if ( $field == 'count' ) {
302  $field = 'COUNT(oi_archive_name) AS count';
303  }
304  }
305  unset( $field );
306 
307  $columnlist = preg_grep( '/^img/', array_keys( $this->getFieldNames() ) );
308  $options = [ 'GROUP BY' => array_merge( [ $fields['img_user'] ], $columnlist ) ];
309  $join_conds['oldimage'] = [ 'LEFT JOIN', 'oi_name = img_name' ];
310  }
311 
312  return [
313  'tables' => $tables,
314  'fields' => $fields,
315  'conds' => $this->buildQueryConds( $table ),
316  'options' => $options,
317  'join_conds' => $join_conds
318  ];
319  }
320 
333  function reallyDoQuery( $offset, $limit, $asc ) {
334  $prevTableName = $this->mTableName;
335  $this->mTableName = 'image';
336  list( $tables, $fields, $conds, $fname, $options, $join_conds ) =
337  $this->buildQueryInfo( $offset, $limit, $asc );
338  $imageRes = $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds );
339  $this->mTableName = $prevTableName;
340 
341  if ( !$this->mShowAll ) {
342  return $imageRes;
343  }
344 
345  $this->mTableName = 'oldimage';
346 
347  # Hacky...
348  $oldIndex = $this->mIndexField;
349  if ( substr( $this->mIndexField, 0, 4 ) !== 'img_' ) {
350  throw new MWException( "Expected to be sorting on an image table field" );
351  }
352  $this->mIndexField = 'oi_' . substr( $this->mIndexField, 4 );
353 
354  list( $tables, $fields, $conds, $fname, $options, $join_conds ) =
355  $this->buildQueryInfo( $offset, $limit, $asc );
356  $oldimageRes = $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds );
357 
358  $this->mTableName = $prevTableName;
359  $this->mIndexField = $oldIndex;
360 
361  return $this->combineResult( $imageRes, $oldimageRes, $limit, $asc );
362  }
363 
375  protected function combineResult( $res1, $res2, $limit, $ascending ) {
376  $res1->rewind();
377  $res2->rewind();
378  $topRes1 = $res1->next();
379  $topRes2 = $res2->next();
380  $resultArray = [];
381  for ( $i = 0; $i < $limit && $topRes1 && $topRes2; $i++ ) {
382  if ( strcmp( $topRes1->{$this->mIndexField}, $topRes2->{$this->mIndexField} ) > 0 ) {
383  if ( !$ascending ) {
384  $resultArray[] = $topRes1;
385  $topRes1 = $res1->next();
386  } else {
387  $resultArray[] = $topRes2;
388  $topRes2 = $res2->next();
389  }
390  } else {
391  if ( !$ascending ) {
392  $resultArray[] = $topRes2;
393  $topRes2 = $res2->next();
394  } else {
395  $resultArray[] = $topRes1;
396  $topRes1 = $res1->next();
397  }
398  }
399  }
400 
401  for ( ; $i < $limit && $topRes1; $i++ ) {
402  $resultArray[] = $topRes1;
403  $topRes1 = $res1->next();
404  }
405 
406  for ( ; $i < $limit && $topRes2; $i++ ) {
407  $resultArray[] = $topRes2;
408  $topRes2 = $res2->next();
409  }
410 
411  return new FakeResultWrapper( $resultArray );
412  }
413 
414  function getDefaultSort() {
415  if ( $this->mShowAll && $this->getConfig()->get( 'MiserMode' ) && is_null( $this->mUserName ) ) {
416  // Unfortunately no index on oi_timestamp.
417  return 'img_name';
418  } else {
419  return 'img_timestamp';
420  }
421  }
422 
423  function doBatchLookups() {
424  $userIds = [];
425  $this->mResult->seek( 0 );
426  foreach ( $this->mResult as $row ) {
427  $userIds[] = $row->img_user;
428  }
429  # Do a link batch query for names and userpages
430  UserCache::singleton()->doQuery( $userIds, [ 'userpage' ], __METHOD__ );
431  }
432 
447  function formatValue( $field, $value ) {
448  $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
449  switch ( $field ) {
450  case 'thumb':
451  $opt = [ 'time' => wfTimestamp( TS_MW, $this->mCurrentRow->img_timestamp ) ];
452  $file = RepoGroup::singleton()->getLocalRepo()->findFile( $value, $opt );
453  // If statement for paranoia
454  if ( $file ) {
455  $thumb = $file->transform( [ 'width' => 180, 'height' => 360 ] );
456  if ( $thumb ) {
457  return $thumb->toHtml( [ 'desc-link' => true ] );
458  } else {
459  return $this->msg( 'thumbnail_error', '' )->escaped();
460  }
461  } else {
462  return htmlspecialchars( $value );
463  }
464  case 'img_timestamp':
465  // We may want to make this a link to the "old" version when displaying old files
466  return htmlspecialchars( $this->getLanguage()->userTimeAndDate( $value, $this->getUser() ) );
467  case 'img_name':
468  static $imgfile = null;
469  if ( $imgfile === null ) {
470  $imgfile = $this->msg( 'imgfile' )->text();
471  }
472 
473  // Weird files can maybe exist? T24227
474  $filePage = Title::makeTitleSafe( NS_FILE, $value );
475  if ( $filePage ) {
476  $link = $linkRenderer->makeKnownLink(
477  $filePage,
478  $filePage->getText()
479  );
480  $download = Xml::element( 'a',
481  [ 'href' => wfLocalFile( $filePage )->getUrl() ],
482  $imgfile
483  );
484  $download = $this->msg( 'parentheses' )->rawParams( $download )->escaped();
485 
486  // Add delete links if allowed
487  // From https://github.com/Wikia/app/pull/3859
488  if ( $filePage->userCan( 'delete', $this->getUser() ) ) {
489  $deleteMsg = $this->msg( 'listfiles-delete' )->text();
490 
491  $delete = $linkRenderer->makeKnownLink(
492  $filePage, $deleteMsg, [], [ 'action' => 'delete' ]
493  );
494  $delete = $this->msg( 'parentheses' )->rawParams( $delete )->escaped();
495 
496  return "$link $download $delete";
497  }
498 
499  return "$link $download";
500  } else {
501  return htmlspecialchars( $value );
502  }
503  case 'img_user_text':
504  if ( $this->mCurrentRow->img_user ) {
505  $name = User::whoIs( $this->mCurrentRow->img_user );
506  $link = $linkRenderer->makeLink(
508  $name
509  );
510  } else {
511  $link = htmlspecialchars( $value );
512  }
513 
514  return $link;
515  case 'img_size':
516  return htmlspecialchars( $this->getLanguage()->formatSize( $value ) );
517  case 'img_description':
518  $field = $this->mCurrentRow->description_field;
519  $value = CommentStore::getStore()->getComment( $field, $this->mCurrentRow )->text;
520  return Linker::formatComment( $value );
521  case 'count':
522  return $this->getLanguage()->formatNum( intval( $value ) + 1 );
523  case 'top':
524  // Messages: listfiles-latestversion-yes, listfiles-latestversion-no
525  return $this->msg( 'listfiles-latestversion-' . $value );
526  default:
527  throw new MWException( "Unknown field '$field'" );
528  }
529  }
530 
531  function getForm() {
532  $formDescriptor = [];
533  $formDescriptor['limit'] = [
534  'type' => 'select',
535  'name' => 'limit',
536  'label-message' => 'table_pager_limit_label',
537  'options' => $this->getLimitSelectList(),
538  'default' => $this->mLimit,
539  ];
540 
541  if ( !$this->getConfig()->get( 'MiserMode' ) ) {
542  $formDescriptor['ilsearch'] = [
543  'type' => 'text',
544  'name' => 'ilsearch',
545  'id' => 'mw-ilsearch',
546  'label-message' => 'listfiles_search_for',
547  'default' => $this->mSearch,
548  'size' => '40',
549  'maxlength' => '255',
550  ];
551  }
552 
553  $formDescriptor['user'] = [
554  'type' => 'user',
555  'name' => 'user',
556  'id' => 'mw-listfiles-user',
557  'label-message' => 'username',
558  'default' => $this->mUserName,
559  'size' => '40',
560  'maxlength' => '255',
561  ];
562 
563  $formDescriptor['ilshowall'] = [
564  'type' => 'check',
565  'name' => 'ilshowall',
566  'id' => 'mw-listfiles-show-all',
567  'label-message' => 'listfiles-show-all',
568  'default' => $this->mShowAll,
569  ];
570 
571  $query = $this->getRequest()->getQueryValues();
572  unset( $query['title'] );
573  unset( $query['limit'] );
574  unset( $query['ilsearch'] );
575  unset( $query['ilshowall'] );
576  unset( $query['user'] );
577 
578  $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
579  $htmlForm
580  ->setMethod( 'get' )
581  ->setId( 'mw-listfiles-form' )
582  ->setTitle( $this->getTitle() )
583  ->setSubmitTextMsg( 'table_pager_limit_submit' )
584  ->setWrapperLegendMsg( 'listfiles' )
585  ->addHiddenFields( $query )
586  ->prepareForm()
587  ->displayForm( '' );
588  }
589 
590  protected function getTableClass() {
591  return parent::getTableClass() . ' listfiles';
592  }
593 
594  protected function getNavClass() {
595  return parent::getNavClass() . ' listfiles_nav';
596  }
597 
598  protected function getSortHeaderClass() {
599  return parent::getSortHeaderClass() . ' listfiles_sort';
600  }
601 
602  function getPagingQueries() {
603  $queries = parent::getPagingQueries();
604  if ( !is_null( $this->mUserName ) ) {
605  # Append the username to the query string
606  foreach ( $queries as &$query ) {
607  if ( $query !== false ) {
608  $query['user'] = $this->mUserName;
609  }
610  }
611  }
612 
613  return $queries;
614  }
615 
616  function getDefaultQuery() {
617  $queries = parent::getDefaultQuery();
618  if ( !isset( $queries['user'] ) && !is_null( $this->mUserName ) ) {
619  $queries['user'] = $this->mUserName;
620  }
621 
622  return $queries;
623  }
624 
625  function getTitle() {
626  return SpecialPage::getTitleFor( 'Listfiles' );
627  }
628 }
ContextSource\$context
IContextSource $context
Definition: ContextSource.php:33
ContextSource\getConfig
getConfig()
Definition: ContextSource.php:63
$user
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account $user
Definition: hooks.txt:244
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:280
RepoGroup\singleton
static singleton()
Get a RepoGroup instance.
Definition: RepoGroup.php:59
IndexPager\buildQueryInfo
buildQueryInfo( $offset, $limit, $descending)
Build variables to use by the database wrapper.
Definition: IndexPager.php:380
ImageListPager\$mSearch
$mSearch
Definition: ImageListPager.php:45
ImageListPager\getSortHeaderClass
getSortHeaderClass()
Definition: ImageListPager.php:598
$opt
$opt
Definition: postprocess-phan.php:115
ContextSource\msg
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
Definition: ContextSource.php:168
ImageListPager\getPagingQueries
getPagingQueries()
Get a URL query array for the prev, next, first and last links.
Definition: ImageListPager.php:602
wfTimestamp
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
Definition: GlobalFunctions.php:1954
ImageListPager\getNavClass
getNavClass()
Definition: ImageListPager.php:594
ImageListPager\$mUser
User null $mUser
The relevant user.
Definition: ImageListPager.php:43
$tables
this hook is for auditing only RecentChangesLinked and Watchlist Do not use this to implement individual filters if they are compatible with the ChangesListFilter and ChangesListFilterGroup structure use sub classes of those in conjunction with the ChangesListSpecialPageStructuredFilters hook This hook can be used to implement filters that do not implement that or custom behavior that is not an individual filter e g Watchlist & $tables
Definition: hooks.txt:1018
NS_FILE
const NS_FILE
Definition: Defines.php:70
User\newFromName
static newFromName( $name, $validate='valid')
Static factory method for creation from username.
Definition: User.php:592
$linkRenderer
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
Definition: hooks.txt:2044
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:82
$formDescriptor
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
Definition: hooks.txt:2123
ContextSource\getRequest
getRequest()
Definition: ContextSource.php:71
ImageListPager\doBatchLookups
doBatchLookups()
Called from getBody(), before getStartBody() is called and after doQuery() was called.
Definition: ImageListPager.php:423
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
Constants for the $mDefaultDirection field.
Definition: IndexPager.php:75
ActorMigration\newMigration
static newMigration()
Static constructor.
Definition: ActorMigration.php:111
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
$dbr
$dbr
Definition: testCompression.php:50
$query
null for the wiki Added should default to null in handler for backwards compatibility add a value to it if you want to add a cookie that have to vary cache options can modify $query
Definition: hooks.txt:1627
ImageListPager\getFieldNames
getFieldNames()
The array keys (but not the array values) are used in sql.
Definition: ImageListPager.php:174
MWException
MediaWiki exception.
Definition: MWException.php:26
ImageListPager\outputUserDoesNotExist
outputUserDoesNotExist( $userName)
Add a message to the output stating that the user doesn't exist.
Definition: ImageListPager.php:115
ImageListPager\getQueryInfo
getQueryInfo()
This function should be overridden to provide all parameters needed for the main paged query.
Definition: ImageListPager.php:234
Wikimedia\Rdbms\IResultWrapper
Result wrapper for grabbing data queried from an IDatabase object.
Definition: IResultWrapper.php:24
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2693
ContextSource\getOutput
getOutput()
Definition: ContextSource.php:112
ImageListPager\$mShowAll
$mShowAll
Definition: ImageListPager.php:49
HTMLForm\factory
static factory( $displayFormat)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:286
TablePager
Table-based display with a user-selectable sort order.
Definition: TablePager.php:28
ImageListPager\getTitle
getTitle()
Definition: ImageListPager.php:625
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:971
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
ImageListPager\__construct
__construct(IContextSource $context, $userName=null, $search='', $including=false, $showAll=false)
Definition: ImageListPager.php:53
ImageListPager\$mTableName
$mTableName
Definition: ImageListPager.php:51
Title\makeTitle
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:545
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
ImageListPager\combineResult
combineResult( $res1, $res2, $limit, $ascending)
Combine results from 2 tables.
Definition: ImageListPager.php:375
ContextSource\setContext
setContext(IContextSource $context)
Definition: ContextSource.php:55
list
deferred txt A few of the database updates required by various functions here can be deferred until after the result page is displayed to the user For updating the view updating the linked to tables after a etc PHP does not yet have any way to tell the server to actually return and disconnect while still running these but it might have such a feature in the future We handle these by creating a deferred update object and putting those objects on a global list
Definition: deferred.txt:11
$fname
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
Definition: Setup.php:121
ImageListPager\getTableClass
getTableClass()
Definition: ImageListPager.php:590
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
Title\makeTitleSafe
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Definition: Title.php:573
ImageListPager\getDefaultSort
getDefaultSort()
The database field name used as a default sort order.
Definition: ImageListPager.php:414
User\whoIs
static whoIs( $id)
Get the username corresponding to a given user ID.
Definition: User.php:891
ImageListPager\reallyDoQuery
reallyDoQuery( $offset, $limit, $asc)
Override reallyDoQuery to mix together two queries.
Definition: ImageListPager.php:333
$value
$value
Definition: styleTest.css.php:49
ImageListPager\getQueryInfoReal
getQueryInfoReal( $table)
Actually get the query info.
Definition: ImageListPager.php:253
ImageListPager\$mIncluding
$mIncluding
Definition: ImageListPager.php:47
ImageListPager\$mQueryConds
$mQueryConds
Definition: ImageListPager.php:34
wfEscapeWikiText
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
Definition: GlobalFunctions.php:1617
ImageListPager\buildQueryConds
buildQueryConds( $table)
Build the where clause of the query.
Definition: ImageListPager.php:132
ImageListPager\isFieldSortable
isFieldSortable( $field)
Return true if the named field should be sortable by the UI, false otherwise.
Definition: ImageListPager.php:200
IContextSource
Interface for objects which can provide a MediaWiki context on request.
Definition: IContextSource.php:53
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:1088
IndexPager\DIR_DESCENDING
const DIR_DESCENDING
Definition: IndexPager.php:76
$options
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition: hooks.txt:2044
ImageListPager
Definition: ImageListPager.php:29
IndexPager\$mIndexField
$mIndexField
The index to actually be used for ordering.
Definition: IndexPager.php:91
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
UserCache\singleton
static singleton()
Definition: UserCache.php:34
NS_USER
const NS_USER
Definition: Defines.php:66
$link
usually copyright or history_copyright This message must be in HTML not wikitext & $link
Definition: hooks.txt:3098
ImageListPager\getRelevantUser
getRelevantUser()
Get the user relevant to the ImageList.
Definition: ImageListPager.php:106
ImageListPager\formatValue
formatValue( $field, $value)
Definition: ImageListPager.php:447
MediaWikiServices
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency MediaWikiServices
Definition: injection.txt:23
CommentStore\getStore
static getStore()
Definition: CommentStore.php:125
User
The User object encapsulates all of the user-specific settings (user_id, name, rights,...
Definition: User.php:47
wfLocalFile
wfLocalFile( $title)
Get an object referring to a locally registered file.
Definition: GlobalFunctions.php:2745
$queries
$queries
Definition: profileinfo.php:416
ImageListPager\getDefaultQuery
getDefaultQuery()
Get an array of query parameters that should be put into self-links.
Definition: ImageListPager.php:616
ImageListPager\getForm
getForm()
Definition: ImageListPager.php:531
ImageListPager\$mUserName
$mUserName
Definition: ImageListPager.php:36
ImageListPager\$mFieldNames
$mFieldNames
Definition: ImageListPager.php:31