Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 33 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
SpecialUncategorizedPages | |
0.00% |
0 / 32 |
|
0.00% |
0 / 8 |
132 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
sortDescending | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isExpensive | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
isSyndicated | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getQueryInfo | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
6 | |||
getOrderFields | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
12 | |||
getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * This program is free software; you can redistribute it and/or modify |
4 | * it under the terms of the GNU General Public License as published by |
5 | * the Free Software Foundation; either version 2 of the License, or |
6 | * (at your option) any later version. |
7 | * |
8 | * This program is distributed in the hope that it will be useful, |
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
11 | * GNU General Public License for more details. |
12 | * |
13 | * You should have received a copy of the GNU General Public License along |
14 | * with this program; if not, write to the Free Software Foundation, Inc., |
15 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
16 | * http://www.gnu.org/copyleft/gpl.html |
17 | * |
18 | * @file |
19 | */ |
20 | |
21 | namespace MediaWiki\Specials; |
22 | |
23 | use MediaWiki\Cache\LinkBatchFactory; |
24 | use MediaWiki\Languages\LanguageConverterFactory; |
25 | use MediaWiki\SpecialPage\PageQueryPage; |
26 | use MediaWiki\Title\NamespaceInfo; |
27 | use Wikimedia\Rdbms\IConnectionProvider; |
28 | |
29 | /** |
30 | * List of pages without any category. |
31 | * |
32 | * @todo FIXME: Make $requestedNamespace selectable, unify all subclasses into one |
33 | * |
34 | * @ingroup SpecialPage |
35 | */ |
36 | class SpecialUncategorizedPages extends PageQueryPage { |
37 | /** @var int|false */ |
38 | protected $requestedNamespace = false; |
39 | |
40 | private NamespaceInfo $namespaceInfo; |
41 | |
42 | /** |
43 | * @param NamespaceInfo $namespaceInfo |
44 | * @param IConnectionProvider $dbProvider |
45 | * @param LinkBatchFactory $linkBatchFactory |
46 | * @param LanguageConverterFactory $languageConverterFactory |
47 | */ |
48 | public function __construct( |
49 | NamespaceInfo $namespaceInfo, |
50 | IConnectionProvider $dbProvider, |
51 | LinkBatchFactory $linkBatchFactory, |
52 | LanguageConverterFactory $languageConverterFactory |
53 | ) { |
54 | parent::__construct( 'Uncategorizedpages' ); |
55 | $this->namespaceInfo = $namespaceInfo; |
56 | $this->setDatabaseProvider( $dbProvider ); |
57 | $this->setLinkBatchFactory( $linkBatchFactory ); |
58 | $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) ); |
59 | } |
60 | |
61 | protected function sortDescending() { |
62 | return false; |
63 | } |
64 | |
65 | public function isExpensive() { |
66 | return true; |
67 | } |
68 | |
69 | public function isSyndicated() { |
70 | return false; |
71 | } |
72 | |
73 | public function execute( $par ) { |
74 | $this->addHelpLink( 'Help:Categories' ); |
75 | parent::execute( $par ); |
76 | } |
77 | |
78 | public function getQueryInfo() { |
79 | return [ |
80 | 'tables' => [ 'page', 'categorylinks' ], |
81 | 'fields' => [ |
82 | 'namespace' => 'page_namespace', |
83 | 'title' => 'page_title', |
84 | ], |
85 | // default for page_namespace is all content namespaces (if requestedNamespace is false) |
86 | // otherwise, page_namespace is requestedNamespace |
87 | 'conds' => [ |
88 | 'cl_from' => null, |
89 | 'page_namespace' => $this->requestedNamespace !== false |
90 | ? $this->requestedNamespace |
91 | : $this->namespaceInfo->getContentNamespaces(), |
92 | 'page_is_redirect' => 0 |
93 | ], |
94 | 'join_conds' => [ |
95 | 'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ] |
96 | ] |
97 | ]; |
98 | } |
99 | |
100 | protected function getOrderFields() { |
101 | // For some crazy reason ordering by a constant |
102 | // causes a filesort |
103 | if ( $this->requestedNamespace === false && |
104 | count( $this->namespaceInfo->getContentNamespaces() ) > 1 |
105 | ) { |
106 | return [ 'page_namespace', 'page_title' ]; |
107 | } |
108 | |
109 | return [ 'page_title' ]; |
110 | } |
111 | |
112 | protected function getGroupName() { |
113 | return 'maintenance'; |
114 | } |
115 | } |
116 | |
117 | /** |
118 | * Retain the old class name for backwards compatibility. |
119 | * @deprecated since 1.41 |
120 | */ |
121 | class_alias( SpecialUncategorizedPages::class, 'SpecialUncategorizedPages' ); |