MediaWiki
REL1_37
SpecialUncategorizedCategories.php
Go to the documentation of this file.
1
<?php
24
use
MediaWiki\Cache\LinkBatchFactory
;
25
use
MediaWiki\Languages\LanguageConverterFactory
;
26
use
Wikimedia\Rdbms\ILoadBalancer
;
27
33
class
SpecialUncategorizedCategories
extends
SpecialUncategorizedPages
{
39
private
$exceptionList
=
null
;
40
47
public
function
__construct
(
48
NamespaceInfo
$namespaceInfo
,
49
ILoadBalancer
$loadBalancer
,
50
LinkBatchFactory
$linkBatchFactory
,
51
LanguageConverterFactory
$languageConverterFactory
52
) {
53
parent::__construct(
54
$namespaceInfo
,
55
$loadBalancer
,
56
$linkBatchFactory
,
57
$languageConverterFactory
58
);
59
$this->mName =
'Uncategorizedcategories'
;
60
$this->requestedNamespace =
NS_CATEGORY
;
61
}
62
69
private
function
getExceptionList
() {
70
if
( $this->exceptionList ===
null
) {
71
$this->exceptionList = [];
72
$exList = $this->
msg
(
'uncategorized-categories-exceptionlist'
)
73
->inContentLanguage()->plain();
74
$proposedTitles = explode(
"\n"
, $exList );
75
foreach
( $proposedTitles as $count => $titleStr ) {
76
if
( strpos( $titleStr,
'*'
) !== 0 ) {
77
continue
;
78
}
79
$titleStr = preg_replace(
"/^\\*\\s*/"
,
''
, $titleStr );
80
$title
= Title::newFromText( $titleStr,
NS_CATEGORY
);
81
if
(
$title
&&
$title
->getNamespace() !==
NS_CATEGORY
) {
82
$title
= Title::makeTitleSafe(
NS_CATEGORY
, $titleStr );
83
}
84
if
(
$title
) {
85
$this->exceptionList[] =
$title
->getDBkey();
86
}
87
}
88
}
89
return
$this->exceptionList
;
90
}
91
92
public
function
getQueryInfo
() {
93
$query = parent::getQueryInfo();
94
$exceptionList
= $this->
getExceptionList
();
95
if
(
$exceptionList
) {
96
$dbr
= $this->
getDBLoadBalancer
()->getConnectionRef( ILoadBalancer::DB_REPLICA );
97
$query[
'conds'
][] =
'page_title not in ( '
.
$dbr
->makeList(
$exceptionList
) .
' )'
;
98
}
99
100
return
$query;
101
}
102
109
public
function
formatResult
( $skin, $result ) {
110
$title
= Title::makeTitle(
NS_CATEGORY
, $result->title );
111
$text =
$title
->getText();
112
113
return
$this->
getLinkRenderer
()->makeKnownLink(
$title
, $text );
114
}
115
}
NS_CATEGORY
const NS_CATEGORY
Definition
Defines.php:78
MediaWiki\Cache\LinkBatchFactory
Definition
LinkBatchFactory.php:39
MediaWiki\Languages\LanguageConverterFactory
An interface for creating language converters.
Definition
LanguageConverterFactory.php:46
NamespaceInfo
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Definition
NamespaceInfo.php:35
QueryPage\$linkBatchFactory
LinkBatchFactory null $linkBatchFactory
Definition
QueryPage.php:74
QueryPage\getDBLoadBalancer
getDBLoadBalancer()
Definition
QueryPage.php:900
QueryPage\$loadBalancer
ILoadBalancer null $loadBalancer
Definition
QueryPage.php:71
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition
SpecialPage.php:1028
SpecialPage\msg
msg( $key,... $params)
Wrapper around wfMessage that sets the current context.
Definition
SpecialPage.php:912
SpecialUncategorizedCategories
A special page that lists uncategorized categories.
Definition
SpecialUncategorizedCategories.php:33
SpecialUncategorizedCategories\formatResult
formatResult( $skin, $result)
Formats the result.
Definition
SpecialUncategorizedCategories.php:109
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:39
SpecialUncategorizedCategories\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition
SpecialUncategorizedCategories.php:92
SpecialUncategorizedCategories\__construct
__construct(NamespaceInfo $namespaceInfo, ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
Definition
SpecialUncategorizedCategories.php:47
SpecialUncategorizedCategories\getExceptionList
getExceptionList()
Returns an array of category titles (usually without the namespace), which shouldn't be listed on thi...
Definition
SpecialUncategorizedCategories.php:69
SpecialUncategorizedPages
A special page looking for page without any category.
Definition
SpecialUncategorizedPages.php:34
SpecialUncategorizedPages\$namespaceInfo
NamespaceInfo $namespaceInfo
Definition
SpecialUncategorizedPages.php:39
Wikimedia\Rdbms\ILoadBalancer
Database cluster connection, tracking, load balancing, and transaction manager interface.
Definition
ILoadBalancer.php:81
$dbr
$dbr
Definition
testCompression.php:54
$title
$title
Definition
testCompression.php:38
includes
specials
SpecialUncategorizedCategories.php
Generated on Fri Apr 5 2024 23:41:00 for MediaWiki by
1.9.8