73 [ AncientPagesPage::class,
'Ancientpages' ],
74 [ BrokenRedirectsPage::class,
'BrokenRedirects' ],
75 [ DeadendPagesPage::class,
'Deadendpages' ],
76 [ DoubleRedirectsPage::class,
'DoubleRedirects' ],
77 [ FileDuplicateSearchPage::class,
'FileDuplicateSearch' ],
78 [ ListDuplicatedFilesPage::class,
'ListDuplicatedFiles' ],
79 [ LinkSearchPage::class,
'LinkSearch' ],
80 [ ListredirectsPage::class,
'Listredirects' ],
81 [ LonelyPagesPage::class,
'Lonelypages' ],
82 [ LongPagesPage::class,
'Longpages' ],
83 [ MediaStatisticsPage::class,
'MediaStatistics' ],
84 [ MIMEsearchPage::class,
'MIMEsearch' ],
85 [ MostcategoriesPage::class,
'Mostcategories' ],
86 [ MostimagesPage::class,
'Mostimages' ],
87 [ MostinterwikisPage::class,
'Mostinterwikis' ],
88 [ MostlinkedCategoriesPage::class,
'Mostlinkedcategories' ],
89 [ MostlinkedTemplatesPage::class,
'Mostlinkedtemplates' ],
90 [ MostlinkedPage::class,
'Mostlinked' ],
91 [ MostrevisionsPage::class,
'Mostrevisions' ],
92 [ FewestrevisionsPage::class,
'Fewestrevisions' ],
93 [ ShortPagesPage::class,
'Shortpages' ],
94 [ UncategorizedCategoriesPage::class,
'Uncategorizedcategories' ],
95 [ UncategorizedPagesPage::class,
'Uncategorizedpages' ],
96 [ UncategorizedImagesPage::class,
'Uncategorizedimages' ],
97 [ UncategorizedTemplatesPage::class,
'Uncategorizedtemplates' ],
98 [ UnusedCategoriesPage::class,
'Unusedcategories' ],
99 [ UnusedimagesPage::class,
'Unusedimages' ],
100 [ WantedCategoriesPage::class,
'Wantedcategories' ],
101 [ WantedFilesPage::class,
'Wantedfiles' ],
102 [ WantedPagesPage::class,
'Wantedpages' ],
103 [ WantedTemplatesPage::class,
'Wantedtemplates' ],
104 [ UnwatchedpagesPage::class,
'Unwatchedpages' ],
105 [ UnusedtemplatesPage::class,
'Unusedtemplates' ],
106 [ WithoutInterwikiPage::class,
'Withoutinterwiki' ],
108 Hooks::run(
'wgQueryPages', [ &$qp ] );
120 $this->listoutput = $bool;
161 throw new MWException(
"Bug in a QueryPage: doesn't implement getQueryInfo() nor "
162 .
"getQuery() properly" );
207 return $this->
getConfig()->get(
'DisableQueryPages' );
268 $this->
getOutput()->addWikiMsg(
'specialpage-empty' );
310 $fname = static::class .
'::recache';
321 $num =
$res->numRows();
324 foreach (
$res as $row ) {
325 if ( isset( $row->value ) ) {
330 $value = intval( $row->value );
338 'qc_namespace' => $row->namespace,
339 'qc_title' => $row->title,
344 $dbw->doAtomicSection(
347 # Clear out any old cached data
348 $dbw->
delete(
'querycache',
349 [
'qc_type' => $this->
getName() ],
352 # Save results into the querycache table on the master
353 if ( count( $vals ) ) {
356 # Update the querycache_info record for the page
357 $dbw->
delete(
'querycache_info',
358 [
'qci_type' => $this->
getName() ],
361 $dbw->
insert(
'querycache_info',
362 [
'qci_type' => $this->
getName(),
370 if ( !$ignoreErrors ) {
395 $fname = static::class .
'::reallyDoQuery';
401 foreach ( $order as &$field ) {
406 if ( is_array(
$query ) ) {
431 $sql .=
' ORDER BY ' . implode(
', ', $order );
474 foreach ( $order as &$field ) {
482 return $dbr->select(
'querycache',
484 'namespace' =>
'qc_namespace',
485 'title' =>
'qc_title',
486 'value' =>
'qc_value' ],
487 [
'qc_type' => $this->
getName() ],
504 if ( is_null( $this->cachedTimestamp ) ) {
506 $fname = static::class .
'::getCachedTimestamp';
507 $this->cachedTimestamp =
$dbr->selectField(
'querycache_info',
'qci_timestamp',
527 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
547 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
548 $limit = min( $uiLimit + 1, $maxResults - $uiOffset );
566 return max( $this->
getConfig()->
get(
'QueryCacheLimit' ), 10000 );
587 $out->addWikiMsg(
'querypage-disabled' );
593 if ( $this->limit == 0 && $this->offset == 0 ) {
596 $dbLimit = $this->
getDBLimit( $this->limit, $this->offset );
599 # select one extra row for navigation
602 # Get the cached result, select one extra row for navigation
604 if ( !$this->listoutput ) {
605 # Fetch the timestamp of this update
608 $maxResults =
$lang->formatNum( $this->
getConfig()->
get(
'QueryCacheLimit' ) );
611 $updated =
$lang->userTimeAndDate( $ts, $user );
612 $updateddate =
$lang->userDate( $ts, $user );
613 $updatedtime =
$lang->userTime( $ts, $user );
614 $out->addMeta(
'Data-Cache-Time', $ts );
615 $out->addJsConfigVars(
'dataCacheTime', $ts );
616 $out->addWikiMsg(
'perfcachedts', $updated, $updateddate, $updatedtime, $maxResults );
618 $out->addWikiMsg(
'perfcached', $maxResults );
621 # If updates on this page have been disabled, let the user know
622 # that the data set won't be refreshed for now
623 if ( is_array( $this->
getConfig()->
get(
'DisableQueryPageUpdate' ) )
624 && in_array( $this->
getName(), $this->
getConfig()->
get(
'DisableQueryPageUpdate' ) )
627 "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
628 'querypage-no-updates'
634 $this->numRows =
$res->numRows();
639 $out->addHTML( Xml::openElement(
'div', [
'class' =>
'mw-spcontent' ] ) );
641 # Top header and navigation
642 if ( $this->shownavigation ) {
644 if ( $this->numRows > 0 ) {
645 $out->addHTML( $this->
msg(
'showingresultsinrange' )->numParams(
646 min( $this->numRows, $this->limit ), #
do not show the one extra row,
if exist
647 $this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
648 # Disable the "next" link when we reach the end
649 $miserMaxResults = $this->
getConfig()->get(
'MiserMode' )
650 && ( $this->offset + $this->limit >= $this->
getMaxResults() );
651 $atEnd = ( $this->numRows <=
$this->limit ) || $miserMaxResults;
654 $out->addHTML(
'<p>' . $paging .
'</p>' );
656 # No results to show, so don't bother with "showing X of Y" etc.
657 # -- just let the user know and give up now
659 $out->addHTML( Xml::closeElement(
'div' ) );
664 # The actual results; specialist subclasses will want to handle this
665 # with more than a straight list, so we hand them the info, plus
666 # an OutputPage, and let them get on with it
669 $dbr, # Should use a ResultWrapper
for this
671 min( $this->numRows, $this->limit ), #
do not format the one extra row,
if exist
674 # Repeat the paging links at the bottom
675 if ( $this->shownavigation ) {
676 $out->addHTML(
'<p>' . $paging .
'</p>' );
679 $out->addHTML( Xml::closeElement(
'div' ) );
696 if ( !$this->listoutput ) {
700 # $res might contain the whole 1,000 rows, so we read up to
701 # $num [should update this to use a Pager]
703 for ( $i = 0; $i < $num && $row =
$res->fetchObject(); $i++ ) {
706 $html[] = $this->listoutput
708 :
"<li>{$line}</li>\n";
712 # Flush the final result
717 $html[] = $this->listoutput
719 :
"<li>{$line}</li>\n";
723 if ( !$this->listoutput ) {
727 $html = $this->listoutput
728 ? MediaWikiServices::getInstance()->getContentLanguage()->listToText(
$html )
729 : implode(
'',
$html );
740 return "\n<ol start='" . (
$offset + 1 ) .
"' class='special'>\n";
765 if ( !$this->
getConfig()->
get(
'Feed' ) ) {
766 $this->
getOutput()->addWikiMsg(
'feed-unavailable' );
772 $feedClasses = $this->
getConfig()->get(
'FeedClasses' );
773 if ( isset( $feedClasses[$class] ) ) {
775 $feed =
new $feedClasses[$class](
782 foreach (
$res as $obj ) {
785 $feed->outItem( $item );
803 if ( !isset( $row->title ) ) {
806 $title = Title::makeTitle( intval( $row->namespace ), $row->title );
808 $date = $row->timestamp ??
'';
811 $talkpage = $title->getTalkPage();
812 $comments = $talkpage->getFullURL();
816 $title->getPrefixedText(),
817 $this->feedItemDesc( $row ),
818 $title->getFullURL(),
820 $this->feedItemAuthor( $row ),
828 return isset( $row->comment ) ? htmlspecialchars( $row->comment ) :
'';
832 return $row->user_text ??
'';
838 $sitename = $this->
getConfig()->get(
'Sitename' );
839 return "$sitename - $desc [$code]";
843 return $this->
msg(
'tagline' )->text();
861 if ( !
$res->numRows() ) {
866 foreach (
$res as $row ) {
867 $batch->
add( $ns ?? $row->namespace, $row->title );
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
if(defined( 'MW_SETUP_CALLBACK')) $fname
Customization point after all loading (constants, functions, classes, DefaultSettings,...
A base class for basic support for outputting syndication feeds in RSS and other formats.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array.
getMaxResults()
Get max number of results we can return in miser mode.
doQuery( $offset=false, $limit=false)
Somewhat deprecated, you probably want to be using execute()
executeLBFromResultWrapper(IResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include title and ...
setListoutput( $bool)
A mutator for $this->listoutput;.
recache( $limit, $ignoreErrors=true)
Clear the cache and save new results.
tryLastResult()
Some special pages (for example SpecialListusers used to) might not return the current object formatt...
fetchFromCache( $limit, $offset=false)
Fetch the query results from the query cache.
int $offset
The offset and limit in use, as passed to the query() function.
outputResults( $out, $skin, $dbr, $res, $num, $offset)
Format and output report results using the given information plus OutputPage.
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
$shownavigation
Whether to show prev/next links.
doFeed( $class='', $limit=50)
Similar to above, but packaging in a syndicated feed instead of a web page.
sortDescending()
Override to sort by increasing values.
formatResult( $skin, $result)
Formats the results of the query for display.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
static getPages()
Get a list of query page classes and their associated special pages, for periodic updates.
reallyDoQuery( $limit, $offset=false)
Run the query and return the result.
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
getOrderFields()
Subclasses return an array of fields to order by here.
showEmptyText()
Outputs some kind of an informative message (via OutputPage) to let the user know that the query retu...
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
getCacheOrderFields()
Return the order fields for fetchFromCache.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getDBLimit( $uiLimit, $uiOffset)
What is limit to fetch from DB.
$numRows
The number of rows returned by the query.
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
getSQL()
For back-compat, subclasses may return a raw SQL query here, as a string.
getPageHeader()
The content returned by this function will be output before any result.
bool $listoutput
Whether or not we want plain listoutput rather than an ordered list.
execute( $par)
This is the actual workhorse.
feedResult( $row)
Override for custom handling.
getLimitOffset()
Returns limit and offset, as returned by $this->getRequest()->getLimitOffset().
getRecacheDB()
Get a DB connection to be used for slow recache queries.
Parent class for all special pages.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
getName()
Get the name of this Special Page.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
getOutput()
Get the OutputPage being used for this instance.
getUser()
Shortcut to get the User executing this instance.
getSkin()
Shortcut to get the skin being used for this instance.
msg( $key)
Wrapper around wfMessage that sets the current context.
getConfig()
Shortcut to get main config object.
getRequest()
Get the WebRequest being used for this instance.
displayRestrictionError()
Output an error message telling the user what access level they have to have.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
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
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 probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output modifiable & $code
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
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 & $html
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
returning false will NOT prevent logging $e
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))
if(!isset( $args[0])) $lang