52 parent::__construct(
$name );
66 $out->allowClickjacking();
70 $to =
$request->getVal(
'to', null );
71 $namespace =
$request->getInt(
'namespace' );
72 $hideredirects =
$request->getBool(
'hideredirects',
false );
77 ( $namespace > 0 && array_key_exists( $namespace,
$namespaces ) ) ?
78 $this->
msg(
'allinnamespace', str_replace(
'_',
' ',
$namespaces[$namespace] ) ) :
79 $this->
msg(
'allarticles' )
81 $out->addModuleStyles(
'mediawiki.special' );
83 if ( $par !== null ) {
84 $this->
showChunk( $namespace, $par, $to, $hideredirects );
85 } elseif (
$from !== null && $to === null ) {
101 $from =
'', $to =
'', $hideRedirects =
false
109 'label-message' =>
'allpagesfrom',
110 'default' => str_replace(
'_',
' ',
$from ),
117 'label-message' =>
'allpagesto',
118 'default' => str_replace(
'_',
' ', $to ),
121 'type' =>
'namespaceselect',
122 'name' =>
'namespace',
124 'label-message' =>
'namespace',
126 'value' => $namespace,
130 'name' =>
'hideredirects',
131 'id' =>
'hidredirects',
132 'label-message' =>
'allpages-hide-redirects',
133 'value' => $hideRedirects,
137 $form->setMethod(
'get' )
138 ->setWrapperLegendMsg(
'allpages' )
139 ->setSubmitTextMsg(
'allpagessubmit' )
141 ->displayForm(
false );
154 $to = ( $to && $to->isLocal() ) ? $to->getDBkey() : null;
174 if ( !$fromList || !$toList ) {
175 $out = $this->
msg(
'allpagesbadtitle' )->parseAsBlock();
176 } elseif ( !array_key_exists( $namespace,
$namespaces ) ) {
178 $out = $this->
msg(
'allpages-bad-ns', $namespace )->parse();
181 list( $namespace, $fromKey,
$from ) = $fromList;
182 list( , $toKey, $to ) = $toList;
185 $filterConds = [
'page_namespace' => $namespace ];
186 if ( $hideredirects ) {
187 $filterConds[
'page_is_redirect'] = 0;
190 $conds = $filterConds;
191 $conds[] =
'page_title >= ' .
$dbr->addQuotes( $fromKey );
192 if ( $toKey !==
"" ) {
193 $conds[] =
'page_title <= ' .
$dbr->addQuotes( $toKey );
197 [
'page_namespace',
'page_title',
'page_is_redirect',
'page_id' ],
201 'ORDER BY' =>
'page_title',
202 'LIMIT' => $this->maxPerPage + 1,
203 'USE INDEX' =>
'name_title',
207 if (
$res->numRows() > 0 ) {
210 while ( ( $n < $this->maxPerPage ) && (
$s =
$res->fetchObject() ) ) {
214 (
$s->page_is_redirect ?
' class="allpagesredirect"' :
'' ) .
219 $out .=
'<li>[[' . htmlspecialchars(
$s->page_title ) .
"]]</li>\n";
225 if (
$res->numRows() > 2 ) {
234 if ( $fromKey !==
'' && !$this->
including() ) {
235 # Get the first title from previous chunk
236 $prevConds = $filterConds;
237 $prevConds[] =
'page_title < ' .
$dbr->addQuotes( $fromKey );
238 $prevKey =
$dbr->selectField(
243 [
'ORDER BY' =>
'page_title DESC',
'OFFSET' => $this->maxPerPage - 1 ]
246 if ( $prevKey ===
false ) {
247 # The previous chunk is not complete, need to link to the very first title
248 # available in the database
249 $prevKey =
$dbr->selectField(
254 [
'ORDER BY' =>
'page_title' ]
258 if ( $prevKey !==
false ) {
274 $query = [
'from' => $prevTitle->getText() ];
277 $query[
'namespace'] = $namespace;
280 if ( $hideredirects ) {
281 $query[
'hideredirects'] = $hideredirects;
286 $this->
msg(
'prevpage', $prevTitle->getText() )->escaped(),
294 if ( $n == $this->maxPerPage &&
$s =
$res->fetchObject() ) {
295 # $s is the first link of the next chunk
297 $query = [
'from' =>
$t->getText() ];
300 $query[
'namespace'] = $namespace;
303 if ( $hideredirects ) {
304 $query[
'hideredirects'] = $hideredirects;
309 $this->
msg(
'nextpage',
$t->getText() )->escaped(),
317 if ( count( $navLinks ) ) {
320 [
'class' =>
'mw-allpages-nav' ],
324 $output->addHTML( $pagination );
338 # shortcut for common case
339 return [ $ns,
'',
'' ];
343 if (
$t &&
$t->isLocal() ) {
344 return [
$t->getNamespace(),
$t->getDBkey(),
$t->getText() ];
349 # try again, in case the problem was an empty pagename
350 $text = preg_replace(
'/(#|$)/',
'X$1', $text );
352 if (
$t &&
$t->isLocal() ) {
353 return [
$t->getNamespace(),
'',
'' ];
static newFromRow($row)
Make a Title object from a DB row.
static closeElement($element)
Returns "$element>".
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
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
getContext()
Gets the context this SpecialPage is executed in.
static rawElement($element, $attribs=[], $contents= '')
Returns an HTML element in a string.
prefixSearchSubpages($search, $limit, $offset)
Return an array of subpages beginning with $search that this special page will accept.
Implements Special:Allpages.
getNamespaceKeyAndText($ns, $text)
msg()
Wrapper around wfMessage that sets the current context.
including($x=null)
Whether the special page is being evaluated via transclusion.
getOutput()
Get the OutputPage being used for this instance.
__construct($name= 'Allpages')
Constructor.
outputHeader($summaryMessageKey= '')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
static openElement($element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Shortcut to construct an includable special page.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes! ...
static makeTitleSafe($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
static linkKnown($target, $html=null, $customAttribs=[], $query=[], $options=[ 'known'])
Identical to link(), except $options defaults to 'known'.
$maxPerPage
Maximum number of pages to show on single subpage.
showChunk($namespace=NS_MAIN, $from=false, $to=false, $hideredirects=false)
showToplevel($namespace=NS_MAIN, $from= '', $to= '', $hideredirects=false)
namespace and then decline to actually register it & $namespaces
static link($target, $html=null, $customAttribs=[], $query=[], $options=[])
This function returns an HTML link to the given target.
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 & $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
error also a ContextSource you ll probably need to make sure the header is varied on $request
execute($par)
Entry point : initialise variables and call subfunctions.
getLanguage()
Shortcut to get user's language.
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 $limit
$nsfromMsg
Determines, which message describes the input field 'nsfrom'.
getRequest()
Get the WebRequest being used for this instance.
prefixSearchString($search, $limit, $offset)
Perform a regular substring search for prefixSearchSubpages.
static element($element, $attribs=[], $contents= '')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static makeTitle($ns, $title, $fragment= '', $interwiki= '')
Create a new Title from a namespace index and a DB key.
outputHTMLForm($namespace=NS_MAIN, $from= '', $to= '', $hideRedirects=false)
Outputs the HTMLForm used on this page.
getPageTitle($subpage=false)
Get a self-referential title object.
Allows to change the fields on the form that will be generated $name