Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 32 |
|
0.00% |
0 / 8 |
CRAP | |
0.00% |
0 / 1 |
SpecialDeadendPages | |
0.00% |
0 / 31 |
|
0.00% |
0 / 8 |
90 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 5 |
|
0.00% |
0 / 1 |
2 | |||
getPageHeader | |
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 | |||
sortDescending | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getQueryInfo | |
0.00% |
0 / 18 |
|
0.00% |
0 / 1 |
2 | |||
getOrderFields | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
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 that contain no links to other pages. |
31 | * |
32 | * @ingroup SpecialPage |
33 | */ |
34 | class SpecialDeadendPages extends PageQueryPage { |
35 | |
36 | private NamespaceInfo $namespaceInfo; |
37 | |
38 | /** |
39 | * @param NamespaceInfo $namespaceInfo |
40 | * @param IConnectionProvider $dbProvider |
41 | * @param LinkBatchFactory $linkBatchFactory |
42 | * @param LanguageConverterFactory $languageConverterFactory |
43 | */ |
44 | public function __construct( |
45 | NamespaceInfo $namespaceInfo, |
46 | IConnectionProvider $dbProvider, |
47 | LinkBatchFactory $linkBatchFactory, |
48 | LanguageConverterFactory $languageConverterFactory |
49 | ) { |
50 | parent::__construct( 'Deadendpages' ); |
51 | $this->namespaceInfo = $namespaceInfo; |
52 | $this->setDatabaseProvider( $dbProvider ); |
53 | $this->setLinkBatchFactory( $linkBatchFactory ); |
54 | $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) ); |
55 | } |
56 | |
57 | protected function getPageHeader() { |
58 | return $this->msg( 'deadendpagestext' )->parseAsBlock(); |
59 | } |
60 | |
61 | /** |
62 | * LEFT JOIN is expensive |
63 | * |
64 | * @return bool |
65 | */ |
66 | public function isExpensive() { |
67 | return true; |
68 | } |
69 | |
70 | public function isSyndicated() { |
71 | return false; |
72 | } |
73 | |
74 | /** |
75 | * @return bool |
76 | */ |
77 | protected function sortDescending() { |
78 | return false; |
79 | } |
80 | |
81 | public function getQueryInfo() { |
82 | return [ |
83 | 'tables' => [ 'page', 'pagelinks' ], |
84 | 'fields' => [ |
85 | 'namespace' => 'page_namespace', |
86 | 'title' => 'page_title', |
87 | ], |
88 | 'conds' => [ |
89 | 'pl_from' => null, |
90 | 'page_namespace' => $this->namespaceInfo->getContentNamespaces(), |
91 | 'page_is_redirect' => 0 |
92 | ], |
93 | 'join_conds' => [ |
94 | 'pagelinks' => [ |
95 | 'LEFT JOIN', |
96 | [ 'page_id=pl_from' ] |
97 | ] |
98 | ] |
99 | ]; |
100 | } |
101 | |
102 | protected function getOrderFields() { |
103 | // For some crazy reason ordering by a constant |
104 | // causes a filesort |
105 | if ( count( $this->namespaceInfo->getContentNamespaces() ) > 1 ) { |
106 | return [ 'page_namespace', 'page_title' ]; |
107 | } else { |
108 | return [ 'page_title' ]; |
109 | } |
110 | } |
111 | |
112 | protected function getGroupName() { |
113 | return 'maintenance'; |
114 | } |
115 | } |
116 | |
117 | /** @deprecated class alias since 1.41 */ |
118 | class_alias( SpecialDeadendPages::class, 'SpecialDeadendPages' ); |