Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 32 |
|
0.00% |
0 / 9 |
CRAP | |
0.00% |
0 / 1 |
SpecialUnusedCategories | |
0.00% |
0 / 31 |
|
0.00% |
0 / 9 |
90 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
isExpensive | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getPageHeader | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getOrderFields | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getQueryInfo | |
0.00% |
0 / 20 |
|
0.00% |
0 / 1 |
2 | |||
sortDescending | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
formatResult | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getGroupName | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
preprocessResults | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | /** |
3 | * Implements Special:Unusedcategories |
4 | * |
5 | * This program is free software; you can redistribute it and/or modify |
6 | * it under the terms of the GNU General Public License as published by |
7 | * the Free Software Foundation; either version 2 of the License, or |
8 | * (at your option) any later version. |
9 | * |
10 | * This program is distributed in the hope that it will be useful, |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | * GNU General Public License for more details. |
14 | * |
15 | * You should have received a copy of the GNU General Public License along |
16 | * with this program; if not, write to the Free Software Foundation, Inc., |
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
18 | * http://www.gnu.org/copyleft/gpl.html |
19 | * |
20 | * @file |
21 | * @ingroup SpecialPage |
22 | */ |
23 | |
24 | namespace MediaWiki\Specials; |
25 | |
26 | use MediaWiki\Cache\LinkBatchFactory; |
27 | use MediaWiki\SpecialPage\QueryPage; |
28 | use MediaWiki\Title\Title; |
29 | use Skin; |
30 | use stdClass; |
31 | use Wikimedia\Rdbms\IConnectionProvider; |
32 | |
33 | /** |
34 | * @ingroup SpecialPage |
35 | */ |
36 | class SpecialUnusedCategories extends QueryPage { |
37 | |
38 | /** |
39 | * @param IConnectionProvider $dbProvider |
40 | * @param LinkBatchFactory $linkBatchFactory |
41 | */ |
42 | public function __construct( |
43 | IConnectionProvider $dbProvider, |
44 | LinkBatchFactory $linkBatchFactory |
45 | ) { |
46 | parent::__construct( 'Unusedcategories' ); |
47 | $this->setDatabaseProvider( $dbProvider ); |
48 | $this->setLinkBatchFactory( $linkBatchFactory ); |
49 | } |
50 | |
51 | public function isExpensive() { |
52 | return true; |
53 | } |
54 | |
55 | protected function getPageHeader() { |
56 | return $this->msg( 'unusedcategoriestext' )->parseAsBlock(); |
57 | } |
58 | |
59 | protected function getOrderFields() { |
60 | return [ 'title' ]; |
61 | } |
62 | |
63 | public function getQueryInfo() { |
64 | return [ |
65 | 'tables' => [ 'page', 'categorylinks', 'page_props' ], |
66 | 'fields' => [ |
67 | 'namespace' => 'page_namespace', |
68 | 'title' => 'page_title', |
69 | ], |
70 | 'conds' => [ |
71 | 'cl_from' => null, |
72 | 'page_namespace' => NS_CATEGORY, |
73 | 'page_is_redirect' => 0, |
74 | 'pp_page' => null, |
75 | ], |
76 | 'join_conds' => [ |
77 | 'categorylinks' => [ 'LEFT JOIN', 'cl_to = page_title' ], |
78 | 'page_props' => [ 'LEFT JOIN', [ |
79 | 'page_id = pp_page', |
80 | 'pp_propname' => 'expectunusedcategory' |
81 | ] ] |
82 | ] |
83 | ]; |
84 | } |
85 | |
86 | /** |
87 | * A should come before Z (T32907) |
88 | * @return bool |
89 | */ |
90 | protected function sortDescending() { |
91 | return false; |
92 | } |
93 | |
94 | /** |
95 | * @param Skin $skin |
96 | * @param stdClass $result Result row |
97 | * @return string |
98 | */ |
99 | public function formatResult( $skin, $result ) { |
100 | $title = Title::makeTitle( NS_CATEGORY, $result->title ); |
101 | |
102 | return $this->getLinkRenderer()->makeLink( $title, $title->getText() ); |
103 | } |
104 | |
105 | protected function getGroupName() { |
106 | return 'maintenance'; |
107 | } |
108 | |
109 | public function preprocessResults( $db, $res ) { |
110 | $this->executeLBFromResultWrapper( $res ); |
111 | } |
112 | } |
113 | |
114 | /** |
115 | * Retain the old class name for backwards compatibility. |
116 | * @deprecated since 1.41 |
117 | */ |
118 | class_alias( SpecialUnusedCategories::class, 'SpecialUnusedCategories' ); |