Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 28 |
|
0.00% |
0 / 10 |
CRAP | |
0.00% |
0 / 1 |
SpecialDisambiguationPages | |
0.00% |
0 / 28 |
|
0.00% |
0 / 10 |
110 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 3 |
|
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 | |||
getQueryInfo | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
2 | |||
execute | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getOrderFields | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
sortDescending | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
preprocessResults | |
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 |
1 | <?php |
2 | /** |
3 | * DisambiguationPages SpecialPage for Disambiguator extension |
4 | * This page lists all the disambiguation pages |
5 | * |
6 | * @file |
7 | * @ingroup Extensions |
8 | */ |
9 | |
10 | namespace MediaWiki\Extension\Disambiguator\Specials; |
11 | |
12 | use MediaWiki\Cache\LinkBatchFactory; |
13 | use MediaWiki\SpecialPage\QueryPage; |
14 | use MediaWiki\Title\Title; |
15 | use Wikimedia\Rdbms\IDatabase; |
16 | use Wikimedia\Rdbms\ILoadBalancer; |
17 | use Wikimedia\Rdbms\IResultWrapper; |
18 | |
19 | class SpecialDisambiguationPages extends QueryPage { |
20 | |
21 | /** |
22 | * @param LinkBatchFactory $linkBatchFactory |
23 | * @param ILoadBalancer $loadBalancer |
24 | */ |
25 | public function __construct( |
26 | LinkBatchFactory $linkBatchFactory, |
27 | ILoadBalancer $loadBalancer |
28 | ) { |
29 | parent::__construct( 'DisambiguationPages' ); |
30 | $this->setLinkBatchFactory( $linkBatchFactory ); |
31 | $this->setDBLoadBalancer( $loadBalancer ); |
32 | } |
33 | |
34 | public function isExpensive() { |
35 | return false; |
36 | } |
37 | |
38 | public function isSyndicated() { |
39 | return false; |
40 | } |
41 | |
42 | public function getQueryInfo() { |
43 | return [ |
44 | 'tables' => [ |
45 | 'page', |
46 | 'page_props' |
47 | ], |
48 | 'fields' => [ |
49 | 'value' => 'pp_page', |
50 | 'namespace' => 'page_namespace', |
51 | 'title' => 'page_title', |
52 | ], |
53 | 'conds' => [ |
54 | 'page_id = pp_page', |
55 | 'pp_propname' => 'disambiguation', |
56 | ] |
57 | ]; |
58 | } |
59 | |
60 | public function execute( $par ) { |
61 | $this->addHelpLink( 'Extension:Disambiguator' ); |
62 | parent::execute( $par ); |
63 | } |
64 | |
65 | /** |
66 | * Order the results by page ID. |
67 | * We don't sort by namespace and title since this would trigger a filesort. |
68 | * @return array |
69 | */ |
70 | public function getOrderFields() { |
71 | return [ 'value' ]; |
72 | } |
73 | |
74 | public function sortDescending() { |
75 | return false; |
76 | } |
77 | |
78 | /** |
79 | * @param IDatabase $db |
80 | * @param IResultWrapper $res |
81 | */ |
82 | public function preprocessResults( $db, $res ) { |
83 | $this->executeLBFromResultWrapper( $res ); |
84 | } |
85 | |
86 | public function formatResult( $skin, $result ) { |
87 | $title = Title::makeTitle( $result->namespace, $result->title ); |
88 | return $this->getLinkRenderer()->makeKnownLink( $title ); |
89 | } |
90 | |
91 | protected function getGroupName() { |
92 | return 'pages'; |
93 | } |
94 | } |