50 parent::__construct(
$name );
64 $out->allowClickjacking();
67 $from =
$request->getVal(
'from',
null );
68 $to =
$request->getVal(
'to',
null );
69 $namespace =
$request->getInt(
'namespace' );
71 $miserMode = (bool)$this->
getConfig()->get(
'MiserMode' );
74 $hideredirects =
$request->getBool(
'hideredirects',
false ) && !$miserMode;
79 ( $namespace > 0 && array_key_exists( $namespace,
$namespaces ) ) ?
80 $this->
msg(
'allinnamespace', str_replace(
'_',
' ',
$namespaces[$namespace] ) ) :
81 $this->
msg(
'allarticles' )
83 $out->addModuleStyles(
'mediawiki.special' );
85 if ( $par !==
null ) {
86 $this->
showChunk( $namespace, $par, $to, $hideredirects );
87 } elseif ( $from !==
null && $to ===
null ) {
88 $this->
showChunk( $namespace, $from, $to, $hideredirects );
90 $this->
showToplevel( $namespace, $from, $to, $hideredirects );
103 $from =
'', $to =
'', $hideRedirects =
false
105 $miserMode = (bool)$this->
getConfig()->get(
'MiserMode' );
112 'label-message' =>
'allpagesfrom',
113 'default' => str_replace(
'_',
' ', $from ),
120 'label-message' =>
'allpagesto',
121 'default' => str_replace(
'_',
' ', $to ),
124 'type' =>
'namespaceselect',
125 'name' =>
'namespace',
127 'label-message' =>
'namespace',
129 'default' => $namespace,
133 'name' =>
'hideredirects',
134 'id' =>
'hidredirects',
135 'label-message' =>
'allpages-hide-redirects',
136 'value' => $hideRedirects,
149 ->setWrapperLegendMsg(
'allpages' )
150 ->setSubmitTextMsg(
'allpagessubmit' )
152 ->displayForm(
false );
162 $from = Title::makeTitleSafe( $namespace, $from );
163 $to = Title::makeTitleSafe( $namespace, $to );
164 $from = ( $from && $from->isLocal() ) ? $from->getDBkey() :
null;
165 $to = ( $to && $to->isLocal() ) ? $to->getDBkey() :
null;
167 $this->
showChunk( $namespace, $from, $to, $hideredirects );
176 function showChunk( $namespace =
NS_MAIN, $from =
false, $to =
false, $hideredirects =
false ) {
185 if ( !$fromList || !$toList ) {
186 $out = $this->
msg(
'allpagesbadtitle' )->parseAsBlock();
187 } elseif ( !array_key_exists( $namespace,
$namespaces ) ) {
189 $out = $this->
msg(
'allpages-bad-ns', $namespace )->parse();
192 list( $namespace, $fromKey, $from ) = $fromList;
193 list( , $toKey, $to ) = $toList;
196 $filterConds = [
'page_namespace' => $namespace ];
197 if ( $hideredirects ) {
198 $filterConds[
'page_is_redirect'] = 0;
201 $conds = $filterConds;
202 $conds[] =
'page_title >= ' .
$dbr->addQuotes( $fromKey );
203 if ( $toKey !==
"" ) {
204 $conds[] =
'page_title <= ' .
$dbr->addQuotes( $toKey );
208 [
'page_namespace',
'page_title',
'page_is_redirect',
'page_id' ],
212 'ORDER BY' =>
'page_title',
213 'LIMIT' => $this->maxPerPage + 1,
214 'USE INDEX' =>
'name_title',
219 if (
$res->numRows() > 0 ) {
220 $out = Html::openElement(
'ul', [
'class' =>
'mw-allpages-chunk' ] );
222 while ( ( $n < $this->maxPerPage ) && (
$s =
$res->fetchObject() ) ) {
223 $t = Title::newFromRow(
$s );
226 (
$s->page_is_redirect ?
' class="allpagesredirect"' :
'' ) .
231 $out .=
'<li>[[' . htmlspecialchars(
$s->page_title ) .
"]]</li>\n";
235 $out .= Html::closeElement(
'ul' );
237 if (
$res->numRows() > 2 ) {
240 $out = Html::rawElement(
'div', [
'class' =>
'mw-allpages-body' ],
$out );
246 if ( $fromKey !==
'' && !$this->
including() ) {
247 # Get the first title from previous chunk
248 $prevConds = $filterConds;
249 $prevConds[] =
'page_title < ' .
$dbr->addQuotes( $fromKey );
250 $prevKey =
$dbr->selectField(
255 [
'ORDER BY' =>
'page_title DESC',
'OFFSET' => $this->maxPerPage - 1 ]
258 if ( $prevKey ===
false ) {
259 # The previous chunk is not complete, need to link to the very first title
260 # available in the database
261 $prevKey =
$dbr->selectField(
266 [
'ORDER BY' =>
'page_title' ]
270 if ( $prevKey !==
false ) {
271 $prevTitle = Title::makeTitle( $namespace, $prevKey );
287 $query = [
'from' => $prevTitle->getText() ];
290 $query[
'namespace'] = $namespace;
293 if ( $hideredirects ) {
294 $query[
'hideredirects'] = $hideredirects;
299 $this->
msg(
'prevpage', $prevTitle->getText() )->text(),
307 if ( $n == $this->maxPerPage &&
$s =
$res->fetchObject() ) {
308 # $s is the first link of the next chunk
309 $t = Title::makeTitle( $namespace,
$s->page_title );
310 $query = [
'from' =>
$t->getText() ];
313 $query[
'namespace'] = $namespace;
316 if ( $hideredirects ) {
317 $query[
'hideredirects'] = $hideredirects;
322 $this->
msg(
'nextpage',
$t->getText() )->text(),
330 if ( count( $navLinks ) ) {
332 $pagination = Html::rawElement(
'div',
333 [
'class' =>
'mw-allpages-nav' ],
337 $output->addHTML( $pagination );
338 $out .= Html::element(
'hr' ) . $pagination;
351 # shortcut for common case
352 return [ $ns,
'',
'' ];
355 $t = Title::makeTitleSafe( $ns, $text );
356 if (
$t &&
$t->isLocal() ) {
357 return [
$t->getNamespace(),
$t->getDBkey(),
$t->getText() ];
362 # try again, in case the problem was an empty pagename
363 $text = preg_replace(
'/(#|$)/',
'X$1', $text );
364 $t = Title::makeTitleSafe( $ns, $text );
365 if (
$t &&
$t->isLocal() ) {
366 return [
$t->getNamespace(),
'',
'' ];
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
An IContextSource implementation which will inherit context from another source but allow individual ...
Shortcut to construct an includable special page.
Implements Special:Allpages.
$maxPerPage
Maximum number of pages to show on single subpage.
__construct( $name='Allpages')
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
showToplevel( $namespace=NS_MAIN, $from='', $to='', $hideredirects=false)
execute( $par)
Entry point : initialise variables and call subfunctions.
prefixSearchSubpages( $search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
showChunk( $namespace=NS_MAIN, $from=false, $to=false, $hideredirects=false)
$nsfromMsg
Determines, which message describes the input field 'nsfrom'.
outputHTMLForm( $namespace=NS_MAIN, $from='', $to='', $hideRedirects=false)
Outputs the HTMLForm used on this page.
getNamespaceKeyAndText( $ns, $text)
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
getOutput()
Get the OutputPage being used for this instance.
getContext()
Gets the context this SpecialPage is executed in.
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.
getPageTitle( $subpage=false)
Get a self-referential title object.
getLanguage()
Shortcut to get user's language.
including( $x=null)
Whether the special page is being evaluated via transclusion.
prefixSearchString( $search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
MediaWiki Linker LinkRenderer null $linkRenderer
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
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
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
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
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
Allows to change the fields on the form that will be generated $name
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
static configuration should be added through ResourceLoaderGetConfigVars instead can be used to get the real title e g db for database replication lag or jobqueue for job queue size converted to pseudo seconds It is possible to add more fields and they will be returned to the user in the API response after the basic globals have been set but before ordinary actions take place $output
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