Go to the documentation of this file.
72 [
'AncientPagesPage',
'Ancientpages' ],
73 [
'BrokenRedirectsPage',
'BrokenRedirects' ],
74 [
'DeadendPagesPage',
'Deadendpages' ],
75 [
'DoubleRedirectsPage',
'DoubleRedirects' ],
76 [
'FileDuplicateSearchPage',
'FileDuplicateSearch' ],
77 [
'ListDuplicatedFilesPage',
'ListDuplicatedFiles' ],
78 [
'LinkSearchPage',
'LinkSearch' ],
79 [
'ListredirectsPage',
'Listredirects' ],
80 [
'LonelyPagesPage',
'Lonelypages' ],
81 [
'LongPagesPage',
'Longpages' ],
82 [
'MediaStatisticsPage',
'MediaStatistics' ],
83 [
'MIMEsearchPage',
'MIMEsearch' ],
84 [
'MostcategoriesPage',
'Mostcategories' ],
85 [
'MostimagesPage',
'Mostimages' ],
86 [
'MostinterwikisPage',
'Mostinterwikis' ],
87 [
'MostlinkedCategoriesPage',
'Mostlinkedcategories' ],
88 [
'MostlinkedTemplatesPage',
'Mostlinkedtemplates' ],
89 [
'MostlinkedPage',
'Mostlinked' ],
90 [
'MostrevisionsPage',
'Mostrevisions' ],
91 [
'FewestrevisionsPage',
'Fewestrevisions' ],
92 [
'ShortPagesPage',
'Shortpages' ],
93 [
'UncategorizedCategoriesPage',
'Uncategorizedcategories' ],
94 [
'UncategorizedPagesPage',
'Uncategorizedpages' ],
95 [
'UncategorizedImagesPage',
'Uncategorizedimages' ],
96 [
'UncategorizedTemplatesPage',
'Uncategorizedtemplates' ],
97 [
'UnusedCategoriesPage',
'Unusedcategories' ],
98 [
'UnusedimagesPage',
'Unusedimages' ],
99 [
'WantedCategoriesPage',
'Wantedcategories' ],
100 [
'WantedFilesPage',
'Wantedfiles' ],
101 [
'WantedPagesPage',
'Wantedpages' ],
102 [
'WantedTemplatesPage',
'Wantedtemplates' ],
103 [
'UnwatchedpagesPage',
'Unwatchedpages' ],
104 [
'UnusedtemplatesPage',
'Unusedtemplates' ],
105 [
'WithoutInterwikiPage',
'Withoutinterwiki' ],
119 $this->listoutput = $bool;
160 throw new MWException(
"Bug in a QueryPage: doesn't implement getQueryInfo() nor "
161 .
"getQuery() properly" );
206 return $this->
getConfig()->get(
'DisableQueryPages' );
267 $this->
getOutput()->addWikiMsg(
'specialpage-empty' );
320 $num =
$res->numRows();
323 foreach (
$res as $row ) {
324 if ( isset( $row->value ) ) {
329 $value = intval( $row->value );
337 'qc_namespace' => $row->namespace,
338 'qc_title' => $row->title,
343 $dbw->doAtomicSection(
346 # Clear out any old cached data
347 $dbw->
delete(
'querycache',
348 [
'qc_type' => $this->
getName() ],
351 # Save results into the querycache table on the master
352 if (
count( $vals ) ) {
355 # Update the querycache_info record for the page
356 $dbw->
delete(
'querycache_info',
357 [
'qci_type' => $this->
getName() ],
360 $dbw->
insert(
'querycache_info',
361 [
'qci_type' => $this->
getName(),
369 if ( !$ignoreErrors ) {
400 foreach ( $order
as &$field ) {
405 if ( is_array(
$query ) ) {
430 $sql .=
' ORDER BY ' . implode(
', ', $order );
473 foreach ( $order
as &$field ) {
481 return $dbr->select(
'querycache',
483 'namespace' =>
'qc_namespace',
484 'title' =>
'qc_title',
485 'value' =>
'qc_value' ],
486 [
'qc_type' => $this->
getName() ],
503 if ( is_null( $this->cachedTimestamp ) ) {
506 $this->cachedTimestamp =
$dbr->selectField(
'querycache_info',
'qci_timestamp',
526 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
546 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
547 $limit = min( $uiLimit + 1, $maxResults - $uiOffset );
565 return max( $this->
getConfig()->
get(
'QueryCacheLimit' ), 10000 );
586 $out->addWikiMsg(
'querypage-disabled' );
592 if ( $this->limit == 0 && $this->offset == 0 ) {
595 $dbLimit = $this->
getDBLimit( $this->limit, $this->offset );
598 # select one extra row for navigation
601 # Get the cached result, select one extra row for navigation
603 if ( !$this->listoutput ) {
604 # Fetch the timestamp of this update
607 $maxResults =
$lang->formatNum( $this->
getConfig()->
get(
'QueryCacheLimit' ) );
610 $updated =
$lang->userTimeAndDate( $ts,
$user );
613 $out->addMeta(
'Data-Cache-Time', $ts );
614 $out->addJsConfigVars(
'dataCacheTime', $ts );
615 $out->addWikiMsg(
'perfcachedts', $updated, $updateddate, $updatedtime, $maxResults );
617 $out->addWikiMsg(
'perfcached', $maxResults );
620 # If updates on this page have been disabled, let the user know
621 # that the data set won't be refreshed for now
622 if ( is_array( $this->
getConfig()->
get(
'DisableQueryPageUpdate' ) )
623 && in_array( $this->
getName(), $this->
getConfig()->
get(
'DisableQueryPageUpdate' ) )
626 "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
627 'querypage-no-updates'
633 $this->numRows =
$res->numRows();
640 # Top header and navigation
641 if ( $this->shownavigation ) {
643 if ( $this->numRows > 0 ) {
644 $out->addHTML( $this->
msg(
'showingresultsinrange' )->numParams(
645 min( $this->numRows, $this->limit ), #
do not show the one extra row,
if exist
646 $this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
647 # Disable the "next" link when we reach the end
648 $miserMaxResults = $this->
getConfig()->get(
'MiserMode' )
649 && ( $this->offset + $this->limit >= $this->
getMaxResults() );
650 $atEnd = ( $this->numRows <=
$this->limit ) || $miserMaxResults;
653 $out->addHTML(
'<p>' . $paging .
'</p>' );
655 # No results to show, so don't bother with "showing X of Y" etc.
656 # -- just let the user know and give up now
663 # The actual results; specialist subclasses will want to handle this
664 # with more than a straight list, so we hand them the info, plus
665 # an OutputPage, and let them get on with it
670 min( $this->numRows, $this->limit ), #
do not format the one extra row,
if exist
673 # Repeat the paging links at the bottom
674 if ( $this->shownavigation ) {
675 $out->addHTML(
'<p>' . $paging .
'</p>' );
697 if ( !$this->listoutput ) {
701 # $res might contain the whole 1,000 rows, so we read up to
702 # $num [should update this to use a Pager]
704 for ( $i = 0; $i < $num && $row =
$res->fetchObject(); $i++ ) {
708 $html[] = $this->listoutput
710 :
"<li>{$line}</li>\n";
714 # Flush the final result
719 $html[] = $this->listoutput
721 :
"<li>{$line}</li>\n";
725 if ( !$this->listoutput ) {
729 $html = $this->listoutput
731 : implode(
'',
$html );
742 return "\n<ol start='" . (
$offset + 1 ) .
"' class='special'>\n";
767 if ( !$this->
getConfig()->
get(
'Feed' ) ) {
768 $this->
getOutput()->addWikiMsg(
'feed-unavailable' );
774 $feedClasses = $this->
getConfig()->get(
'FeedClasses' );
775 if ( isset( $feedClasses[$class] ) ) {
777 $feed =
new $feedClasses[$class](
784 foreach (
$res as $obj ) {
787 $feed->outItem( $item );
805 if ( !isset( $row->title ) ) {
810 $date = isset( $row->timestamp ) ? $row->timestamp :
'';
813 $talkpage =
$title->getTalkPage();
814 $comments = $talkpage->getFullURL();
818 $title->getPrefixedText(),
830 return isset( $row->comment ) ? htmlspecialchars( $row->comment ) :
'';
834 return isset( $row->user_text ) ? $row->user_text :
'';
840 $sitename = $this->
getConfig()->get(
'Sitename' );
841 return "$sitename - $desc [$code]";
845 return $this->
msg(
'tagline' )->text();
863 if ( !
$res->numRows() ) {
868 foreach (
$res as $row ) {
869 $batch->add( $ns !==
null ? $ns : $row->namespace, $row->title );
setListoutput( $bool)
A mutator for $this->listoutput;.
getPageTitle( $subpage=false)
Get a self-referential title object.
bool $listoutput
Whether or not we want plain listoutput rather than an ordered list.
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
A base class for basic support for outputting syndication feeds in RSS and other formats.
msg( $key)
Wrapper around wfMessage that sets the current context.
this hook is for auditing only RecentChangesLinked and Watchlist 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
getCacheOrderFields()
Return the order fields for fetchFromCache.
Class representing a list of titles The execute() method checks them all for existence and adds them ...
getOutput()
Get the OutputPage being used for this instance.
if(!isset( $args[0])) $lang
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
getPageHeader()
The content returned by this function will be output before any result.
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:Array with elements of the form "language:title" in the order that they will be output. & $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
wfTimestamp( $outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array.
formatResult( $skin, $result)
Formats the results of the query for display.
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
outputResults( $out, $skin, $dbr, $res, $num, $offset)
Format and output report results using the given information plus OutputPage.
getLimitOffset()
Returns limit and offset, as returned by $this->getRequest()->getLimitOffset().
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined.
displayRestrictionError()
Output an error message telling the user what access level they have to have.
preprocessResults( $db, $res)
Do any necessary preprocessing of the result object.
execute( $par)
This is the actual workhorse.
getSkin()
Shortcut to get the skin being used for this instance.
getLanguage()
Shortcut to get user's language.
getName()
Get the name of this Special Page.
reallyDoQuery( $limit, $offset=false)
Run the query and return the result.
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
static openElement( $element, $attribs=null)
This opens an XML element.
int $offset
The offset and limit in use, as passed to the query() function.
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
getDescription()
Returns the name that goes in the <h1> in the special page itself, and also the name that will be l...
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
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
getConfig()
Shortcut to get main config object.
namespace and then decline to actually register it file or subcat img or subcat $title
getMaxResults()
Get max number of results we can return in miser mode.
</source > ! result< div class="mw-highlight mw-content-ltr" dir="ltr">< pre >< span ></span >< span class="kd"> var</span >< span class="nx"> a</span >< span class="p"></span ></pre ></div > ! end ! test Multiline< source/> in lists !input *< source > a b</source > *foo< source > a b</source > ! html< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! html tidy< ul >< li >< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul >< ul >< li > foo< div class="mw-highlight mw-content-ltr" dir="ltr">< pre > a b</pre ></div ></li ></ul > ! end ! test Custom attributes !input< source lang="javascript" id="foo" class="bar" dir="rtl" style="font-size: larger;"> var a
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
recache( $limit, $ignoreErrors=true)
Clear the cache and save new results.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getUser()
Shortcut to get the User executing this instance.
static makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
when a variable name is used in a it is silently declared as a new masking the global
doFeed( $class='', $limit=50)
Similar to above, but packaging in a syndicated feed instead of a web page.
getRecacheDB()
Get a DB connection to be used for slow recache queries.
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
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
getOrderFields()
Subclasses return an array of fields to order by here.
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
userCanExecute(User $user)
Checks if the given user (identified by an object) can execute this special page (as defined by $mRes...
Parent class for all special pages.
doQuery( $offset=false, $limit=false)
Somewhat deprecated, you probably want to be using execute()
fetchFromCache( $limit, $offset=false)
Fetch the query results from the query cache.
getRequest()
Get the WebRequest being used for this instance.
executeLBFromResultWrapper(ResultWrapper $res, $ns=null)
Creates a new LinkBatch object, adds all pages from the passed ResultWrapper (MUST include title and ...
showEmptyText()
Outputs some kind of an informative message (via OutputPage) to let the user know that the query retu...
if the prop value should be in the metadata multi language array format
feedResult( $row)
Override for custom handling.
isSyndicated()
Sometime we don't want to build rss / atom feeds.
getSQL()
For back-compat, subclasses may return a raw SQL query here, as a string.
static closeElement( $element)
Shortcut to close an XML element.
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 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
tryLastResult()
Some special pages (for example SpecialListusers used to) might not return the current object formatt...
$shownavigation
Whether to show prev/next links.
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
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 $skin
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true,...
getDBLimit( $uiLimit, $uiOffset)
What is limit to fetch from DB.
you have access to all of the normal MediaWiki so you can get a DB use the etc For full docs on the Maintenance class
sortDescending()
Override to sort by increasing values.
static getPages()
Get a list of query page classes and their associated special pages, for periodic updates.
static run( $event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
the array() calling protocol came about after MediaWiki 1.4rc1.
this class mediates it Skin Encapsulates a look and feel for the wiki All of the functions that render HTML and make choices about how to render it are here and are called from various other places when and is meant to be subclassed with other skins that may override some of its functions The User object contains a reference to a and so rather than having a global skin object we just rely on the global User and get the skin with $wgUser and also has some character encoding functions and other locale stuff The current user interface language is instantiated as and the content language as $wgContLang
$numRows
The number of rows returned by the query.
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