MediaWiki
master
Toggle main menu visibility
TemplateLinksTable.php
Go to the documentation of this file.
1
<?php
2
3
namespace
MediaWiki\Deferred\LinksUpdate;
4
5
use MediaWiki\Parser\ParserOutput;
6
use MediaWiki\Parser\ParserOutputLinkTypes;
7
13
class
TemplateLinksTable
extends
GenericPageLinksTable
{
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
() {
47
return
self::VIRTUAL_DOMAIN;
48
}
49
}
MediaWiki\Deferred\LinksUpdate\GenericPageLinksTable
Shared code for pagelinks, templatelinks and existencelinks.
Definition
GenericPageLinksTable.php:18
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable
templatelinks
Definition
TemplateLinksTable.php:13
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\getTableName
getTableName()
Get the table name.string
Definition
TemplateLinksTable.php:26
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\virtualDomain
virtualDomain()
What virtual domain should be used to read/write from the table.string|bool
Definition
TemplateLinksTable.php:46
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\getFromNamespaceField
getFromNamespaceField()
string|null
Definition
TemplateLinksTable.php:36
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\setParserOutput
setParserOutput(ParserOutput $parserOutput)
Subclasses should implement this to extract the data they need from the ParserOutput.
Definition
TemplateLinksTable.php:14
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\getFromField
getFromField()
Get the name of the field which links to page_id.string
Definition
TemplateLinksTable.php:31
MediaWiki\Deferred\LinksUpdate\TemplateLinksTable\getTargetIdField
getTargetIdField()
Get the link target id (DB key) field name.string
Definition
TemplateLinksTable.php:41
MediaWiki\Parser\ParserOutput
ParserOutput is a rendering of a Content object or a message.
Definition
ParserOutput.php:91
MediaWiki\Parser\ParserOutput\getLinkList
getLinkList(string|ParserOutputLinkTypes $linkType, ?int $onlyNamespace=null)
Get a list of links of the given type.
Definition
ParserOutput.php:699
includes
Deferred
LinksUpdate
TemplateLinksTable.php
Generated on
for MediaWiki by
1.18.0