68 [
'AncientPagesPage',
'Ancientpages' ],
69 [
'BrokenRedirectsPage',
'BrokenRedirects' ],
70 [
'DeadendPagesPage',
'Deadendpages' ],
71 [
'DoubleRedirectsPage',
'DoubleRedirects' ],
72 [
'FileDuplicateSearchPage',
'FileDuplicateSearch' ],
73 [
'ListDuplicatedFilesPage',
'ListDuplicatedFiles' ],
74 [
'LinkSearchPage',
'LinkSearch' ],
75 [
'ListredirectsPage',
'Listredirects' ],
76 [
'LonelyPagesPage',
'Lonelypages' ],
77 [
'LongPagesPage',
'Longpages' ],
78 [
'MediaStatisticsPage',
'MediaStatistics' ],
79 [
'MIMEsearchPage',
'MIMEsearch' ],
80 [
'MostcategoriesPage',
'Mostcategories' ],
81 [
'MostimagesPage',
'Mostimages' ],
82 [
'MostinterwikisPage',
'Mostinterwikis' ],
83 [
'MostlinkedCategoriesPage',
'Mostlinkedcategories' ],
84 [
'MostlinkedTemplatesPage',
'Mostlinkedtemplates' ],
85 [
'MostlinkedPage',
'Mostlinked' ],
86 [
'MostrevisionsPage',
'Mostrevisions' ],
87 [
'FewestrevisionsPage',
'Fewestrevisions' ],
88 [
'ShortPagesPage',
'Shortpages' ],
89 [
'UncategorizedCategoriesPage',
'Uncategorizedcategories' ],
90 [
'UncategorizedPagesPage',
'Uncategorizedpages' ],
91 [
'UncategorizedImagesPage',
'Uncategorizedimages' ],
92 [
'UncategorizedTemplatesPage',
'Uncategorizedtemplates' ],
93 [
'UnusedCategoriesPage',
'Unusedcategories' ],
94 [
'UnusedimagesPage',
'Unusedimages' ],
95 [
'WantedCategoriesPage',
'Wantedcategories' ],
96 [
'WantedFilesPage',
'Wantedfiles' ],
97 [
'WantedPagesPage',
'Wantedpages' ],
98 [
'WantedTemplatesPage',
'Wantedtemplates' ],
99 [
'UnwatchedpagesPage',
'Unwatchedpages' ],
100 [
'UnusedtemplatesPage',
'Unusedtemplates' ],
101 [
'WithoutInterwikiPage',
'Withoutinterwiki' ],
115 $this->listoutput = $bool;
156 throw new MWException(
"Bug in a QueryPage: doesn't implement getQueryInfo() nor "
157 .
"getQuery() properly" );
202 return $this->
getConfig()->get(
'DisableQueryPages' );
263 $this->
getOutput()->addWikiMsg(
'specialpage-empty' );
305 $fname = get_class( $this ) .
'::recache';
316 $num =
$res->numRows();
319 foreach (
$res as $row ) {
320 if ( isset( $row->value ) ) {
325 $value = intval( $row->value );
333 'qc_namespace' => $row->namespace,
334 'qc_title' => $row->title,
339 $dbw->doAtomicSection(
342 # Clear out any old cached data
343 $dbw->
delete(
'querycache',
344 [
'qc_type' => $this->
getName() ],
347 # Save results into the querycache table on the master
348 if ( count( $vals ) ) {
351 # Update the querycache_info record for the page
352 $dbw->
delete(
'querycache_info',
353 [
'qci_type' => $this->
getName() ],
356 $dbw->
insert(
'querycache_info',
357 [
'qci_type' => $this->
getName(),
365 if ( !$ignoreErrors ) {
390 $fname = get_class( $this ) .
"::reallyDoQuery";
396 foreach ( $order
as &$field ) {
401 if ( is_array(
$query ) ) {
408 if ( count( $order ) ) {
426 $sql .=
' ORDER BY ' . implode(
', ', $order );
465 $options[
'ORDER BY'] =
'qc_value DESC';
467 $options[
'ORDER BY'] =
'qc_value ASC';
469 return $dbr->select(
'querycache', [
'qc_type',
470 'namespace' =>
'qc_namespace',
471 'title' =>
'qc_title',
472 'value' =>
'qc_value' ],
473 [
'qc_type' => $this->
getName() ],
479 if ( is_null( $this->cachedTimestamp ) ) {
481 $fname = get_class( $this ) .
'::getCachedTimestamp';
482 $this->cachedTimestamp =
$dbr->selectField(
'querycache_info',
'qci_timestamp',
502 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
522 if ( $this->
getConfig()->
get(
'MiserMode' ) ) {
523 $limit = min( $uiLimit + 1, $maxResults - $uiOffset );
541 return max( $this->
getConfig()->
get(
'QueryCacheLimit' ), 10000 );
562 $out->addWikiMsg(
'querypage-disabled' );
568 if ( $this->limit == 0 && $this->offset == 0 ) {
571 $dbLimit = $this->
getDBLimit( $this->limit, $this->offset );
574 # select one extra row for navigation
577 # Get the cached result, select one extra row for navigation
579 if ( !$this->listoutput ) {
581 # Fetch the timestamp of this update
584 $maxResults =
$lang->formatNum( $this->
getConfig()->
get(
'QueryCacheLimit' ) );
587 $updated =
$lang->userTimeAndDate( $ts,
$user );
590 $out->addMeta(
'Data-Cache-Time', $ts );
591 $out->addJsConfigVars(
'dataCacheTime', $ts );
592 $out->addWikiMsg(
'perfcachedts', $updated, $updateddate, $updatedtime, $maxResults );
594 $out->addWikiMsg(
'perfcached', $maxResults );
597 # If updates on this page have been disabled, let the user know
598 # that the data set won't be refreshed for now
599 if ( is_array( $this->
getConfig()->
get(
'DisableQueryPageUpdate' ) )
600 && in_array( $this->
getName(), $this->
getConfig()->
get(
'DisableQueryPageUpdate' ) )
603 "<div class=\"mw-querypage-no-updates\">\n$1\n</div>",
604 'querypage-no-updates'
610 $this->numRows =
$res->numRows();
617 # Top header and navigation
618 if ( $this->shownavigation ) {
620 if ( $this->numRows > 0 ) {
621 $out->addHTML( $this->
msg(
'showingresultsinrange' )->numParams(
622 min( $this->numRows, $this->limit ), #
do not show
the one extra row,
if exist
623 $this->offset + 1, ( min( $this->numRows, $this->limit ) + $this->offset ) )->parseAsBlock() );
624 # Disable the "next" link when we reach the end
625 $miserMaxResults = $this->
getConfig()->get(
'MiserMode' )
626 && ( $this->offset + $this->limit >= $this->
getMaxResults() );
627 $atEnd = ( $this->numRows <=
$this->limit ) || $miserMaxResults;
630 $out->addHTML(
'<p>' . $paging .
'</p>' );
632 # No results to show, so don't bother with "showing X of Y" etc.
633 # -- just let the user know and give up now
640 # The actual results; specialist subclasses will want to handle this
641 # with more than a straight list, so we hand them the info, plus
642 # an OutputPage, and let them get on with it
647 min( $this->numRows, $this->limit ), #
do not format the one extra row,
if exist
650 # Repeat the paging links at the bottom
651 if ( $this->shownavigation ) {
652 $out->addHTML(
'<p>' . $paging .
'</p>' );
674 if ( !$this->listoutput ) {
678 # $res might contain the whole 1,000 rows, so we read up to
679 # $num [should update this to use a Pager]
681 for ( $i = 0; $i < $num && $row =
$res->fetchObject(); $i++ ) {
685 $html[] = $this->listoutput
687 :
"<li>{$line}</li>\n";
691 # Flush the final result
696 $html[] = $this->listoutput
698 :
"<li>{$line}</li>\n";
702 if ( !$this->listoutput ) {
706 $html = $this->listoutput
707 ? $wgContLang->listToText(
$html )
708 : implode(
'',
$html );
719 return "\n<ol start='" . (
$offset + 1 ) .
"' class='special'>\n";
744 if ( !$this->
getConfig()->
get(
'Feed' ) ) {
745 $this->
getOutput()->addWikiMsg(
'feed-unavailable' );
751 $feedClasses = $this->
getConfig()->get(
'FeedClasses' );
752 if ( isset( $feedClasses[$class] ) ) {
754 $feed =
new $feedClasses[$class](
761 foreach (
$res as $obj ) {
764 $feed->outItem( $item );
782 if ( !isset( $row->title ) ) {
787 $date = isset( $row->timestamp ) ? $row->timestamp :
'';
790 $talkpage =
$title->getTalkPage();
791 $comments = $talkpage->getFullURL();
795 $title->getPrefixedText(),
807 return isset( $row->comment ) ? htmlspecialchars( $row->comment ) :
'';
811 return isset( $row->user_text ) ? $row->user_text :
'';
817 $sitename = $this->
getConfig()->get(
'Sitename' );
818 return "$sitename - $desc [$code]";
822 return $this->
msg(
'tagline' )->text();
#define the
table suitable for use with IDatabase::select()
insert($table, $a, $fname=__METHOD__, $options=[])
INSERT wrapper, inserts an array into a table.
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
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
wfGetDB($db, $groups=[], $wiki=false)
Get a Database object.
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
Database error base class.
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
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException'returning false will NOT prevent logging $e
if(!isset($args[0])) $lang
getDBLimit($uiLimit, $uiOffset)
What is limit to fetch from DB.
doQuery($offset=false, $limit=false)
Somewhat deprecated, you probably want to be using execute()
getOrderFields()
Subclasses return an array of fields to order by here.
$numRows
The number of rows returned by the query.
getMaxResults()
Get max number of results we can return in miser mode.
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
feedResult($row)
Override for custom handling.
reallyDoQuery($limit, $offset=false)
Run the query and return the result.
msg()
Wrapper around wfMessage that sets the current context.
getOutput()
Get the OutputPage being used for this instance.
when a variable name is used in a it is silently declared as a new local masking the global
timestamp($ts=0)
Convert a timestamp in one of the formats accepted by wfTimestamp() to the format used for inserting ...
this hook is for auditing only RecentChangesLinked and Watchlist RecentChangesLinked and Watchlist e g Watchlist & $tables
fetchFromCache($limit, $offset=false)
Fetch the query results from the query cache.
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
showEmptyText()
Outputs some kind of an informative message (via OutputPage) to let the user know that the query retu...
const TS_UNIX
Unix time - the number of seconds since 1970-01-01 00:00:00 UTC.
getLimitOffset()
Returns limit and offset, as returned by $this->getRequest()->getLimitOffset().
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
This is a class for doing query pages; since they're almost all the same, we factor out some of the f...
formatResult($skin, $result)
Formats the results of the query for display.
recache($limit, $ignoreErrors=true)
Clear the cache and save new results.
wfTimestamp($outputtype=TS_UNIX, $ts=0)
Get a timestamp string in one of various formats.
getRecacheDB()
Get a DB connection to be used for slow recache queries.
static closeElement($element)
Shortcut to close an XML element.
linkParameters()
If using extra form wheely-dealies, return a set of parameters here as an associative array...
delete($table, $conds, $fname=__METHOD__)
DELETE query wrapper.
Parent class for all special pages.
tryLastResult()
Some special pages (for example SpecialListusers used to) might not return the current object formatt...
displayRestrictionError()
Output an error message telling the user what access level they have to have.
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
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
static openElement($element, $attribs=null)
This opens an XML element.
setListoutput($bool)
A mutator for $this->listoutput;.
sortDescending()
Override to sort by increasing values.
getSkin()
Shortcut to get the skin being used for this instance.
getDescription()
Returns the name that goes in the \
in the special page itself, and also the name that will be l...
int $offset
The offset and limit in use, as passed to the query() function.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
getPageHeader()
The content returned by this function will be output before any result.
namespace and then decline to actually register it file or subcat img or subcat $title
static run($event, array $args=[], $deprecatedVersion=null)
Call hook functions defined in Hooks::register and $wgHooks.
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
A base class for basic support for outputting syndication feeds in RSS and other formats.
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
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
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 local account $user
doFeed($class= '', $limit=50)
Similar to above, but packaging in a syndicated feed instead of a web page.
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 false for true for descending in case the handler function wants to provide a converted Content object Note that $result getContentModel() must return $toModel. 'CustomEditor'$rcid is used in generating this variable which contains information about the new such as the revision s whether the revision was marked as a minor edit or not
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
$shownavigation
Whether to show prev/next links.
getName()
Get the name of this Special Page.
if(!defined( 'MEDIAWIKI')) $fname
This file is not a valid entry point, perform no further processing unless MEDIAWIKI is defined...
getUser()
Shortcut to get the User executing this instance.
outputResults($out, $skin, $dbr, $res, $num, $offset)
Format and output report results using the given information plus OutputPage.
bool $listoutput
Whether or not we want plain listoutput rather than an ordered list.
getConfig()
Shortcut to get main config 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...
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 local content language as $wgContLang
preprocessResults($db, $res)
Do any necessary preprocessing of the result object.
execute($par)
This is the actual workhorse.
usesTimestamps()
Does this query return timestamps rather than integers in its 'value' field? If true, this class will convert 'value' to a UNIX timestamp for caching.
Result wrapper for grabbing data queried from an IDatabase object.
getRequest()
Get the WebRequest being used for this instance.
getSQL()
For back-compat, subclasses may return a raw SQL query here, as a string.
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode...
isCacheable()
Is the output of this query cacheable? Non-cacheable expensive pages will be disabled in miser mode a...
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
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...
if the prop value should be in the metadata multi language array format
Basic database interface for live and lazy-loaded relation database handles.
getPageTitle($subpage=false)
Get a self-referential title object.