Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Client\Changes\ChangeRunCoalescer Class Reference

A transformer for lists of EntityChanges that combines runs of changes into a single change. More...

Public Member Functions

 __construct (EntityRevisionLookup $entityRevisionLookup, EntityChangeFactory $changeFactory, LoggerInterface $logger, $localSiteId)
 
 compareChangesByTimestamp (Change $a, Change $b)
 Compares two changes based on their timestamp.
 

Private Member Functions

 groupChangesByEntity (array $changes)
 Group changes by the entity they were applied to.
 
 isBadgesOnlyChange (DiffOp $siteLinkDiffOp)
 
 coalesceRuns (EntityId $entityId, array $changes)
 Coalesce consecutive changes by the same user to the same entity into one.
 

Private Attributes

 $entityRevisionLookup
 
 $changeFactory
 
 $logger
 
 $localSiteId
 

Detailed Description

A transformer for lists of EntityChanges that combines runs of changes into a single change.

A "run" of changes is a sequence of consecutive changes performed by the same user, and not interrupted by a "disruptive" change. Changes altering the association between pages on the local wiki and items on the repo are considered disruptive.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Changes\ChangeRunCoalescer::__construct ( EntityRevisionLookup  $entityRevisionLookup,
EntityChangeFactory  $changeFactory,
LoggerInterface  $logger,
  $localSiteId 
)
Parameters
EntityRevisionLookup$entityRevisionLookup
EntityChangeFactory$changeFactory
LoggerInterface$logger
string$localSiteId

Member Function Documentation

◆ coalesceRuns()

Wikibase\Client\Changes\ChangeRunCoalescer::coalesceRuns ( EntityId  $entityId,
array  $changes 
)
private

Coalesce consecutive changes by the same user to the same entity into one.

A run of changes may be broken if the action performed changes (e.g. deletion instead of update) or if a sitelink pointing to the local wiki was modified.

Some types of actions, like deletion, will break runs.

Parameters
EntityId$entityId
EntityChange[]$changes
Returns
Change[] grouped changes

◆ compareChangesByTimestamp()

Wikibase\Client\Changes\ChangeRunCoalescer::compareChangesByTimestamp ( Change  $a,
Change  $b 
)

Compares two changes based on their timestamp.

Parameters
Change$a
Change$b
Returns
int

◆ groupChangesByEntity()

Wikibase\Client\Changes\ChangeRunCoalescer::groupChangesByEntity ( array  $changes)
private

Group changes by the entity they were applied to.

Parameters
EntityChange[]$changes
Returns
array[] an associative array using entity IDs for keys. Associated with each entity ID is the list of changes performed on that entity.

◆ isBadgesOnlyChange()

Wikibase\Client\Changes\ChangeRunCoalescer::isBadgesOnlyChange ( DiffOp  $siteLinkDiffOp)
private
Parameters
DiffOp$siteLinkDiffOp
Returns
bool

Member Data Documentation

◆ $changeFactory

Wikibase\Client\Changes\ChangeRunCoalescer::$changeFactory
private

◆ $entityRevisionLookup

Wikibase\Client\Changes\ChangeRunCoalescer::$entityRevisionLookup
private

◆ $localSiteId

Wikibase\Client\Changes\ChangeRunCoalescer::$localSiteId
private

◆ $logger

Wikibase\Client\Changes\ChangeRunCoalescer::$logger
private

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