MediaWiki REL1_31
SpecialUncategorizedcategories.php
Go to the documentation of this file.
1<?php
35 private $exceptionList = null;
36
37 function __construct( $name = 'Uncategorizedcategories' ) {
38 parent::__construct( $name );
39 $this->requestedNamespace = NS_CATEGORY;
40 }
41
48 private function getExceptionList() {
49 if ( $this->exceptionList === null ) {
50 $exList = $this->msg( 'uncategorized-categories-exceptionlist' )
51 ->inContentLanguage()->plain();
52 $proposedTitles = explode( "\n", $exList );
53 foreach ( $proposedTitles as $count => $titleStr ) {
54 if ( strpos( $titleStr, '*' ) !== 0 ) {
55 continue;
56 }
57 $titleStr = preg_replace( "/^\\*\\s*/", '', $titleStr );
58 $title = Title::newFromText( $titleStr, NS_CATEGORY );
59 if ( $title && $title->getNamespace() !== NS_CATEGORY ) {
60 $title = Title::makeTitleSafe( NS_CATEGORY, $titleStr );
61 }
62 if ( $title ) {
63 $this->exceptionList[] = $title->getDBkey();
64 }
65 }
66 }
68 }
69
70 public function getQueryInfo() {
72 $query = parent::getQueryInfo();
74 if ( $exceptionList ) {
75 $query['conds'][] = 'page_title not in ( ' . $dbr->makeList( $exceptionList ) . ' )';
76 }
77
78 return $query;
79 }
80
87 function formatResult( $skin, $result ) {
88 $title = Title::makeTitle( NS_CATEGORY, $result->title );
89 $text = $title->getText();
90
91 return $this->getLinkRenderer()->makeKnownLink( $title, $text );
92 }
93}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
msg( $key)
Wrapper around wfMessage that sets the current context.
A special page that lists uncategorized categories.
__construct( $name='Uncategorizedcategories')
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
array $exceptionList
Holds a list of categories, which shouldn't be listed on this special page, even if it is uncategoriz...
getExceptionList()
Returns an array of category titles (usually without the namespace), which shouldn't be listed on thi...
formatResult( $skin, $result)
Formats the result.
A special page looking for page without any category.
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
Definition hooks.txt:1620
const NS_CATEGORY
Definition Defines.php:88
const DB_REPLICA
Definition defines.php:25