Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\ChangeOp\ChangeOpsMerge Class Reference

Public Member Functions

 __construct (Item $fromItem, Item $toItem, array $ignoreConflicts, EntityConstraintProvider $constraintProvider, ChangeOpFactoryProvider $changeOpFactoryProvider, SiteLookup $siteLookup, StatementsMerger $statementsMerger)
 
 apply ()
 

Public Attributes

const CONFLICT_TYPES = [ 'description', 'sitelink', 'statement' ]
 

Private Member Functions

 assertValidIgnoreConflictValues (array $ignoreConflicts)
 
 getFingerprintChangeOpFactory ()
 
 getSiteLinkChangeOpFactory ()
 
 generateChangeOps ()
 
 generateLabelsChangeOps ()
 
 generateDescriptionsChangeOps ()
 
 generateAliasesChangeOps ()
 
 generateSitelinksChangeOps ()
 
 generateSitelinksChangeOpsWithNoConflict (SiteLink $fromSiteLink)
 
 generateSitelinksChangeOpsWithConflict (SiteLink $fromSiteLink)
 
 getSite ( $siteId)
 
 applyConstraintChecks (Item $item, ItemId $fromId)
 
 removeConflictsWithEntity (array $errors, EntityId $fromId)
 Strip any conflicts with the given $fromId from the array of Error objects. More...
 
 checkStatementLinks ()
 

Private Attributes

 $fromItem
 
 $toItem
 
 $fromChangeOps
 
 $toChangeOps
 
 $ignoreConflicts
 
 $constraintProvider
 
 $changeOpFactoryProvider
 
 $siteLookup
 
 $statementsMerger
 

Detailed Description

Author
Addshore
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::__construct ( Item  $fromItem,
Item  $toItem,
array  $ignoreConflicts,
EntityConstraintProvider  $constraintProvider,
ChangeOpFactoryProvider  $changeOpFactoryProvider,
SiteLookup  $siteLookup,
StatementsMerger  $statementsMerger 
)
Parameters
Item$fromItem
Item$toItem
string[]$ignoreConflictslist of elements to ignore conflicts for can only contain 'description' and or 'sitelink' and or 'statement'
EntityConstraintProvider$constraintProvider
ChangeOpFactoryProvider$changeOpFactoryProvider
SiteLookup$siteLookup
StatementsMerger$statementsMerger
Todo:
Injecting ChangeOpFactoryProvider is an Abomination Unto Nuggan, we'll need a MergeChangeOpsSequenceBuilder or some such. This will allow us to merge different kinds of entities nicely, too.

Member Function Documentation

◆ apply()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::apply ( )
Exceptions
ChangeOpException

◆ applyConstraintChecks()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::applyConstraintChecks ( Item  $item,
ItemId  $fromId 
)
private
Parameters
Item$item
ItemId$fromId
Exceptions
ChangeOpValidationExceptionif it would not be possible to save the updated items.

◆ assertValidIgnoreConflictValues()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::assertValidIgnoreConflictValues ( array  $ignoreConflicts)
private
Parameters
string[]$ignoreConflictscan contain strings 'description' or 'sitelink'
Exceptions
InvalidArgumentException

◆ checkStatementLinks()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::checkStatementLinks ( )
private

◆ generateAliasesChangeOps()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateAliasesChangeOps ( )
private

◆ generateChangeOps()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateChangeOps ( )
private

◆ generateDescriptionsChangeOps()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateDescriptionsChangeOps ( )
private

◆ generateLabelsChangeOps()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateLabelsChangeOps ( )
private

◆ generateSitelinksChangeOps()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateSitelinksChangeOps ( )
private

◆ generateSitelinksChangeOpsWithConflict()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateSitelinksChangeOpsWithConflict ( SiteLink  $fromSiteLink)
private

◆ generateSitelinksChangeOpsWithNoConflict()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::generateSitelinksChangeOpsWithNoConflict ( SiteLink  $fromSiteLink)
private

◆ getFingerprintChangeOpFactory()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::getFingerprintChangeOpFactory ( )
private

◆ getSite()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::getSite (   $siteId)
private
Parameters
string$siteId
Exceptions
ChangeOpException
Returns
Site

◆ getSiteLinkChangeOpFactory()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::getSiteLinkChangeOpFactory ( )
private

◆ removeConflictsWithEntity()

Wikibase\Repo\ChangeOp\ChangeOpsMerge::removeConflictsWithEntity ( array  $errors,
EntityId  $fromId 
)
private

Strip any conflicts with the given $fromId from the array of Error objects.

Parameters
Error[]$errors
EntityId$fromId
Returns
Error[]

Member Data Documentation

◆ $changeOpFactoryProvider

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$changeOpFactoryProvider
private

◆ $constraintProvider

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$constraintProvider
private

◆ $fromChangeOps

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$fromChangeOps
private

◆ $fromItem

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$fromItem
private

◆ $ignoreConflicts

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$ignoreConflicts
private

◆ $siteLookup

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$siteLookup
private

◆ $statementsMerger

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$statementsMerger
private

◆ $toChangeOps

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$toChangeOps
private

◆ $toItem

Wikibase\Repo\ChangeOp\ChangeOpsMerge::$toItem
private

◆ CONFLICT_TYPES

const Wikibase\Repo\ChangeOp\ChangeOpsMerge::CONFLICT_TYPES = [ 'description', 'sitelink', 'statement' ]

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