Wikibase
MediaWiki Wikibase extension
Wikibase\Client\Hooks\UpdateRepoHookHandler Class Reference

This class has a static interface for use with MediaWiki's hook mechanism; the static handler functions will create a new instance of UpdateRepoHookHandlers and then call the corresponding member function on that. More...

+ Inheritance diagram for Wikibase\Client\Hooks\UpdateRepoHookHandler:
+ Collaboration diagram for Wikibase\Client\Hooks\UpdateRepoHookHandler:

Public Member Functions

 __construct (NamespaceChecker $namespaceChecker, JobQueueGroup $jobQueueGroup, SiteLinkLookup $siteLinkLookup, LoggerInterface $logger, ClientDomainDb $clientDb, $siteGlobalID, $propagateChangesToRepo)
 
 onArticleDeleteComplete ( $wikiPage, $user, $reason, $id, $content, $logEntry, $archivedRevisionCount)
 After a page has been deleted also update the item on the repo. More...
 
 onPageMoveComplete ( $oldLinkTarget, $newLinkTarget, $userIdentity, $pageId, $redirid, $reason, $revisionRecord)
 After a page has been moved also update the item on the repo. More...
 

Static Public Member Functions

static factory (JobQueueGroupFactory $jobQueueGroupFactory, ClientDomainDbFactory $clientDomainDbFactory, DatabaseEntitySource $entitySource, NamespaceChecker $namespaceChecker, SettingsArray $clientSettings, ClientStore $store)
 

Private Member Functions

 isWikibaseEnabled ( $namespace)
 
 makeDelete (UserIdentity $user, LinkTarget $title)
 
 makeMove (UserIdentity $user, LinkTarget $old, Linktarget $new)
 
 applyUpdateRepo (UpdateRepo $updateRepo, LinkTarget $title, string $titleProperty=null)
 Push the $updateRepo to the job queue if applicable, and if successful, set the $titleProperty on the $title. More...
 

Private Attributes

 $namespaceChecker
 
 $jobQueueGroup
 
 $siteLinkLookup
 
 $logger
 
 $clientDb
 
 $siteGlobalID
 
 $propagateChangesToRepo
 

Detailed Description

This class has a static interface for use with MediaWiki's hook mechanism; the static handler functions will create a new instance of UpdateRepoHookHandlers and then call the corresponding member function on that.

Author
Marius Hoch < hoo@o.nosp@m.nlin.nosp@m.e.de >

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Client\Hooks\UpdateRepoHookHandler::__construct ( NamespaceChecker  $namespaceChecker,
JobQueueGroup  $jobQueueGroup,
SiteLinkLookup  $siteLinkLookup,
LoggerInterface  $logger,
ClientDomainDb  $clientDb,
  $siteGlobalID,
  $propagateChangesToRepo 
)
Parameters
NamespaceChecker$namespaceChecker
JobQueueGroup$jobQueueGroup
SiteLinkLookup$siteLinkLookup
LoggerInterface$logger
string$siteGlobalID
bool$propagateChangesToRepo

Member Function Documentation

◆ applyUpdateRepo()

Wikibase\Client\Hooks\UpdateRepoHookHandler::applyUpdateRepo ( UpdateRepo  $updateRepo,
LinkTarget  $title,
string  $titleProperty = null 
)
private

Push the $updateRepo to the job queue if applicable, and if successful, set the $titleProperty on the $title.

Hook handlers later look at this property in an attempt to determine whether the update was successfully applied/enqueued or not.

◆ factory()

static Wikibase\Client\Hooks\UpdateRepoHookHandler::factory ( JobQueueGroupFactory  $jobQueueGroupFactory,
ClientDomainDbFactory  $clientDomainDbFactory,
DatabaseEntitySource  $entitySource,
NamespaceChecker  $namespaceChecker,
SettingsArray  $clientSettings,
ClientStore  $store 
)
static

◆ isWikibaseEnabled()

Wikibase\Client\Hooks\UpdateRepoHookHandler::isWikibaseEnabled (   $namespace)
private
See also
NamespaceChecker::isWikibaseEnabled
Parameters
int$namespace
Returns
bool

◆ makeDelete()

Wikibase\Client\Hooks\UpdateRepoHookHandler::makeDelete ( UserIdentity  $user,
LinkTarget  $title 
)
private

◆ makeMove()

Wikibase\Client\Hooks\UpdateRepoHookHandler::makeMove ( UserIdentity  $user,
LinkTarget  $old,
Linktarget  $new 
)
private

◆ onArticleDeleteComplete()

Wikibase\Client\Hooks\UpdateRepoHookHandler::onArticleDeleteComplete (   $wikiPage,
  $user,
  $reason,
  $id,
  $content,
  $logEntry,
  $archivedRevisionCount 
)

After a page has been deleted also update the item on the repo.

This only works if there's a user account with the same name on the repo.

See also
https://www.mediawiki.org/wiki/Manual:Hooks/ArticleDeleteComplete
Parameters
WikiPage$wikiPageWikiPage that was deleted
User$userUser that deleted the article
string$reasonReason the article was deleted
int$idID of the article that was deleted
Content | null$contentContent of the deleted page (or null, when deleting a broken page)
\ManualLogEntry$logEntryManualLogEntry used to record the deletion
int$archivedRevisionCountNumber of revisions archived during the deletion
Returns
bool|void True or no return value to continue or false to abort

◆ onPageMoveComplete()

Wikibase\Client\Hooks\UpdateRepoHookHandler::onPageMoveComplete (   $oldLinkTarget,
  $newLinkTarget,
  $userIdentity,
  $pageId,
  $redirid,
  $reason,
  $revisionRecord 
)

After a page has been moved also update the item on the repo.

This only works if there's a user account with the same name on the repo.

See also
https://www.mediawiki.org/wiki/Manual:Hooks/PageMoveComplete
Parameters
LinkTarget$oldLinkTarget
LinkTarget$newLinkTarget
UserIdentity$userIdentity
int$pageIddatabase ID of the page that's been moved
int$rediridID of the created redirect
string$reason
RevisionRecord$revisionRecordrevision created by the move
Returns
bool

Member Data Documentation

◆ $clientDb

Wikibase\Client\Hooks\UpdateRepoHookHandler::$clientDb
private

◆ $jobQueueGroup

Wikibase\Client\Hooks\UpdateRepoHookHandler::$jobQueueGroup
private

◆ $logger

Wikibase\Client\Hooks\UpdateRepoHookHandler::$logger
private

◆ $namespaceChecker

Wikibase\Client\Hooks\UpdateRepoHookHandler::$namespaceChecker
private

◆ $propagateChangesToRepo

Wikibase\Client\Hooks\UpdateRepoHookHandler::$propagateChangesToRepo
private

◆ $siteGlobalID

Wikibase\Client\Hooks\UpdateRepoHookHandler::$siteGlobalID
private

◆ $siteLinkLookup

Wikibase\Client\Hooks\UpdateRepoHookHandler::$siteLinkLookup
private

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