94 'mediawiki.action.view.categoryPage.styles'
99 $this->cat = Category::newFromTitle(
$title );
102 unset( $this->
query[
'title'] );
111 $this->showGallery = $this->
getConfig()->get(
'CategoryMagicGallery' )
137 $r = $this->
msg(
'category-empty' )->parseAsBlock();
142 'class' =>
'mw-category-generated',
143 'lang' =>
$lang->getHtmlCode(),
144 'dir' =>
$lang->getDir()
146 # put a div around the headings which are in the user language
147 $r = Html::openElement(
'div',
$attribs ) . $r .
'</div>';
153 $this->articles = [];
154 $this->articles_start_char = [];
155 $this->children = [];
156 $this->children_start_char = [];
157 if ( $this->showGallery ) {
159 $mode = $this->
getRequest()->getVal(
'gallerymode',
null );
162 }
catch ( Exception
$e ) {
167 $this->gallery->setHideBadImages();
169 $this->imgsNoGallery = [];
170 $this->imgsNoGallery_start_char = [];
191 $this->children_start_char[] =
198 if (
$link ===
null ) {
199 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
200 if (
$html !==
null ) {
206 $link =
'<span class="redirect-in-category">' .
$link .
'</span>';
232 $firstChar = $this->collation->getFirstLetter( $word );
246 if ( $this->showGallery ) {
247 $flip = $this->flip[
'file'];
249 $this->gallery->insert(
$title );
251 $this->gallery->add(
$title );
254 $this->imgsNoGallery[] = $this->
generateLink(
'image', $title, $isRedirect );
256 $this->imgsNoGallery_start_char[] =
$wgContLang->convert(
257 $this->collation->getFirstLetter( $sortkey ) );
273 $this->articles_start_char[] =
$wgContLang->convert(
274 $this->collation->getFirstLetter( $sortkey ) );
278 if ( $this->flip[
'subcat'] ) {
279 $this->children = array_reverse( $this->children );
280 $this->children_start_char = array_reverse( $this->children_start_char );
282 if ( $this->flip[
'page'] ) {
283 $this->articles = array_reverse( $this->articles );
284 $this->articles_start_char = array_reverse( $this->articles_start_char );
286 if ( !$this->showGallery && $this->flip[
'file'] ) {
287 $this->imgsNoGallery = array_reverse( $this->imgsNoGallery );
288 $this->imgsNoGallery_start_char = array_reverse( $this->imgsNoGallery_start_char );
306 $this->flip = [
'page' =>
false,
'subcat' =>
false,
'file' =>
false ];
308 foreach ( [
'page',
'subcat',
'file' ]
as $type ) {
309 # Get the sortkeys for start/end, if applicable. Note that if
310 # the collation in the database differs from the one
311 # set in $wgCategoryCollation, pagination might go totally haywire.
312 $extraConds = [
'cl_type' =>
$type ];
314 $extraConds[] =
'cl_sortkey >= '
315 .
$dbr->addQuotes( $this->collation->getSortKey( $this->from[
$type] ) );
316 } elseif ( isset( $this->until[
$type] ) && $this->until[
$type] !==
null ) {
317 $extraConds[] =
'cl_sortkey < '
318 .
$dbr->addQuotes( $this->collation->getSortKey( $this->until[
$type] ) );
319 $this->flip[
$type] =
true;
323 [
'page',
'categorylinks',
'category' ],
325 LinkCache::getSelectFields(),
339 array_merge( [
'cl_to' => $this->
title->getDBkey() ], $extraConds ),
342 'USE INDEX' => [
'categorylinks' =>
'cl_sortkey' ],
343 'LIMIT' => $this->limit + 1,
344 'ORDER BY' => $this->flip[
$type] ?
'cl_sortkey DESC' :
'cl_sortkey',
347 'categorylinks' => [
'INNER JOIN',
'cl_from = page_id' ],
348 'category' => [
'LEFT JOIN', [
349 'cat_title = page_title',
355 Hooks::run(
'CategoryViewer::doCategoryQuery', [
$type,
$res ] );
356 $linkCache = MediaWikiServices::getInstance()->getLinkCache();
359 foreach (
$res as $row ) {
360 $title = Title::newFromRow( $row );
361 $linkCache->addGoodLinkObjFromRow(
$title, $row );
363 if ( $row->cl_collation ===
'' ) {
367 $humanSortkey = $row->cl_sortkey;
372 if ( ++$count > $this->limit ) {
373 # We've reached the one extra which shows that there
374 # are additional pages to be had. Stop here...
375 $this->nextPage[
$type] = $humanSortkey;
378 if ( $count == $this->limit ) {
379 $this->prevPage[
$type] = $humanSortkey;
386 $this->
addImage(
$title, $humanSortkey, $row->page_len, $row->page_is_redirect );
388 $this->
addPage(
$title, $humanSortkey, $row->page_len, $row->page_is_redirect );
401 :
"<br style=\"clear:both;\"/>\n" . $r;
408 # Don't show subcategories section if there are none.
410 $rescnt = count( $this->children );
411 $dbcnt = $this->cat->getSubcatCount();
416 # Showing subcategories
417 $r .=
"<div id=\"mw-subcategories\">\n";
418 $r .=
'<h2>' . $this->
msg(
'subcategories' )->parse() .
"</h2>\n";
421 $r .= $this->
formatList( $this->children, $this->children_start_char );
433 # Don't show articles section if there are none.
436 # @todo FIXME: Here and in the other two sections: we don't need to bother
437 # with this rigmarole if the entire category contents fit on one page
438 # and have already been retrieved. We can just use $rescnt in that
439 # case and save a query and some logic.
440 $dbcnt = $this->cat->getPageCount() - $this->cat->getSubcatCount()
441 - $this->cat->getFileCount();
442 $rescnt = count( $this->articles );
447 $r =
"<div id=\"mw-pages\">\n";
448 $r .=
'<h2>' . $this->
msg(
'category_header', $ti )->parse() .
"</h2>\n";
451 $r .= $this->
formatList( $this->articles, $this->articles_start_char );
463 $rescnt = $this->showGallery ? $this->gallery->count() : count( $this->imgsNoGallery );
464 $dbcnt = $this->cat->getFileCount();
469 $r .=
"<div id=\"mw-category-media\">\n";
472 'category-media-header',
478 if ( $this->showGallery ) {
479 $r .= $this->gallery->toHTML();
481 $r .= $this->
formatList( $this->imgsNoGallery, $this->imgsNoGallery_start_char );
497 if ( isset( $this->until[
$type] ) && $this->until[
$type] !==
null ) {
502 if ( $this->nextPage[
$type] !==
null ) {
509 } elseif ( $this->nextPage[
$type] !==
null
544 $pageLang = $this->
title->getPageLanguage();
545 $attribs = [
'lang' => $pageLang->getHtmlCode(),
'dir' => $pageLang->getDir(),
546 'class' =>
'mw-content-' . $pageLang->getDir() ];
547 $list = Html::rawElement(
'div',
$attribs, $list );
569 $ret = Html::openElement(
'div', [
'class' =>
'mw-category' ] );
573 # Kind of like array_flip() here, but we keep duplicates in an
574 # array instead of dropping them.
576 if ( !isset( $colContents[$char] ) ) {
577 $colContents[$char] = [];
583 # Change space to non-breaking space to keep headers aligned
584 $h3char = $char ===
' ' ?
' ' : htmlspecialchars( $char );
586 $ret .=
'<div class="mw-category-group"><h3>' . $h3char;
591 $ret .=
'</li></ul></div>';
595 $ret .= Html::closeElement(
'div' );
609 $r .=
'<ul><li>' .
$articles[0] .
'</li>';
611 for ( $index = 1; $index < $articleCount; $index++ ) {
616 $r .=
"<li>{$articles[$index]}</li>";
632 $prevLink = $this->
msg(
'prev-page' )->text();
634 $linkRenderer = MediaWikiServices::getInstance()->getLinkRenderer();
635 if ( $first !=
'' ) {
637 $prevQuery[
"{$type}until"] = $first;
638 unset( $prevQuery[
"{$type}from"] );
647 $nextLink = $this->
msg(
'next-page' )->text();
651 $lastQuery[
"{$type}from"] =
$last;
652 unset( $lastQuery[
"{$type}until"] );
661 return $this->
msg(
'categoryviewer-pagedlinks' )->rawParams( $prevLink, $nextLink )->escaped();
676 $fragment =
'mw-pages';
679 $fragment =
'mw-subcategories';
682 $fragment =
'mw-category-media';
686 " Invalid section $section." );
718 if (
$type ===
'article' ) {
719 $pagingType =
'page';
724 $fromOrUntil =
false;
725 if ( ( isset( $this->
from[$pagingType] ) && $this->
from[$pagingType] !==
null ) ||
726 ( isset( $this->until[$pagingType] ) && $this->until[$pagingType] !==
null )
731 if ( $dbcnt == $rescnt ||
732 ( ( $rescnt == $this->limit || $fromOrUntil ) && $dbcnt > $rescnt )
736 } elseif ( $rescnt < $this->limit && !$fromOrUntil ) {
742 DeferredUpdates::addCallableUpdate( [ $this->cat,
'refreshCounts' ] );
747 return $this->
msg(
"category-$type-count-limited" )->numParams( $rescnt )->parseAsBlock();
750 return $this->
msg(
"category-$type-count" )->numParams( $rescnt, $totalcnt )->parseAsBlock();
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation and configuration files Object form shall mean any form resulting from mechanical transformation or translation of a Source including but not limited to compiled object generated and conversions to other media types Work shall mean the work of whether in Source or Object made available under the as indicated by a copyright notice that is included in or attached to the whether in Source or Object that is based or other modifications as a an original work of authorship For the purposes of this Derivative Works shall not include works that remain separable from
to move a page</td >< td > &*You are moving the page across *A non empty talk page already exists under the new or *You uncheck the box below In those you will have to move or merge the page manually if desired</td >< td > be sure to &You are responsible for making sure that links continue to point where they are supposed to go Note that the page will &a page at the new title
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
wfEscapeWikiText( $text)
Escapes the given text so that it may be output using addWikiText() without any linking,...
getCountMessage( $rescnt, $dbcnt, $type)
What to do if the category table conflicts with the number of results returned? This function says wh...
array $articles_start_char
array $children_start_char
pagingLinks( $first, $last, $type='')
Create paging links, as a helper method to getSectionPagingLinks().
getSectionPagingLinks( $type)
Get the paging links for a section (subcats/pages/files), to go at the top and bottom of the output.
Category $cat
Category object for this page.
__construct( $title, IContextSource $context, $from=[], $until=[], $query=[])
addPage( $title, $sortkey, $pageLength, $isRedirect=false)
Add a miscellaneous page.
ImageGalleryBase $gallery
addSubcategoryObject(Category $cat, $sortkey, $pageLength)
Add a subcategory to the internal lists, using a Category object.
formatList( $articles, $articles_start_char, $cutoff=6)
Format a list of articles chunked by letter, either as a bullet list or a columnar format,...
addImage(Title $title, $sortkey, $pageLength, $isRedirect=false)
Add a page in the image namespace.
static columnList( $articles, $articles_start_char)
Format a list of articles chunked by letter in a three-column list, ordered vertically.
getSubcategorySortChar( $title, $sortkey)
Get the character to be used for sorting subcategories.
getHTML()
Format the category data list.
addFragmentToTitle( $title, $section)
Takes a title, and adds the fragment identifier that corresponds to the correct segment of the catego...
array $imgsNoGallery_start_char
generateLink( $type, Title $title, $isRedirect, $html=null)
array $query
The original query array, to be used in generating paging links.
static shortList( $articles, $articles_start_char)
Format a list of articles chunked by letter in a bullet list.
Category objects are immutable, strictly speaking.
The simplest way of implementing IContextSource is to hold a RequestContext as a member variable and ...
msg( $key)
Get a Message object with context set Parameters are the same as wfMessage()
getRequest()
Get the WebRequest object.
getConfig()
Get the Config object.
getOutput()
Get the OutputPage object.
getLanguage()
Get the Language object.
getContext()
Get the base IContextSource object.
setContext(IContextSource $context)
Set the IContextSource object.
Marks HTML that shouldn't be escaped.
static factory( $mode=false, IContextSource $context=null)
Get a new image gallery.
Represents a title within MediaWiki.
getNamespace()
Get the namespace index, i.e.
getDBkey()
Get the main part with underscores.
getText()
Get the text form (spaces not underscores) of the main part.
isRedirect( $flags=0)
Is this an article that is a redirect page? Uses link cache, adding it if necessary.
getPrefixedText()
Get the prefixed title with spaces.
getCategorySortkey( $prefix='')
Returns the raw sort key to be used for categories, with the specified prefix.
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
when a variable name is used in a it is silently declared as a new local masking the global
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
the array() calling protocol came about after MediaWiki 1.4rc1.
Using a hook running we can avoid having all this option specific stuff in our mainline code Using the function array $article
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 & $ret
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
usually copyright or history_copyright This message must be in HTML not wikitext & $link
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 after processing & $attribs
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 after processing after in associative array form before processing starts Return false to skip default processing and return $ret $linkRenderer
usually copyright or history_copyright This message must be in HTML not wikitext if the section is included from a template $section
processing should stop and the error should be shown to the user * false
returning false will NOT prevent logging $e
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
Interface for objects which can provide a MediaWiki context on request.
getConfig()
Get the site configuration.
if(!isset( $args[0])) $lang