MediaWiki  1.28.0
IndexPager.php
Go to the documentation of this file.
1 <?php
66 abstract class IndexPager extends ContextSource implements Pager {
72  const DIR_ASCENDING = false;
73  const DIR_DESCENDING = true;
74 
75  public $mRequest;
76  public $mLimitsShown = [ 20, 50, 100, 250, 500 ];
77  public $mDefaultLimit = 50;
78  public $mOffset, $mLimit;
79  public $mQueryDone = false;
80  public $mDb;
82 
87  protected $mIndexField;
92  protected $mExtraSortFields;
95  protected $mOrderType;
109 
111  public $mIsFirst;
112  public $mIsLast;
113 
115 
119  protected $mIncludeOffset = false;
120 
126  public $mResult;
127 
128  public function __construct( IContextSource $context = null ) {
129  if ( $context ) {
130  $this->setContext( $context );
131  }
132 
133  $this->mRequest = $this->getRequest();
134 
135  # NB: the offset is quoted, not validated. It is treated as an
136  # arbitrary string to support the widest variety of index types. Be
137  # careful outputting it into HTML!
138  $this->mOffset = $this->mRequest->getText( 'offset' );
139 
140  # Use consistent behavior for the limit options
141  $this->mDefaultLimit = $this->getUser()->getIntOption( 'rclimit' );
142  if ( !$this->mLimit ) {
143  // Don't override if a subclass calls $this->setLimit() in its constructor.
144  list( $this->mLimit, /* $offset */ ) = $this->mRequest->getLimitOffset();
145  }
146 
147  $this->mIsBackwards = ( $this->mRequest->getVal( 'dir' ) == 'prev' );
148  # Let the subclass set the DB here; otherwise use a replica DB for the current wiki
149  $this->mDb = $this->mDb ?: wfGetDB( DB_REPLICA );
150 
151  $index = $this->getIndexField(); // column to sort on
152  $extraSort = $this->getExtraSortFields(); // extra columns to sort on for query planning
153  $order = $this->mRequest->getVal( 'order' );
154  if ( is_array( $index ) && isset( $index[$order] ) ) {
155  $this->mOrderType = $order;
156  $this->mIndexField = $index[$order];
157  $this->mExtraSortFields = isset( $extraSort[$order] )
158  ? (array)$extraSort[$order]
159  : [];
160  } elseif ( is_array( $index ) ) {
161  # First element is the default
162  reset( $index );
163  list( $this->mOrderType, $this->mIndexField ) = each( $index );
164  $this->mExtraSortFields = isset( $extraSort[$this->mOrderType] )
165  ? (array)$extraSort[$this->mOrderType]
166  : [];
167  } else {
168  # $index is not an array
169  $this->mOrderType = null;
170  $this->mIndexField = $index;
171  $this->mExtraSortFields = (array)$extraSort;
172  }
173 
174  if ( !isset( $this->mDefaultDirection ) ) {
175  $dir = $this->getDefaultDirections();
176  $this->mDefaultDirection = is_array( $dir )
178  : $dir;
179  }
180  }
181 
187  public function getDatabase() {
188  return $this->mDb;
189  }
190 
196  public function doQuery() {
197  # Use the child class name for profiling
198  $fname = __METHOD__ . ' (' . get_class( $this ) . ')';
199  $section = Profiler::instance()->scopedProfileIn( $fname );
200 
201  // @todo This should probably compare to DIR_DESCENDING and DIR_ASCENDING constants
202  $descending = ( $this->mIsBackwards == $this->mDefaultDirection );
203  # Plus an extra row so that we can tell the "next" link should be shown
204  $queryLimit = $this->mLimit + 1;
205 
206  if ( $this->mOffset == '' ) {
207  $isFirst = true;
208  } else {
209  // If there's an offset, we may or may not be at the first entry.
210  // The only way to tell is to run the query in the opposite
211  // direction see if we get a row.
212  $oldIncludeOffset = $this->mIncludeOffset;
213  $this->mIncludeOffset = !$this->mIncludeOffset;
214  $isFirst = !$this->reallyDoQuery( $this->mOffset, 1, !$descending )->numRows();
215  $this->mIncludeOffset = $oldIncludeOffset;
216  }
217 
218  $this->mResult = $this->reallyDoQuery(
219  $this->mOffset,
220  $queryLimit,
221  $descending
222  );
223 
224  $this->extractResultInfo( $isFirst, $queryLimit, $this->mResult );
225  $this->mQueryDone = true;
226 
227  $this->preprocessResults( $this->mResult );
228  $this->mResult->rewind(); // Paranoia
229  }
230 
234  function getResult() {
235  return $this->mResult;
236  }
237 
243  function setOffset( $offset ) {
244  $this->mOffset = $offset;
245  }
246 
254  function setLimit( $limit ) {
255  $limit = (int)$limit;
256  // WebRequest::getLimitOffset() puts a cap of 5000, so do same here.
257  if ( $limit > 5000 ) {
258  $limit = 5000;
259  }
260  if ( $limit > 0 ) {
261  $this->mLimit = $limit;
262  }
263  }
264 
270  function getLimit() {
271  return $this->mLimit;
272  }
273 
281  public function setIncludeOffset( $include ) {
282  $this->mIncludeOffset = $include;
283  }
284 
294  function extractResultInfo( $isFirst, $limit, ResultWrapper $res ) {
295  $numRows = $res->numRows();
296  if ( $numRows ) {
297  # Remove any table prefix from index field
298  $parts = explode( '.', $this->mIndexField );
299  $indexColumn = end( $parts );
300 
301  $row = $res->fetchRow();
302  $firstIndex = $row[$indexColumn];
303 
304  # Discard the extra result row if there is one
305  if ( $numRows > $this->mLimit && $numRows > 1 ) {
306  $res->seek( $numRows - 1 );
307  $this->mPastTheEndRow = $res->fetchObject();
308  $this->mPastTheEndIndex = $this->mPastTheEndRow->$indexColumn;
309  $res->seek( $numRows - 2 );
310  $row = $res->fetchRow();
311  $lastIndex = $row[$indexColumn];
312  } else {
313  $this->mPastTheEndRow = null;
314  # Setting indexes to an empty string means that they will be
315  # omitted if they would otherwise appear in URLs. It just so
316  # happens that this is the right thing to do in the standard
317  # UI, in all the relevant cases.
318  $this->mPastTheEndIndex = '';
319  $res->seek( $numRows - 1 );
320  $row = $res->fetchRow();
321  $lastIndex = $row[$indexColumn];
322  }
323  } else {
324  $firstIndex = '';
325  $lastIndex = '';
326  $this->mPastTheEndRow = null;
327  $this->mPastTheEndIndex = '';
328  }
329 
330  if ( $this->mIsBackwards ) {
331  $this->mIsFirst = ( $numRows < $limit );
332  $this->mIsLast = $isFirst;
333  $this->mLastShown = $firstIndex;
334  $this->mFirstShown = $lastIndex;
335  } else {
336  $this->mIsFirst = $isFirst;
337  $this->mIsLast = ( $numRows < $limit );
338  $this->mLastShown = $lastIndex;
339  $this->mFirstShown = $firstIndex;
340  }
341  }
342 
348  function getSqlComment() {
349  return get_class( $this );
350  }
351 
361  public function reallyDoQuery( $offset, $limit, $descending ) {
362  list( $tables, $fields, $conds, $fname, $options, $join_conds ) =
363  $this->buildQueryInfo( $offset, $limit, $descending );
364 
365  return $this->mDb->select( $tables, $fields, $conds, $fname, $options, $join_conds );
366  }
367 
376  protected function buildQueryInfo( $offset, $limit, $descending ) {
377  $fname = __METHOD__ . ' (' . $this->getSqlComment() . ')';
378  $info = $this->getQueryInfo();
379  $tables = $info['tables'];
380  $fields = $info['fields'];
381  $conds = isset( $info['conds'] ) ? $info['conds'] : [];
382  $options = isset( $info['options'] ) ? $info['options'] : [];
383  $join_conds = isset( $info['join_conds'] ) ? $info['join_conds'] : [];
384  $sortColumns = array_merge( [ $this->mIndexField ], $this->mExtraSortFields );
385  if ( $descending ) {
386  $options['ORDER BY'] = $sortColumns;
387  $operator = $this->mIncludeOffset ? '>=' : '>';
388  } else {
389  $orderBy = [];
390  foreach ( $sortColumns as $col ) {
391  $orderBy[] = $col . ' DESC';
392  }
393  $options['ORDER BY'] = $orderBy;
394  $operator = $this->mIncludeOffset ? '<=' : '<';
395  }
396  if ( $offset != '' ) {
397  $conds[] = $this->mIndexField . $operator . $this->mDb->addQuotes( $offset );
398  }
399  $options['LIMIT'] = intval( $limit );
400  return [ $tables, $fields, $conds, $fname, $options, $join_conds ];
401  }
402 
408  protected function preprocessResults( $result ) {
409  }
410 
417  public function getBody() {
418  if ( !$this->mQueryDone ) {
419  $this->doQuery();
420  }
421 
422  if ( $this->mResult->numRows() ) {
423  # Do any special query batches before display
424  $this->doBatchLookups();
425  }
426 
427  # Don't use any extra rows returned by the query
428  $numRows = min( $this->mResult->numRows(), $this->mLimit );
429 
430  $s = $this->getStartBody();
431  if ( $numRows ) {
432  if ( $this->mIsBackwards ) {
433  for ( $i = $numRows - 1; $i >= 0; $i-- ) {
434  $this->mResult->seek( $i );
435  $row = $this->mResult->fetchObject();
436  $s .= $this->formatRow( $row );
437  }
438  } else {
439  $this->mResult->seek( 0 );
440  for ( $i = 0; $i < $numRows; $i++ ) {
441  $row = $this->mResult->fetchObject();
442  $s .= $this->formatRow( $row );
443  }
444  }
445  } else {
446  $s .= $this->getEmptyBody();
447  }
448  $s .= $this->getEndBody();
449  return $s;
450  }
451 
461  function makeLink( $text, array $query = null, $type = null ) {
462  if ( $query === null ) {
463  return $text;
464  }
465 
466  $attrs = [];
467  if ( in_array( $type, [ 'prev', 'next' ] ) ) {
468  $attrs['rel'] = $type;
469  }
470 
471  if ( in_array( $type, [ 'asc', 'desc' ] ) ) {
472  $attrs['title'] = wfMessage( $type == 'asc' ? 'sort-ascending' : 'sort-descending' )->text();
473  }
474 
475  if ( $type ) {
476  $attrs['class'] = "mw-{$type}link";
477  }
478 
479  return Linker::linkKnown(
480  $this->getTitle(),
481  $text,
482  $attrs,
483  $query + $this->getDefaultQuery()
484  );
485  }
486 
494  protected function doBatchLookups() {
495  }
496 
503  protected function getStartBody() {
504  return '';
505  }
506 
512  protected function getEndBody() {
513  return '';
514  }
515 
522  protected function getEmptyBody() {
523  return '';
524  }
525 
533  function getDefaultQuery() {
534  if ( !isset( $this->mDefaultQuery ) ) {
535  $this->mDefaultQuery = $this->getRequest()->getQueryValues();
536  unset( $this->mDefaultQuery['title'] );
537  unset( $this->mDefaultQuery['dir'] );
538  unset( $this->mDefaultQuery['offset'] );
539  unset( $this->mDefaultQuery['limit'] );
540  unset( $this->mDefaultQuery['order'] );
541  unset( $this->mDefaultQuery['month'] );
542  unset( $this->mDefaultQuery['year'] );
543  }
544  return $this->mDefaultQuery;
545  }
546 
552  function getNumRows() {
553  if ( !$this->mQueryDone ) {
554  $this->doQuery();
555  }
556  return $this->mResult->numRows();
557  }
558 
564  function getPagingQueries() {
565  if ( !$this->mQueryDone ) {
566  $this->doQuery();
567  }
568 
569  # Don't announce the limit everywhere if it's the default
570  $urlLimit = $this->mLimit == $this->mDefaultLimit ? null : $this->mLimit;
571 
572  if ( $this->mIsFirst ) {
573  $prev = false;
574  $first = false;
575  } else {
576  $prev = [
577  'dir' => 'prev',
578  'offset' => $this->mFirstShown,
579  'limit' => $urlLimit
580  ];
581  $first = [ 'limit' => $urlLimit ];
582  }
583  if ( $this->mIsLast ) {
584  $next = false;
585  $last = false;
586  } else {
587  $next = [ 'offset' => $this->mLastShown, 'limit' => $urlLimit ];
588  $last = [ 'dir' => 'prev', 'limit' => $urlLimit ];
589  }
590  return [
591  'prev' => $prev,
592  'next' => $next,
593  'first' => $first,
594  'last' => $last
595  ];
596  }
597 
603  function isNavigationBarShown() {
604  if ( !$this->mQueryDone ) {
605  $this->doQuery();
606  }
607  // Hide navigation by default if there is nothing to page
608  return !( $this->mIsFirst && $this->mIsLast );
609  }
610 
621  function getPagingLinks( $linkTexts, $disabledTexts = [] ) {
622  $queries = $this->getPagingQueries();
623  $links = [];
624 
625  foreach ( $queries as $type => $query ) {
626  if ( $query !== false ) {
627  $links[$type] = $this->makeLink(
628  $linkTexts[$type],
629  $queries[$type],
630  $type
631  );
632  } elseif ( isset( $disabledTexts[$type] ) ) {
633  $links[$type] = $disabledTexts[$type];
634  } else {
635  $links[$type] = $linkTexts[$type];
636  }
637  }
638 
639  return $links;
640  }
641 
642  function getLimitLinks() {
643  $links = [];
644  if ( $this->mIsBackwards ) {
645  $offset = $this->mPastTheEndIndex;
646  } else {
647  $offset = $this->mOffset;
648  }
649  foreach ( $this->mLimitsShown as $limit ) {
650  $links[] = $this->makeLink(
651  $this->getLanguage()->formatNum( $limit ),
652  [ 'offset' => $offset, 'limit' => $limit ],
653  'num'
654  );
655  }
656  return $links;
657  }
658 
667  abstract function formatRow( $row );
668 
681  abstract function getQueryInfo();
682 
695  abstract function getIndexField();
696 
713  protected function getExtraSortFields() {
714  return [];
715  }
716 
736  protected function getDefaultDirections() {
738  }
739 }
const DIR_DESCENDING
Definition: IndexPager.php:73
setContext(IContextSource $context)
Set the IContextSource object.
$mIncludeOffset
Whether to include the offset in the query.
Definition: IndexPager.php:119
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
Interface for objects which can provide a MediaWiki context on request.
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
the array() calling protocol came about after MediaWiki 1.4rc1.
null for the local 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:1555
$mExtraSortFields
An array of secondary columns to order by.
Definition: IndexPager.php:92
getLanguage()
Get the Language object.
preprocessResults($result)
Pre-process results; useful for performing batch existence checks, etc.
Definition: IndexPager.php:408
getIndexField()
This function should be overridden to return the name of the index fi- eld.
if(count($args)==0) $dir
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
static instance()
Singleton.
Definition: Profiler.php:61
$mIndexField
The index to actually be used for ordering.
Definition: IndexPager.php:87
formatRow($row)
Abstract formatting function.
reallyDoQuery($offset, $limit, $descending)
Do a query with specified parameters, rather than using the object context.
Definition: IndexPager.php:361
setOffset($offset)
Set the offset from an other source than the request.
Definition: IndexPager.php:243
doQuery()
Do the query, using information from the object context.
Definition: IndexPager.php:196
__construct(IContextSource $context=null)
Definition: IndexPager.php:128
IContextSource $context
getTitle()
Get the Title object.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
Definition: hooks.txt:1007
getDatabase()
Get the Database object in use.
Definition: IndexPager.php:187
The index of the header message $result[1]=The index of the body text message $result[2 through n]=Parameters passed to body text message.Please note the header message cannot receive/use parameters. 'ImportHandleLogItemXMLTag':When parsing a XML tag in a log item.Return false to stop further processing of the tag $reader:XMLReader object $logInfo:Array of information 'ImportHandlePageXMLTag':When parsing a XML tag in a page.Return false to stop further processing of the tag $reader:XMLReader object &$pageInfo:Array of information 'ImportHandleRevisionXMLTag':When parsing a XML tag in a page revision.Return false to stop further processing of the tag $reader:XMLReader object $pageInfo:Array of page information $revisionInfo:Array of revision information 'ImportHandleToplevelXMLTag':When parsing a top level XML tag.Return false to stop further processing of the tag $reader:XMLReader object 'ImportHandleUploadXMLTag':When parsing a XML tag in a file upload.Return false to stop further processing of the tag $reader:XMLReader object $revisionInfo:Array of information 'ImportLogInterwikiLink':Hook to change the interwiki link used in log entries and edit summaries for transwiki imports.&$fullInterwikiPrefix:Interwiki prefix, may contain colons.&$pageTitle:String that contains page title. 'ImportSources':Called when reading from the $wgImportSources configuration variable.Can be used to lazy-load the import sources list.&$importSources:The value of $wgImportSources.Modify as necessary.See the comment in DefaultSettings.php for the detail of how to structure this array. 'InfoAction':When building information to display on the action=info page.$context:IContextSource object &$pageInfo:Array of information 'InitializeArticleMaybeRedirect':MediaWiki check to see if title is a redirect.&$title:Title object for the current page &$request:WebRequest &$ignoreRedirect:boolean to skip redirect check &$target:Title/string of redirect target &$article:Article object 'InternalParseBeforeLinks':during Parser's internalParse method before links but after nowiki/noinclude/includeonly/onlyinclude and other processings.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InternalParseBeforeSanitize':during Parser's internalParse method just before the parser removes unwanted/dangerous HTML tags and after nowiki/noinclude/includeonly/onlyinclude and other processings.Ideal for syntax-extensions after template/parser function execution which respect nowiki and HTML-comments.&$parser:Parser object &$text:string containing partially parsed text &$stripState:Parser's internal StripState object 'InterwikiLoadPrefix':When resolving if a given prefix is an interwiki or not.Return true without providing an interwiki to continue interwiki search.$prefix:interwiki prefix we are looking for.&$iwData:output array describing the interwiki with keys iw_url, iw_local, iw_trans and optionally iw_api and iw_wikiid. 'InvalidateEmailComplete':Called after a user's email has been invalidated successfully.$user:user(object) whose email is being invalidated 'IRCLineURL':When constructing the URL to use in an IRC notification.Callee may modify $url and $query, URL will be constructed as $url.$query &$url:URL to index.php &$query:Query string $rc:RecentChange object that triggered url generation 'IsFileCacheable':Override the result of Article::isFileCacheable()(if true) &$article:article(object) being checked 'IsTrustedProxy':Override the result of IP::isTrustedProxy() &$ip:IP being check &$result:Change this value to override the result of IP::isTrustedProxy() 'IsUploadAllowedFromUrl':Override the result of UploadFromUrl::isAllowedUrl() $url:URL used to upload from &$allowed:Boolean indicating if uploading is allowed for given URL 'isValidEmailAddr':Override the result of Sanitizer::validateEmail(), for instance to return false if the domain name doesn't match your organization.$addr:The e-mail address entered by the user &$result:Set this and return false to override the internal checks 'isValidPassword':Override the result of User::isValidPassword() $password:The password entered by the user &$result:Set this and return false to override the internal checks $user:User the password is being validated for 'Language::getMessagesFileName':$code:The language code or the language we're looking for a messages file for &$file:The messages file path, you can override this to change the location. 'LanguageGetMagic':DEPRECATED!Use $magicWords in a file listed in $wgExtensionMessagesFiles instead.Use this to define synonyms of magic words depending of the language &$magicExtensions:associative array of magic words synonyms $lang:language code(string) 'LanguageGetNamespaces':Provide custom ordering for namespaces or remove namespaces.Do not use this hook to add namespaces.Use CanonicalNamespaces for that.&$namespaces:Array of namespaces indexed by their numbers 'LanguageGetSpecialPageAliases':DEPRECATED!Use $specialPageAliases in a file listed in $wgExtensionMessagesFiles instead.Use to define aliases of special pages names depending of the language &$specialPageAliases:associative array of magic words synonyms $lang:language code(string) 'LanguageGetTranslatedLanguageNames':Provide translated language names.&$names:array of language code=> language name $code:language of the preferred translations 'LanguageLinks':Manipulate a page's language links.This is called in various places to allow extensions to define the effective language links for a page.$title:The page's Title.&$links:Associative array mapping language codes to prefixed links of the form"language:title".&$linkFlags:Associative array mapping prefixed links to arrays of flags.Currently unused, but planned to provide support for marking individual language links in the UI, e.g.for featured articles. 'LanguageSelector':Hook to change the language selector available on a page.$out:The output page.$cssClassName:CSS class name of the language selector. 'LinkBegin':DEPRECATED!Use HtmlPageLinkRendererBegin instead.Used when generating internal and interwiki links in Linker::link(), before processing starts.Return false to skip default processing and return $ret.See documentation for Linker::link() for details on the expected meanings of parameters.$skin:the Skin object $target:the Title that the link is pointing to &$html:the contents that the< a > tag should have(raw HTML) $result
Definition: hooks.txt:1934
$mIsFirst
True if the current result set is the first one.
Definition: IndexPager.php:111
$last
getRequest()
Get the WebRequest object.
doBatchLookups()
Called from getBody(), before getStartBody() is called and after doQuery() was called.
Definition: IndexPager.php:494
IndexPager is an efficient pager which uses a (roughly unique) index in the data set to implement pag...
Definition: IndexPager.php:66
getEmptyBody()
Hook into getBody(), for the bit between the start and the end when there are no rows.
Definition: IndexPager.php:522
getSqlComment()
Get some text to go in brackets in the "function name" part of the SQL comment.
Definition: IndexPager.php:348
ResultWrapper $mResult
Result object for the query.
Definition: IndexPager.php:126
fetchRow()
Fetch the next row from the given result object, in associative array form.
Basic pager interface.
Definition: Pager.php:32
getExtraSortFields()
This function should be overridden to return the names of secondary columns to order by in addition t...
Definition: IndexPager.php:713
$mDefaultDirection
$mDefaultDirection gives the direction to use when sorting results: DIR_ASCENDING or DIR_DESCENDING...
Definition: IndexPager.php:107
getStartBody()
Hook into getBody(), allows text to be inserted at the start.
Definition: IndexPager.php:503
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 default is conds Array Extra conditions for the No matching items in log is displayed if loglist is empty msgKey Array If you want a nice box with a set this to the key of the message First element is the message additional optional elements are parameters for the key that are processed with wfMessage() -> params() ->parseAsBlock()-offset Set to overwrite offset parameter in $wgRequest set to ''to unsetoffset-wrap String Wrap the message in html(usually something like"&lt
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context $options
Definition: hooks.txt:1046
$res
Definition: database.txt:21
isNavigationBarShown()
Returns whether to show the "navigation bar".
Definition: IndexPager.php:603
getLimit()
Get the current limit.
Definition: IndexPager.php:270
makeLink($text, array $query=null, $type=null)
Make a self-link.
Definition: IndexPager.php:461
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
Definition: Linker.php:255
getQueryInfo()
This function should be overridden to provide all parameters needed for the main paged query...
getPagingLinks($linkTexts, $disabledTexts=[])
Get paging links.
Definition: IndexPager.php:621
extractResultInfo($isFirst, $limit, ResultWrapper $res)
Extract some useful data from the result object for use by the navigation bar, put it into $this...
Definition: IndexPager.php:294
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
seek($row)
Change the position of the cursor in a result object.
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
Definition: hooks.txt:2889
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
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
Definition: Setup.php:36
setIncludeOffset($include)
Set whether a row matching exactly the offset should be also included in the result or not...
Definition: IndexPager.php:281
getDefaultQuery()
Get an array of query parameters that should be put into self-links.
Definition: IndexPager.php:533
numRows()
Get the number of rows in a result object.
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist removed from all revisions and log entries to which it was applied This gives extensions a chance to take it off their books as the deletion has already been partly carried out by this point or something similar the user will be unable to create the tag set and then return false from the hook function Ensure you consume the ChangeTagAfterDelete hook to carry out custom deletion actions as context called by AbstractContent::getParserOutput May be used to override the normal model specific rendering of page content as context as context the output can only depend on parameters provided to this hook not on global state indicating whether full HTML should be generated If generation of HTML may be but other information should still be present in the ParserOutput object to manipulate or replace but no entry for that model exists in $wgContentHandlers if desired whether it is OK to use $contentModel on $title Handler functions that modify $ok should generally return false to prevent further hooks from further modifying $ok inclusive $limit
Definition: hooks.txt:1046
fetchObject()
Fetch the next row from the given result object, in object form.
setLimit($limit)
Set the limit from an other source than the request.
Definition: IndexPager.php:254
const DB_REPLICA
Definition: defines.php:22
Result wrapper for grabbing data queried from an IDatabase object.
getBody()
Get the formatted result list.
Definition: IndexPager.php:417
$mOrderType
For pages that support multiple types of ordering, which one to use.
Definition: IndexPager.php:95
getDefaultDirections()
Return the default sorting direction: DIR_ASCENDING or DIR_DESCENDING.
Definition: IndexPager.php:736
getPagingQueries()
Get a URL query array for the prev, next, first and last links.
Definition: IndexPager.php:564
$queries
buildQueryInfo($offset, $limit, $descending)
Build variables to use by the database wrapper.
Definition: IndexPager.php:376
const DIR_ASCENDING
Constants for the $mDefaultDirection field.
Definition: IndexPager.php:72
getUser()
Get the User object.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image and a DIV can begin in one section and end in another Make sure your code can handle that case gracefully See the EditSectionClearerLink extension for an example zero but section is usually empty its values are the globals values before the output is cached one of or reset my talk my contributions etc etc otherwise the built in rate limiting checks are if enabled allows for interception of redirect as a string mapping parameter names to values & $type
Definition: hooks.txt:2491
getNumRows()
Get the number of rows in the result set.
Definition: IndexPager.php:552
getEndBody()
Hook into getBody() for the end of the list.
Definition: IndexPager.php:512