Wikibase
MediaWiki Wikibase extension
Wikibase\Lib\Store\Sql\SiteLinkTable Class Reference

Represents a lookup database table for sitelinks. More...

+ Inheritance diagram for Wikibase\Lib\Store\Sql\SiteLinkTable:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\SiteLinkTable:

Public Member Functions

 __construct ( $table, $readonly, $wiki=false)
 
 saveLinksOfItem (Item $item)
 
 deleteLinksOfItem (ItemId $itemId)
 
 getItemIdForLink ( $globalSiteId, $pageTitle)
 
 getItemIdForSiteLink (SiteLink $siteLink)
 
 clear ()
 
 getLinks (array $numericIds=[], array $siteIds=[], array $pageNames=[])
 
 getSiteLinksForItem (ItemId $itemId)
 
 getEntityIdForLinkedTitle ( $globalSiteId, $pageTitle)
 

Protected Attributes

 $table
 
 $readonly
 

Private Member Functions

 diffSiteLinks (array $siteLinks1, array $siteLinks2)
 
 insertLinks (Item $item, array $links, IDatabase $dbw)
 
 deleteLinks (Item $item, array $links, IDatabase $dbw)
 

Private Attributes

 $logger
 

Detailed Description

Represents a lookup database table for sitelinks.

It should have these fields: ips_item_id, ips_site_id, ips_site_page.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\SiteLinkTable::__construct (   $table,
  $readonly,
  $wiki = false 
)
Parameters
string$tableThe table to use for the sitelinks
bool$readonlyWhether the table can be modified.
string | bool$wikiThe wiki's database to connect to. Must be a value LBFactory understands. Defaults to false, which is the local wiki.
Exceptions
MWException

Member Function Documentation

◆ clear()

Wikibase\Lib\Store\Sql\SiteLinkTable::clear ( )
See also
SiteLinkStore::clear
Returns
boolean Success indicator
Exceptions
MWException

Implements Wikibase\Lib\Store\SiteLinkStore.

◆ deleteLinks()

Wikibase\Lib\Store\Sql\SiteLinkTable::deleteLinks ( Item  $item,
array  $links,
IDatabase  $dbw 
)
private
Parameters
Item$item
SiteLink[]$links
IDatabase$dbw
Returns
bool Success indicator

◆ deleteLinksOfItem()

Wikibase\Lib\Store\Sql\SiteLinkTable::deleteLinksOfItem ( ItemId  $itemId)
See also
SiteLinkStore::deleteLinksOfItem
Parameters
ItemId$itemId
Returns
boolean Success indicator
Exceptions
MWException

Implements Wikibase\Lib\Store\SiteLinkStore.

◆ diffSiteLinks()

Wikibase\Lib\Store\Sql\SiteLinkTable::diffSiteLinks ( array  $siteLinks1,
array  $siteLinks2 
)
private
Parameters
SiteLink[]$siteLinks1
SiteLink[]$siteLinks2
Returns
SiteLink[]

◆ getEntityIdForLinkedTitle()

Wikibase\Lib\Store\Sql\SiteLinkTable::getEntityIdForLinkedTitle (   $globalSiteId,
  $pageTitle 
)
Parameters
string$globalSiteId
string$pageTitle
Exceptions
InvalidArgumentExceptionif a parameter does not have the expected type
Returns
EntityId|null

Implements Wikibase\Lib\Store\EntityByLinkedTitleLookup.

◆ getItemIdForLink()

Wikibase\Lib\Store\Sql\SiteLinkTable::getItemIdForLink (   $globalSiteId,
  $pageTitle 
)
See also
SiteLinkLookup::getItemIdForLink
Todo:
may want to deprecate this or change it to always return entity id object only
Parameters
string$globalSiteId
string$pageTitle
Exceptions
InvalidArgumentExceptionif a parameter does not have the expected type
Returns
ItemId|null

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getItemIdForSiteLink()

Wikibase\Lib\Store\Sql\SiteLinkTable::getItemIdForSiteLink ( SiteLink  $siteLink)
See also
SiteLinkLookup::getItemIdForSiteLink
Parameters
SiteLink$siteLink
Returns
ItemId|null

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getLinks()

Wikibase\Lib\Store\Sql\SiteLinkTable::getLinks ( array  $numericIds = [],
array  $siteIds = [],
array  $pageNames = [] 
)
See also
SiteLinkLookup::getLinks
Parameters
int[]$numericIdsNumeric (unprefixed) item ids
string[]$siteIds
string[]$pageNames
Returns
array[]
Note
The arrays returned by this method do not contain badges!

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ getSiteLinksForItem()

Wikibase\Lib\Store\Sql\SiteLinkTable::getSiteLinksForItem ( ItemId  $itemId)
See also
SiteLinkLookup::getSiteLinksForItem
Parameters
ItemId$itemId
Returns
SiteLink[]
Note
The SiteLink objects returned by this method do not contain badges!

Implements Wikibase\Lib\Store\SiteLinkLookup.

◆ insertLinks()

Wikibase\Lib\Store\Sql\SiteLinkTable::insertLinks ( Item  $item,
array  $links,
IDatabase  $dbw 
)
private
Parameters
Item$item
SiteLink[]$links
IDatabase$dbw
Returns
bool Success indicator

◆ saveLinksOfItem()

Wikibase\Lib\Store\Sql\SiteLinkTable::saveLinksOfItem ( Item  $item)
See also
SiteLinkStore::saveLinksOfItem
Parameters
Item$item
Returns
boolean Success indicator

Implements Wikibase\Lib\Store\SiteLinkStore.

Member Data Documentation

◆ $logger

Wikibase\Lib\Store\Sql\SiteLinkTable::$logger
private

◆ $readonly

Wikibase\Lib\Store\Sql\SiteLinkTable::$readonly
protected

◆ $table

Wikibase\Lib\Store\Sql\SiteLinkTable::$table
protected

The documentation for this class was generated from the following file: