165 # NB: the offset is quoted, not validated. It is treated as an
166 # arbitrary string to support the widest variety of index types. Be
167 # careful outputting it into HTML!
168 $this->mOffset = $this->mRequest->getText(
'offset' );
170 # Use consistent behavior for the limit options
171 $this->mDefaultLimit = $this->
getUser()->getIntOption(
'rclimit' );
172 if ( !$this->mLimit ) {
174 list( $this->mLimit, ) = $this->mRequest->getLimitOffset();
177 $this->mIsBackwards = ( $this->mRequest->getVal(
'dir' ) ==
'prev' );
178 # Let the subclass set the DB here; otherwise use a replica DB for the current wiki
183 $order = $this->mRequest->getVal(
'order' );
185 $this->mOrderType = $order;
186 $this->mIndexField = $index[$order];
187 $this->mExtraSortFields =
isset( $extraSort[$order] )
188 ? (
array)$extraSort[$order]
191 # First element is the default
192 $this->mIndexField = reset( $index );
193 $this->mOrderType =
key( $index );
194 $this->mExtraSortFields =
isset( $extraSort[$this->mOrderType] )
195 ? (
array)$extraSort[$this->mOrderType]
198 # $index is not an array
199 $this->mOrderType =
null;
200 $this->mIndexField = $index;
201 $this->mExtraSortFields = (
array)$extraSort;
204 if ( !
isset( $this->mDefaultDirection ) ) {
206 $this->mDefaultDirection =
is_array( $dir )
227 # Use the child class name for profiling
228 $fname = __METHOD__ .
' (' . static::class .
')';
233 ? self::QUERY_ASCENDING
237 # Plus an extra row so that we can tell the "next" link should be shown
238 $queryLimit = $this->mLimit + 1;
240 if ( $this->mOffset ==
'' ) {
249 $isFirst = !$this->
reallyDoQuery( $this->mOffset, 1, $oppositeOrder )->numRows();
260 $this->mQueryDone =
true;
263 $this->mResult->rewind();
271 return ( $order === self::QUERY_ASCENDING )
289 $this->mOffset = $offset;
300 $limit = (
int)$limit;
302 if ( $limit > 5000 ) {
306 $this->mLimit = $limit;
340 $numRows =
$res->numRows();
342 # Remove any table prefix from index field
343 $parts = explode(
'.', $this->mIndexField );
344 $indexColumn = end( $parts );
346 $row =
$res->fetchRow();
349 # Discard the extra result row if there is one
350 if ( $numRows > $this->mLimit && $numRows > 1 ) {
351 $res->seek( $numRows - 1 );
352 $this->mPastTheEndRow =
$res->fetchObject();
353 $this->mPastTheEndIndex = $this->mPastTheEndRow->$indexColumn;
354 $res->seek( $numRows - 2 );
355 $row =
$res->fetchRow();
358 $this->mPastTheEndRow =
null;
359 # Setting indexes to an empty string means that they will be
360 # omitted if they would otherwise appear in URLs. It just so
361 # happens that this is the right thing to do in the standard
362 # UI, in all the relevant cases.
363 $this->mPastTheEndIndex =
'';
364 $res->seek( $numRows - 1 );
365 $row =
$res->fetchRow();
371 $this->mPastTheEndRow =
null;
372 $this->mPastTheEndIndex =
'';
375 if ( $this->mIsBackwards ) {
376 $this->mIsFirst = ( $numRows < $limit );
382 $this->mIsLast = ( $numRows < $limit );
394 return static::class;
428 $fields = $info[
'fields'];
429 $conds = $info[
'conds'] ?? [];
431 $join_conds = $info[
'join_conds'] ?? [];
432 $sortColumns =
array_merge( [ $this->mIndexField ], $this->mExtraSortFields );
433 if ( $order === self::QUERY_ASCENDING ) {
435 $operator = $this->mIncludeOffset ?
'>=' :
'>';
438 foreach ( $sortColumns as $col ) {
439 $orderBy[] = $col .
' DESC';
442 $operator = $this->mIncludeOffset ?
'<=' :
'<';
444 if ( $offset !=
'' ) {
445 $conds[] = $this->mIndexField . $operator . $this->mDb->addQuotes( $offset );
466 if ( !$this->mQueryDone ) {
470 if ( $this->mResult->numRows() ) {
471 # Do any special query batches before display
475 # Don't use any extra rows returned by the query
476 $numRows = min( $this->mResult->numRows(), $this->mLimit );
480 if ( $this->mIsBackwards ) {
481 for ( $i = $numRows - 1; $i >= 0; $i-- ) {
482 $this->mResult->seek( $i );
483 $row = $this->mResult->fetchObject();
487 $this->mResult->seek( 0 );
488 for ( $i = 0; $i < $numRows; $i++ ) {
489 $row = $this->mResult->fetchObject();
516 $attrs[
'rel'] =
$type;
520 $attrs[
'title'] = $this->
msg(
$type ==
'asc' ?
'sort-ascending' :
'sort-descending' )->
text();
524 $attrs[
'class'] =
"mw-{$type}link";
582 if ( !
isset( $this->mDefaultQuery ) ) {
583 $this->mDefaultQuery = $this->
getRequest()->getQueryValues();
584 unset( $this->mDefaultQuery[
'title'] );
585 unset( $this->mDefaultQuery[
'dir'] );
586 unset( $this->mDefaultQuery[
'offset'] );
587 unset( $this->mDefaultQuery[
'limit'] );
588 unset( $this->mDefaultQuery[
'order'] );
589 unset( $this->mDefaultQuery[
'month'] );
590 unset( $this->mDefaultQuery[
'year'] );
601 if ( !$this->mQueryDone ) {
604 return $this->mResult->numRows();
613 if ( !$this->mQueryDone ) {
617 # Don't announce the limit everywhere if it's the default
620 if ( $this->mIsFirst ) {
631 if ( $this->mIsLast ) {
652 if ( !$this->mQueryDone ) {
692 if ( $this->mIsBackwards ) {
697 foreach ( $this->mLimitsShown as $limit ) {
700 [
'offset' => $offset,
'limit' => $limit ],
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two and(2) offer you this license which gives you legal permission to copy
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
setContext(IContextSource $context)
static linkKnown( $target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
The WebRequest class encapsulates getting at data passed in the URL or via a POSTed form stripping il...
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
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
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 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 key
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
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
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
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
Interface for objects which can provide a MediaWiki context on request.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))