Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
81.82% |
9 / 11 |
|
75.00% |
6 / 8 |
CRAP | |
0.00% |
0 / 1 |
TemplateLinksTable | |
81.82% |
9 / 11 |
|
75.00% |
6 / 8 |
9.49 | |
0.00% |
0 / 1 |
setParserOutput | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
2 | |||
getTableName | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getFromField | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getNamespaceField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTitleField | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFromNamespaceField | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTargetIdField | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
linksTargetNormalizationStage | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Deferred\LinksUpdate; |
4 | |
5 | use LogicException; |
6 | use MediaWiki\Parser\ParserOutput; |
7 | use MediaWiki\Parser\ParserOutputLinkTypes; |
8 | |
9 | /** |
10 | * templatelinks |
11 | * |
12 | * @since 1.38 |
13 | */ |
14 | class TemplateLinksTable extends GenericPageLinksTable { |
15 | public function setParserOutput( ParserOutput $parserOutput ) { |
16 | // Convert the format of the template links |
17 | $this->newLinks = []; |
18 | foreach ( |
19 | $parserOutput->getLinkList( ParserOutputLinkTypes::TEMPLATE ) |
20 | as [ 'link' => $link, 'pageid' => $pageid ] |
21 | ) { |
22 | $this->newLinks[$link->getNamespace()][$link->getDBkey()] = $pageid; |
23 | } |
24 | } |
25 | |
26 | protected function getTableName() { |
27 | return 'templatelinks'; |
28 | } |
29 | |
30 | protected function getFromField() { |
31 | return 'tl_from'; |
32 | } |
33 | |
34 | protected function getNamespaceField() { |
35 | // @phan-suppress-previous-line PhanPluginNeverReturnMethod |
36 | throw new LogicException( 'not supported' ); |
37 | } |
38 | |
39 | protected function getTitleField() { |
40 | // @phan-suppress-previous-line PhanPluginNeverReturnMethod |
41 | throw new LogicException( 'not supported' ); |
42 | } |
43 | |
44 | protected function getFromNamespaceField() { |
45 | return 'tl_from_namespace'; |
46 | } |
47 | |
48 | protected function getTargetIdField() { |
49 | return 'tl_target_id'; |
50 | } |
51 | |
52 | /** |
53 | * Normalization stage of the links table (see T222224) |
54 | * @return int |
55 | */ |
56 | protected function linksTargetNormalizationStage(): int { |
57 | return MIGRATION_NEW; |
58 | } |
59 | } |