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 (string $table, bool $readonly, RepoDomainDb $db)
 
 saveLinksOfItem (Item $item)
 Saves the links for the provided item. More...
 
 deleteLinksOfItem (ItemId $itemId)
 
 getItemIdForLink (string $globalSiteId, string $pageTitle)
 
 getItemIdForSiteLink (SiteLink $siteLink)
 
 getLinks (?array $numericIds=null, ?array $siteIds=null, ?array $pageNames=null)
 
 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
 
 $db
 

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 ( string  $table,
bool  $readonly,
RepoDomainDb  $db 
)
Parameters
string$tableThe table to use for the sitelinks
bool$readonlyWhether the table can be modified.
RepoDomainDb$db

Member Function Documentation

◆ 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 ( string  $globalSiteId,
string  $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)

◆ getLinks()

Wikibase\Lib\Store\Sql\SiteLinkTable::getLinks ( ?array  $numericIds = null,
?array  $siteIds = null,
?array  $pageNames = null 
)
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)

Saves the links for the provided item.

Parameters
Item$item
Returns
bool Success indicator

Implements Wikibase\Lib\Store\SiteLinkStore.

Member Data Documentation

◆ $db

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

◆ $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: