Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
Wikibase\Repo\Notifications\ChangeNotifier Class Reference

Class for generating and submitting change notifications in different situations. More...

Public Member Functions

 __construct (EntityChangeFactory $changeFactory, array $changeTransmitters, CentralIdLookup $centralIdLookup=null)
 
 notifyOnPageDeleted (EntityContent $content, User $user, $timestamp)
 This method constructs and sends the appropriate notifications (if any) when a wiki page containing an EntityContent was deleted.
 
 notifyOnPageModified (RevisionRecord $current, RevisionRecord $parent)
 This method constructs and sends the appropriate notifications (if any) when a wiki page containing an EntityContent was modified.
 

Private Member Functions

 getCentralUserId (User $user)
 
 getChangeForModification (EntityContent $oldContent, EntityContent $newContent)
 Returns a EntityChange based on the old and new content object, taking redirects into consideration.
 
 transmitChange (EntityChange $change)
 Transmit changes via all registered transmitters.
 

Private Attributes

 $changeFactory
 
 $changeTransmitters
 
 $centralIdLookup
 

Detailed Description

Class for generating and submitting change notifications in different situations.

This is a helper intended for use in hook handler functions.

Author
Daniel Kinzler

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Notifications\ChangeNotifier::__construct ( EntityChangeFactory  $changeFactory,
array  $changeTransmitters,
CentralIdLookup  $centralIdLookup = null 
)
Parameters
EntityChangeFactory$changeFactory
ChangeTransmitter[]$changeTransmitters
CentralIdLookup | null$centralIdLookupCentralIdLookup, or null if this repository is not connected to a central user system,
See also
Wikibase\Lib\Changes\CentralIdLookupFactory.

Member Function Documentation

◆ getCentralUserId()

Wikibase\Repo\Notifications\ChangeNotifier::getCentralUserId ( User  $user)
private
Parameters
User$userRepository user
Returns
int Central user ID, or 0

◆ getChangeForModification()

Wikibase\Repo\Notifications\ChangeNotifier::getChangeForModification ( EntityContent  $oldContent,
EntityContent  $newContent 
)
private

Returns a EntityChange based on the old and new content object, taking redirects into consideration.

Todo:
Notify the client about changes to redirects explicitly.
Parameters
EntityContent$oldContent
EntityContent$newContent
Returns
EntityChange|null

◆ notifyOnPageDeleted()

Wikibase\Repo\Notifications\ChangeNotifier::notifyOnPageDeleted ( EntityContent  $content,
User  $user,
  $timestamp 
)

This method constructs and sends the appropriate notifications (if any) when a wiki page containing an EntityContent was deleted.

Parameters
EntityContent$content
User$user
string$timestamptimestamp in TS_MW format.
Exceptions
InvalidArgumentException
ChangeTransmitterException
Returns
EntityChange|null

◆ notifyOnPageModified()

Wikibase\Repo\Notifications\ChangeNotifier::notifyOnPageModified ( RevisionRecord  $current,
RevisionRecord  $parent 
)

This method constructs and sends the appropriate notifications (if any) when a wiki page containing an EntityContent was modified.

Parameters
RevisionRecord$current
RevisionRecord$parent
Exceptions
InvalidArgumentException
ChangeTransmitterException
Returns
EntityChange|null

◆ transmitChange()

Wikibase\Repo\Notifications\ChangeNotifier::transmitChange ( EntityChange  $change)
private

Transmit changes via all registered transmitters.

Parameters
EntityChange$change

Member Data Documentation

◆ $centralIdLookup

Wikibase\Repo\Notifications\ChangeNotifier::$centralIdLookup
private

◆ $changeFactory

Wikibase\Repo\Notifications\ChangeNotifier::$changeFactory
private

◆ $changeTransmitters

Wikibase\Repo\Notifications\ChangeNotifier::$changeTransmitters
private

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