MediaWiki master
TemplateLinksTable.php
Go to the documentation of this file.
1<?php
2
4
7
14 public function setParserOutput( ParserOutput $parserOutput ) {
15 // Convert the format of the template links
16 $this->newLinks = [];
17 foreach (
18 $parserOutput->getLinkList( ParserOutputLinkTypes::TEMPLATE )
19 as [ 'link' => $link, 'pageid' => $pageid ]
20 ) {
21 $this->newLinks[$link->getNamespace()][$link->getDBkey()] = $pageid;
22 }
23 }
24
26 protected function getTableName() {
27 return 'templatelinks';
28 }
29
31 protected function getFromField() {
32 return 'tl_from';
33 }
34
36 protected function getFromNamespaceField() {
37 return 'tl_from_namespace';
38 }
39
41 protected function getTargetIdField() {
42 return 'tl_target_id';
43 }
44
46 protected function virtualDomain() {
48 }
49}
Shared code for pagelinks, templatelinks and existencelinks.
virtualDomain()
What virtual domain should be used to read/write from the table.string|bool
setParserOutput(ParserOutput $parserOutput)
Subclasses should implement this to extract the data they need from the ParserOutput.
getFromField()
Get the name of the field which links to page_id.string
getTargetIdField()
Get the link target id (DB key) field name.string
ParserOutput is a rendering of a Content object or a message.
getLinkList(string|ParserOutputLinkTypes $linkType, ?int $onlyNamespace=null)
Get a list of links of the given type.