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