Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Lib\Changes\EntityChange Class Reference

Represents a change for an entity; to be extended by various change subtypes. More...

+ Inheritance diagram for Wikibase\Lib\Changes\EntityChange:
+ Collaboration diagram for Wikibase\Lib\Changes\EntityChange:

Public Member Functions

 getType ()
 
 getEntityId ()
 
 setEntityId (EntityId $entityId)
 Set the Change's entity id (as returned by getEntityId) and the object_id field.
 
 getAction ()
 
 getMetadata ( $cache='no')
 
 setMetadata (array $metadata)
 Sets metadata fields.
 
 getComment ()
 
 setMetadataFromRC (RecentChange $rc, $centralUserId)
 
 setMetadataFromUser (User $user, $centralUserId)
 
 setRevisionInfo (RevisionRecord $revision, $centralUserId)
 
 setTimestamp ( $timestamp)
 
 getSerializedInfo ( $skipKeys=[])
 
- Public Member Functions inherited from Wikibase\Lib\Changes\DiffChange
 getCompactDiff ()
 
 setCompactDiff (EntityDiffChangedAspects $diff)
 
- Public Member Functions inherited from Wikibase\Lib\Changes\ChangeRow
 getAge ()
 
 getTime ()
 
 getUserId ()
 Original (repository) user id, or 0 for logged out users.
 
 __construct (array $fields=[])
 
 getObjectId ()
 
 getField ( $name)
 
 getFields ()
 Overwritten to unserialize the info field on the fly.
 
 getInfo ( $cache='no')
 Returns the info array.
 
 setField ( $name, $value)
 Sets the value of a field.
 
 setFields (array $fields)
 Sets multiple fields.
 
 getId ()
 
 hasField ( $name)
 Gets if a certain field is set.
 

Public Attributes

const UPDATE = 'update'
 
const ADD = 'add'
 
const REMOVE = 'remove'
 
const RESTORE = 'restore'
 

Protected Member Functions

 unserializeInfo ( $serialization)
 

Private Member Functions

 addUserMetadata ( $repoUserId, $repoUserText, $centralUserId)
 Add fields and metadata related to the user.
 

Private Attributes

 $entityId = null
 

Detailed Description

Represents a change for an entity; to be extended by various change subtypes.

Author
Jeroen De Dauw < jeroe.nosp@m.nded.nosp@m.auw@g.nosp@m.mail.nosp@m..com >
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >
Daniel Kinzler
Matthew Flaschen < mflas.nosp@m.chen.nosp@m.@wiki.nosp@m.medi.nosp@m.a.org >

Member Function Documentation

◆ addUserMetadata()

Wikibase\Lib\Changes\EntityChange::addUserMetadata (   $repoUserId,
  $repoUserText,
  $centralUserId 
)
private

Add fields and metadata related to the user.

This does not touch other fields or metadata.

Parameters
int$repoUserIdUser ID on wiki where change was made, or 0 for anon
string$repoUserTextUser text on wiki where change was made, for either logged in user or anon
int$centralUserIdCentral user ID, or 0 if unknown or not applicable (see docs/change-propagation.wiki)

◆ getAction()

Wikibase\Lib\Changes\EntityChange::getAction ( )
Returns
string

◆ getComment()

Wikibase\Lib\Changes\EntityChange::getComment ( )
Returns
string

◆ getEntityId()

Wikibase\Lib\Changes\EntityChange::getEntityId ( )
Returns
EntityId

◆ getMetadata()

Wikibase\Lib\Changes\EntityChange::getMetadata (   $cache = 'no')
Parameters
string$cacheset to 'cache' to cache the unserialized diff.
Returns
array false if no meta data could be found in the info array

◆ getSerializedInfo()

Wikibase\Lib\Changes\EntityChange::getSerializedInfo (   $skipKeys = [])
See also
ChangeRow::getSerializedInfo
Parameters
string[]$skipKeys
Returns
string JSON

Reimplemented from Wikibase\Lib\Changes\ChangeRow.

◆ getType()

Wikibase\Lib\Changes\EntityChange::getType ( )
Returns
string

Implements Wikibase\Lib\Changes\Change.

◆ setEntityId()

Wikibase\Lib\Changes\EntityChange::setEntityId ( EntityId  $entityId)

Set the Change's entity id (as returned by getEntityId) and the object_id field.

Parameters
EntityId$entityId

◆ setMetadata()

Wikibase\Lib\Changes\EntityChange::setMetadata ( array  $metadata)

Sets metadata fields.

Unknown fields are ignored. New metadata is merged into the current metadata array.

Parameters
array$metadata

◆ setMetadataFromRC()

Wikibase\Lib\Changes\EntityChange::setMetadataFromRC ( RecentChange  $rc,
  $centralUserId 
)
Parameters
RecentChange$rc
int$centralUserIdCentral user ID, or 0 if unknown or not applicable (see docs/change-propagation.wiki)
Todo:
rename to setRecentChangeInfo

◆ setMetadataFromUser()

Wikibase\Lib\Changes\EntityChange::setMetadataFromUser ( User  $user,
  $centralUserId 
)
Todo:
rename to setUserInfo
Parameters
User$userUser that made change
int$centralUserIdCentral user ID, or 0 if unknown or not applicable (see docs/change-propagation.wiki)

◆ setRevisionInfo()

Wikibase\Lib\Changes\EntityChange::setRevisionInfo ( RevisionRecord  $revision,
  $centralUserId 
)
Parameters
RevisionRecord$revisionRevision to populate EntityChange from
int$centralUserIdCentral user ID, or 0 if unknown or not applicable (see docs/change-propagation.wiki)

◆ setTimestamp()

Wikibase\Lib\Changes\EntityChange::setTimestamp (   $timestamp)
Parameters
string$timestampTimestamp in TS_MW format

◆ unserializeInfo()

Wikibase\Lib\Changes\EntityChange::unserializeInfo (   $serialization)
protected
See also
ChangeRow::unserializeInfo

Overwritten to use the array representation of the diff.

Parameters
string$serialization
Returns
array the info array

Reimplemented from Wikibase\Lib\Changes\ChangeRow.

Member Data Documentation

◆ $entityId

Wikibase\Lib\Changes\EntityChange::$entityId = null
private

◆ ADD

const Wikibase\Lib\Changes\EntityChange::ADD = 'add'

◆ REMOVE

const Wikibase\Lib\Changes\EntityChange::REMOVE = 'remove'

◆ RESTORE

const Wikibase\Lib\Changes\EntityChange::RESTORE = 'restore'

◆ UPDATE

const Wikibase\Lib\Changes\EntityChange::UPDATE = 'update'

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