Go to the documentation of this file.
75 parent::__construct(
$name );
89 $out->allowClickjacking();
92 $from = $request->getVal(
'from',
null );
93 $to = $request->getVal(
'to',
null );
94 $namespace = $request->getInt(
'namespace' );
95 $hideredirects = $request->getBool(
'hideredirects',
false );
100 ( $namespace > 0 && array_key_exists( $namespace,
$namespaces ) ) ?
101 $this->
msg(
'allinnamespace', str_replace(
'_',
' ',
$namespaces[$namespace] ) ) :
102 $this->
msg(
'allarticles' )
104 $out->addModuleStyles(
'mediawiki.special' );
106 if ( $par !==
null ) {
107 $this->
showChunk( $namespace, $par, $to, $hideredirects );
108 } elseif (
$from !==
null && $to ===
null ) {
135 <td class='mw-label'>" .
138 <td class='mw-input'>" .
143 <td class='mw-label'>" .
146 <td class='mw-input'>" .
147 Xml::input(
'to', 30, str_replace(
'_',
' ', $to ),
array(
'id' =>
'nsto' ) ) .
151 <td class='mw-label'>" .
154 <td class='mw-input'>" .
156 array(
'selected' => $namespace ),
157 array(
'name' =>
'namespace',
'id' =>
'namespace' )
160 $this->
msg(
'allpages-hide-redirects' )->
text(),
185 # TODO: Either make this *much* faster or cache the title index points
186 # in the querycache table.
190 $where =
array(
'page_namespace' => $namespace );
192 if ( $hideredirects ) {
193 $where[
'page_is_redirect'] = 0;
199 $to = ( $to && $to->isLocal() ) ? $to->getDBkey() :
null;
201 if ( isset(
$from ) ) {
202 $where[] =
'page_title >= ' .
$dbr->addQuotes(
$from );
205 if ( isset( $to ) ) {
206 $where[] =
'page_title <= ' .
$dbr->addQuotes( $to );
210 $key =
wfMemcKey(
'allpages',
'ns', $namespace, sha1(
$from ), sha1( $to ) );
213 $count =
$dbr->estimateRowCount(
'page',
'*', $where, __METHOD__ );
217 if (
$count > $this->maxTopLevelPages ) {
223 $maxPerSubpage = intval(
$count / $this->maxLineCount );
224 $maxPerSubpage = max( $maxPerSubpage, $this->maxPerPage );
226 if ( !is_array(
$lines ) ) {
228 $options[
'ORDER BY'] =
'page_title ASC';
229 $firstTitle =
$dbr->selectField(
'page',
'page_title', $where, __METHOD__,
$options );
230 $lastTitle = $firstTitle;
231 # This array is going to hold the page_titles in order.
233 # If we are going to show n rows, we need n+1 queries to find the relevant titles.
237 $chunk = ( $lastTitle ===
false )
239 :
array(
'page_title >= ' .
$dbr->addQuotes( $lastTitle ) );
242 array_merge( $where, $chunk ),
244 array(
'LIMIT' => 2,
'OFFSET' => $maxPerSubpage - 1,
'ORDER BY' =>
'page_title ASC' )
249 array_push(
$lines,
$s->page_title );
252 $endTitle =
$dbr->selectField(
'page',
'MAX(page_title)',
253 array_merge( $where, $chunk ),
255 array_push(
$lines, $endTitle );
261 array_push(
$lines,
$s->page_title );
262 $lastTitle =
$s->page_title;
275 if ( count(
$lines ) <= 2 ) {
285 # At this point, $lines should contain an even number of elements.
287 while ( count(
$lines ) > 0 ) {
288 $inpoint = array_shift(
$lines );
289 $outpoint = array_shift(
$lines );
290 $out .= $this->
showline( $inpoint, $outpoint, $namespace, $hideredirects );
299 if ( isset(
$from ) || isset( $to ) ) {
305 <td class="mw-allpages-nav">' .
327 function showline( $inpoint, $outpoint, $namespace =
NS_MAIN, $hideRedirects =
false ) {
331 $inpointf = str_replace(
'_',
' ', $inpoint );
332 $outpointf = str_replace(
'_',
' ', $outpoint );
335 $inpointf =
$wgContLang->truncate( $inpointf, $this->maxPageLength );
336 $outpointf =
$wgContLang->truncate( $outpointf, $this->maxPageLength );
338 $queryParams =
array(
344 $queryParams[
'namespace'] = $namespace;
346 if ( $hideRedirects ) {
347 $queryParams[
'hideredirects'] = 1;
350 $url = $this->
getPageTitle()->getLocalURL( $queryParams );
354 $out = $this->
msg(
'alphaindexline' )->rawParams(
359 return '<tr><td class="mw-allpages-alphaindexline">' .
$out .
'</td></tr>';
376 if ( !$fromList || !$toList ) {
377 $out = $this->
msg(
'allpagesbadtitle' )->parseAsBlock();
378 } elseif ( !array_key_exists( $namespace,
$namespaces ) ) {
380 $out = $this->
msg(
'allpages-bad-ns', $namespace )->parse();
383 list( $namespace, $fromKey,
$from ) = $fromList;
384 list( , $toKey, $to ) = $toList;
388 'page_namespace' => $namespace,
389 'page_title >= ' .
$dbr->addQuotes( $fromKey )
392 if ( $hideredirects ) {
393 $conds[
'page_is_redirect'] = 0;
396 if ( $toKey !==
"" ) {
397 $conds[] =
'page_title <= ' .
$dbr->addQuotes( $toKey );
401 array(
'page_namespace',
'page_title',
'page_is_redirect',
'page_id' ),
405 'ORDER BY' =>
'page_title',
406 'LIMIT' => $this->maxPerPage + 1,
407 'USE INDEX' =>
'name_title',
411 if (
$res->numRows() > 0 ) {
413 while ( ( $n < $this->maxPerPage ) && (
$s =
$res->fetchObject() ) ) {
416 $link = (
$s->page_is_redirect ?
'<div class="allpagesredirect">' :
'' ) .
418 (
$s->page_is_redirect ?
'</div>' :
'' );
420 $link =
'[[' . htmlspecialchars(
$s->page_title ) .
']]';
427 $out .=
"<td style=\"width:33%\">$link</td>";
434 if ( (
$n % 3 ) != 0 ) {
450 # Get the last title from previous chunk
452 $res_prev =
$dbr->select(
455 array(
'page_namespace' => $namespace,
'page_title < ' .
$dbr->addQuotes(
$from ) ),
457 array(
'ORDER BY' =>
'page_title DESC',
458 'LIMIT' => $this->maxPerPage,
'OFFSET' => ( $this->maxPerPage - 1 )
462 # Get first title of previous complete chunk
464 $pt =
$dbr->fetchObject( $res_prev );
467 # The previous chunk is not complete, need to link to the very first title
468 # available in the database
470 if ( !
$dbr->implicitOrderby() ) {
471 $options[
'ORDER BY'] =
'page_title';
473 $reallyFirstPage_title =
$dbr->selectField(
'page',
'page_title',
474 array(
'page_namespace' => $namespace ), __METHOD__,
$options );
475 # Show the previous link if it s not the current requested chunk
476 if (
$from != $reallyFirstPage_title ) {
492 <td class="mw-allpages-nav">' .
495 # Do we put a previous link ?
496 if ( isset( $prevTitle ) && $pt = $prevTitle->getText() ) {
500 $query[
'namespace'] = $namespace;
503 if ( $hideredirects ) {
504 $query[
'hideredirects'] = $hideredirects;
509 $this->
msg(
'prevpage', $pt )->escaped(),
516 if (
$n == $this->maxPerPage &&
$s =
$res->fetchObject() ) {
517 # $s is the first link of the next chunk
522 $query[
'namespace'] = $namespace;
525 if ( $hideredirects ) {
526 $query[
'hideredirects'] = $hideredirects;
531 $this->
msg(
'nextpage',
$t->getText() )->escaped(),
537 $out2 .=
"</td></tr></table>";
543 if ( isset( $prevLink ) ) {
544 $links[] = $prevLink;
547 if ( isset( $nextLink ) ) {
548 $links[] = $nextLink;
551 if ( count( $links ) ) {
568 # shortcut for common case
569 return array( $ns,
'',
'' );
573 if (
$t &&
$t->isLocal() ) {
574 return array(
$t->getNamespace(),
$t->getDBkey(),
$t->getText() );
579 # try again, in case the problem was an empty pagename
580 $text = preg_replace(
'/(#|$)/',
'X$1', $text );
582 if (
$t &&
$t->isLocal() ) {
583 return array(
$t->getNamespace(),
'',
'' );
static checkLabel( $label, $name, $id, $checked=false, $attribs=array())
Convenience function to build an HTML checkbox with a label.
getPageTitle( $subpage=false)
Get a self-referential title object.
static & makeTitle( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
__construct( $name='Allpages')
Constructor.
skin txt MediaWiki includes four core it has been set as the default in MediaWiki since the replacing Monobook it had been been the default skin since before being replaced by Vector largely rewritten in while keeping its appearance Several legacy skins were removed in the as the burden of supporting them became too heavy to bear Those in etc for skin dependent CSS etc for skin dependent JavaScript These can also be customised on a per user by etc This feature has led to a wide variety of user styles becoming that gallery is a good place to ending in php
$maxTopLevelPages
Maximum number of pages in a hierarchical ("top level") list.
getOutput()
Get the OutputPage being used for this instance.
globals will be eliminated from MediaWiki replaced by an application object which would be passed to constructors Whether that would be an convenient solution remains to be but certainly PHP makes such object oriented programming models easier than they were in previous versions For the time being MediaWiki programmers will have to work in an environment with some global context At the time of globals were initialised on startup by MediaWiki of these were configuration which are documented in DefaultSettings php There is no comprehensive documentation for the remaining however some of the most important ones are listed below They are typically initialised either in index php or in Setup php For a description of the see design txt $wgTitle Title object created from the request URL $wgOut OutputPage object for HTTP response $wgUser User object for the user associated with the current request $wgLang Language object selected by user preferences $wgContLang Language object associated with the wiki being viewed $wgParser Parser object Parser extensions register their hooks here $wgRequest WebRequest to get request data $wgMemc
& wfGetDB( $db, $groups=array(), $wiki=false)
Get a Database object.
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add text
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
execute( $par)
Entry point : initialise variables and call subfunctions.
Shortcut to construct an includable special page.
static hidden( $name, $value, $attribs=array())
Convenience function to produce an input element with type=hidden.
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
getLanguage()
Shortcut to get user's language.
string $nsfromMsg
Determines, which message describes the input field 'nsfrom'.
set to $title object and return false for a match for latest after cache objects are set use the ContentHandler facility to handle CSS and JavaScript for highlighting & $link
static openElement( $element, $attribs=null)
This opens an XML element.
static linkKnown( $target, $html=null, $customAttribs=array(), $query=array(), $options=array( 'known', 'noclasses'))
Identical to link(), except $options defaults to 'known'.
int $maxPageLength
Maximum number of chars to show for an entry.
static link( $target, $html=null, $customAttribs=array(), $query=array(), $options=array())
This function returns an HTML link to the given target.
int $maxPerPage
Maximum number of pages to show on single subpage.
wfMemcKey()
Get a cache key.
showline( $inpoint, $outpoint, $namespace=NS_MAIN, $hideRedirects=false)
Show a line of "ABC to DEF" ranges of articles.
static element( $element, $attribs=array(), $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
static newFromRow( $row)
Make a Title object from a DB row.
namespaceForm( $namespace=NS_MAIN, $from='', $to='', $hideredirects=false)
HTML for the top form.
static element( $element, $attribs=null, $contents='', $allowShortTag=true)
Format an XML element with given attributes and, optionally, text content.
the array() calling protocol came about after MediaWiki 1.4rc1.
List of Api Query prop modules.
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
when a variable name is used in a it is silently declared as a new masking the global
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
processing should stop and the error should be shown to the user * false
getContext()
Gets the context this SpecialPage is executed in.
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
static makeTitleSafe( $ns, $title, $fragment='', $interwiki='')
Create a new Title from a namespace index and a DB key.
Allows to change the fields on the form that will be generated $name
msg()
Wrapper around wfMessage that sets the current context.
getRequest()
Get the WebRequest being used for this instance.
getNamespaceKeyAndText( $ns, $text)
namespace and then decline to actually register it & $namespaces
static closeElement( $element)
Shortcut to close an XML element.
showToplevel( $namespace=NS_MAIN, $from='', $to='', $hideredirects=false)
static namespaceSelector(array $params=array(), array $selectAttribs=array())
Build a drop-down box for selecting a namespace.
int $maxLineCount
Maximum number of pages to show on single index subpage.
static submitButton( $value, $attribs=array())
Convenience function to build an HTML submit button.
Implements Special:Allpages.
static input( $name, $size=false, $value=false, $attribs=array())
Convenience function to build an HTML text input field.
static rawElement( $element, $attribs=array(), $contents='')
Returns an HTML element in a string.
static label( $label, $id, $attribs=array())
Convenience function to build an HTML form label.
return true to allow those checks to and false if checking is done use this to change the tables headers temp or archived zone change it to an object instance and return false override the list derivative used the name of the old file when set the default code will be skipped add a value to it if you want to add a cookie that have to vary cache options can modify $query
showChunk( $namespace=NS_MAIN, $from=false, $to=false, $hideredirects=false)
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.