Go to the documentation of this file.
43 parent::__construct(
'Prefixindex' );
55 $out->addModuleStyles(
'mediawiki.special' );
59 $from =
$request->getVal(
'from',
'' );
60 $prefix =
$request->getVal(
'prefix',
'' );
61 $ns =
$request->getIntOrNull(
'namespace' );
62 $namespace = (int)$ns;
63 $this->hideRedirects =
$request->getBool(
'hideredirects', $this->hideRedirects );
64 $this->stripPrefix =
$request->getBool(
'stripprefix', $this->stripPrefix );
66 $namespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
68 ( $namespace > 0 && array_key_exists( $namespace,
$namespaces ) )
69 ? $this->
msg(
'prefixindex-namespace', str_replace(
'_',
' ',
$namespaces[$namespace] ) )
70 : $this->
msg(
'prefixindex' )
74 if ( $par !==
null ) {
76 } elseif ( $prefix !=
'' ) {
78 } elseif ( $from !=
'' && $ns ===
null ) {
85 if ( $this->
including() || $showme !=
'' || $ns !==
null ) {
101 'label-message' =>
'allpagesprefix',
106 'default' => str_replace(
'_',
' ', $from ),
109 'type' =>
'namespaceselect',
110 'name' =>
'namespace',
112 'label-message' =>
'namespace',
114 'default' => $namespace,
117 'class' =>
'HTMLCheckField',
118 'name' =>
'hideredirects',
119 'label-message' =>
'allpages-hide-redirects',
122 'class' =>
'HTMLCheckField',
123 'name' =>
'stripprefix',
124 'label-message' =>
'prefixindex-strip',
132 ->setWrapperLegendMsg(
'prefixindex' )
133 ->setSubmitTextMsg(
'prefixindex-submit' );
135 return $htmlForm->prepareForm()->getHTML(
false );
144 if ( $from ===
null ) {
150 $namespaces = MediaWikiServices::getInstance()->getContentLanguage()->getNamespaces();
155 if ( !$prefixList || !$fromList ) {
156 $out = $this->
msg(
'allpagesbadtitle' )->parseAsBlock();
157 } elseif ( !array_key_exists( $namespace,
$namespaces ) ) {
159 $out = $this->
msg(
'allpages-bad-ns', $namespace )->parse();
162 list( $namespace, $prefixKey, $prefix ) = $prefixList;
163 list( , $fromKey, ) = $fromList;
165 # ## @todo FIXME: Should complain if $fromNs != $namespace
170 'page_namespace' => $namespace,
171 'page_title' .
$dbr->buildLike( $prefixKey,
$dbr->anyString() ),
172 'page_title >= ' .
$dbr->addQuotes( $fromKey ),
175 if ( $this->hideRedirects ) {
176 $conds[
'page_is_redirect'] = 0;
181 [
'page_namespace',
'page_title' ],
187 'ORDER BY' =>
'page_title',
188 'LIMIT' => $this->maxPerPage + 1,
189 'USE INDEX' =>
'name_title',
195 if (
$res->numRows() > 0 ) {
197 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
199 $prefixLength = strlen( $prefix );
200 foreach (
$res as $row ) {
201 if ( $n >= $this->maxPerPage ) {
207 $linkCache->addGoodLinkObjFromRow(
$title, $row );
208 $displayed =
$title->getText();
210 if ( $this->stripPrefix && $prefixLength !== strlen( $displayed ) ) {
211 $displayed = substr( $displayed, $prefixLength );
213 $link = (
$title->isRedirect() ?
'<div class="allpagesredirect">' :
'' ) .
218 (
$title->isRedirect() ?
'</div>' :
'' );
220 $out .=
"<li>$link</li>\n";
226 if (
$res->numRows() > 2 ) {
247 if (
$res && ( $n == $this->maxPerPage ) && $nextRow ) {
249 'from' => $nextRow->page_title,
255 if ( $namespace || $prefix ==
'' ) {
258 $query[
'namespace'] = $namespace;
263 $this->
msg(
'nextpage', str_replace(
'_',
' ', $nextRow->page_title ) )->text(),
270 [
'class' =>
'mw-prefixindex-nav' ],
278 [
'class' =>
'mw-prefixindex-nav' ],
getPageTitle( $subpage=false)
Get a self-referential title object.
msg( $key)
Wrapper around wfMessage that sets the current context.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on and they can depend only on the ResourceLoaderContext $context
getOutput()
Get the OutputPage being used for this instance.
showPrefixChunk( $namespace, $prefix, $from=null)
namespace and then decline to actually register it & $namespaces
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 & $formDescriptor
execute( $par)
Entry point : initialise variables and call subfunctions.
static getSelectFields()
Fields that LinkCache needs to select.
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
static closeElement( $element)
Returns "</$element>".
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
An IContextSource implementation which will inherit context from another source but allow individual ...
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
namespace and then decline to actually register it file or subcat img or subcat $title
static newFromRow( $row)
Make a Title object from a DB row.
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
$stripPrefix
Whether to remove the searched prefix from the displayed link.
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
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
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
getContext()
Gets the context this SpecialPage is executed in.
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
namespacePrefixForm( $namespace=NS_MAIN, $from='')
HTML for the top form.
getNamespaceKeyAndText( $ns, $text)
getRequest()
Get the WebRequest being used for this instance.
Implements Special:Allpages.
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
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
usually copyright or history_copyright This message must be in HTML not wikitext & $link
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
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 MediaWikiServices
Implements Special:Prefixindex.
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
including( $x=null)
Whether the special page is being evaluated via transclusion.
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