Wikibase
MediaWiki Wikibase extension
Wikibase\Client\RecentChanges\ExternalChangeFactory Class Reference

Public Member Functions

 __construct ( $repoSiteId, Language $summaryLanguage, EntityIdParser $idParser)
 
 newFromRecentChange (RecentChange $recentChange)
 

Private Member Functions

 newRevisionData (RecentChange $recentChange, array $changeParams, $commentHtml=null)
 
 extractChangeData (array $rc_params)
 
 validateChangeData ( $changeParams)
 
 extractChangeType ( $type)
 
 extractEntityId ( $prefixedId)
 
 parseAutoComment ( $comment, $type)
 This method transforms the comments field into rc_params into an appropriate comment value for ExternalChange. More...
 
 formatComment (array $comment)
 
 generateComment (array $changeParams)
 
 countCompositeComments (array $comments)
 normalizes for extra empty comment in rc_params (see bug T47812) More...
 

Private Attributes

 $repoSiteId
 
 $summaryLanguage
 
 $idParser
 

Detailed Description

Author
Katie Filbert < aude..nosp@m.wiki.nosp@m.@gmai.nosp@m.l.co.nosp@m.m >
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\RecentChanges\ExternalChangeFactory::__construct (   $repoSiteId,
Language  $summaryLanguage,
EntityIdParser  $idParser 
)
Parameters
string$repoSiteId
Language$summaryLanguageLanguage to use when generating edit summaries
EntityIdParser$idParser

Member Function Documentation

◆ countCompositeComments()

Wikibase\Client\RecentChanges\ExternalChangeFactory::countCompositeComments ( array  $comments)
private

normalizes for extra empty comment in rc_params (see bug T47812)

Parameters
array$comments
Returns
int

◆ extractChangeData()

Wikibase\Client\RecentChanges\ExternalChangeFactory::extractChangeData ( array  $rc_params)
private
Parameters
array$rc_params
Exceptions
UnexpectedValueException
Returns
array

◆ extractChangeType()

Wikibase\Client\RecentChanges\ExternalChangeFactory::extractChangeType (   $type)
private
See also
EntityChange::getAction
Parameters
string$type
Exceptions
UnexpectedValueException
Returns
string

◆ extractEntityId()

Wikibase\Client\RecentChanges\ExternalChangeFactory::extractEntityId (   $prefixedId)
private
Parameters
string$prefixedId
Exceptions
UnexpectedValueException
Returns
EntityId

◆ formatComment()

Wikibase\Client\RecentChanges\ExternalChangeFactory::formatComment ( array  $comment)
private
Parameters
array$comment
Returns
string

◆ generateComment()

Wikibase\Client\RecentChanges\ExternalChangeFactory::generateComment ( array  $changeParams)
private
Parameters
array$changeParams
Returns
string

◆ newFromRecentChange()

Wikibase\Client\RecentChanges\ExternalChangeFactory::newFromRecentChange ( RecentChange  $recentChange)
Parameters
RecentChange$recentChange
Exceptions
UnexpectedValueException
Returns
ExternalChange

◆ newRevisionData()

Wikibase\Client\RecentChanges\ExternalChangeFactory::newRevisionData ( RecentChange  $recentChange,
array  $changeParams,
  $commentHtml = null 
)
private
Parameters
RecentChange$recentChange
array$changeParams
string | null$commentHtmlPre-formatted comment HTML
Returns
RevisionData

◆ parseAutoComment()

Wikibase\Client\RecentChanges\ExternalChangeFactory::parseAutoComment (   $comment,
  $type 
)
private

This method transforms the comments field into rc_params into an appropriate comment value for ExternalChange.

$comment can be a string or an array with some additional data.

String comments are either 'wikibase-comment-update' (legacy) or have comments from the repo, such as '/ wbsetclaim-update:2||1 / [[Property:P213]]: [[Q850]]'.

We don't yet parse repo comments in the client, so for now, we use the generic 'wikibase-comment-update' for these.

Comment arrays may contain a message key that provide autocomments for stuff like log actions (item deletion) or edits that have no meaningful summary to use in the client.

  • 'wikibase-comment-unlinked' (when the sitelink to the given page is removed on the repo)
  • 'wikibase-comment-add' (when the item is created, with sitelink to the given page)
  • 'wikibase-comment-remove' (when the item is deleted, the page becomes unconnected)
  • 'wikibase-comment-restore' (when the item is undeleted and reconnected to the page)
  • 'wikibase-comment-sitelink-add' (and other sitelink messages, unused)
  • 'wikibase-comment-update' (legacy, generic, item updated commment)
Parameters
array | string$comment
string$type
Returns
array

◆ validateChangeData()

Wikibase\Client\RecentChanges\ExternalChangeFactory::validateChangeData (   $changeParams)
private
Parameters
mixed$changeParams
Exceptions
UnexpectedValueException
Returns
bool

Member Data Documentation

◆ $idParser

Wikibase\Client\RecentChanges\ExternalChangeFactory::$idParser
private

◆ $repoSiteId

Wikibase\Client\RecentChanges\ExternalChangeFactory::$repoSiteId
private

◆ $summaryLanguage

Wikibase\Client\RecentChanges\ExternalChangeFactory::$summaryLanguage
private

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