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