Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner Class Reference
+ Inheritance diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner:
+ Collaboration diagram for Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner:

Public Member Functions

 __construct (ILoadBalancer $loadbalancer, DatabaseInnerTermStoreCleaner $innerCleaner)
 
 cleanTermInLangIds (array $termInLangIds)
 Checks the provided TermInLangIds for existence and usage in either on both Items and Properties.
 

Private Member Functions

 findActuallyUnusedTermInLangIds (IDatabase $dbw, array $termInLangIds)
 Of the given term in lang IDs, find those that are not used by any other items or properties.
 

Private Attributes

 $innerCleaner
 
 $loadBalancer
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner::__construct ( ILoadBalancer  $loadbalancer,
DatabaseInnerTermStoreCleaner  $innerCleaner 
)

Member Function Documentation

◆ cleanTermInLangIds()

Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner::cleanTermInLangIds ( array  $termInLangIds)

Checks the provided TermInLangIds for existence and usage in either on both Items and Properties.

Those that do actually exist and are unused are passed to an inner cleaner.

These steps are all wrapped in a transaction.

Parameters
array$termInLangIds

Implements Wikibase\Lib\Store\Sql\Terms\TermStoreCleaner.

◆ findActuallyUnusedTermInLangIds()

Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner::findActuallyUnusedTermInLangIds ( IDatabase  $dbw,
array  $termInLangIds 
)
private

Of the given term in lang IDs, find those that are not used by any other items or properties.

Currently, this does not account for term in lang IDs that may be used anywhere else, e.g. by other entity types; anyone who uses term in lang IDs elsewhere runs the risk of those terms being deleted at any time. This may be improved in the future.

1) Iterate through the IDs that we have been given and determine if they appear to be used or not in either the property or item term tables. 2) Select FOR UPDATE the rows in the wbt_property_terms and wbt_item_terms tables so they lock and nothing will happen to them.

An alternative to this would be immediately lock all $termInLangIds, but that would lead to deadlocks. see T234948

Parameters
IDatabase$dbw
int[]$termInLangIds(wbtl_id)
Returns
int[] wbtl_ids to be cleaned
Todo:
This should be factored out of this Cleaner into its own class

Member Data Documentation

◆ $innerCleaner

Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner::$innerCleaner
private

◆ $loadBalancer

Wikibase\Lib\Store\Sql\Terms\DatabaseUsageCheckingTermStoreCleaner::$loadBalancer
private

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