Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Interactors\EntityRedirectCreationInteractor Class Reference

An interactor implementing the use case of creating a redirect. More...

+ Inheritance diagram for Wikibase\Repo\Interactors\EntityRedirectCreationInteractor:

Public Member Functions

 __construct (EntityRevisionLookup $entityRevisionLookup, EntityStore $entityStore, EntityPermissionChecker $permissionChecker, SummaryFormatter $summaryFormatter, User $user, EditFilterHookRunner $editFilterHookRunner, EntityRedirectLookup $entityRedirectLookup, EntityTitleStoreLookup $entityTitleLookup)
 
 createRedirect (EntityId $fromId, EntityId $toId, $bot)
 Create a redirect at $fromId pointing to $toId. More...
 

Protected Member Functions

 assertEntityIsRedirectable (EntityDocument $entity)
 Used to assert that the source entity is redirectable. More...
 

Private Member Functions

 checkPermissions (EntityId $entityId)
 Check user's permissions for the given entity ID. More...
 
 checkCanCreateRedirect (EntityId $entityId)
 
 checkExistsNoRedirect (EntityId $entityId)
 
 checkCompatible (EntityId $fromId, EntityId $toId)
 
 checkSourceAndTargetNotTheSame (EntityId $fromId, EntityId $toId)
 
 saveRedirect (EntityRedirect $redirect, FormatableSummary $summary, $bot)
 

Private Attributes

 $entityTitleLookup
 
 $entityRevisionLookup
 
 $entityStore
 
 $permissionChecker
 
 $summaryFormatter
 
 $user
 
 $editFilterHookRunner
 
 $entityRedirectLookup
 

Detailed Description

An interactor implementing the use case of creating a redirect.

Author
Daniel Kinzler
Addshore

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::__construct ( EntityRevisionLookup  $entityRevisionLookup,
EntityStore  $entityStore,
EntityPermissionChecker  $permissionChecker,
SummaryFormatter  $summaryFormatter,
User  $user,
EditFilterHookRunner  $editFilterHookRunner,
EntityRedirectLookup  $entityRedirectLookup,
EntityTitleStoreLookup  $entityTitleLookup 
)

Member Function Documentation

◆ assertEntityIsRedirectable()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::assertEntityIsRedirectable ( EntityDocument  $entity)
abstractprotected

Used to assert that the source entity is redirectable.

This can differ depending on the entity type.

Parameters
EntityDocument$entity
Returns
void
Exceptions
RedirectCreationException

Reimplemented in Wikibase\Repo\Interactors\ItemRedirectCreationInteractor.

◆ checkCanCreateRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::checkCanCreateRedirect ( EntityId  $entityId)
private
Parameters
EntityId$entityId
Exceptions
RedirectCreationException

◆ checkCompatible()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::checkCompatible ( EntityId  $fromId,
EntityId  $toId 
)
private
Parameters
EntityId$fromId
EntityId$toId
Exceptions
RedirectCreationException

◆ checkExistsNoRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::checkExistsNoRedirect ( EntityId  $entityId)
private
Parameters
EntityId$entityId
Exceptions
RedirectCreationException

◆ checkPermissions()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::checkPermissions ( EntityId  $entityId)
private

Check user's permissions for the given entity ID.

Parameters
EntityId$entityId
Exceptions
RedirectCreationExceptionif the permission check fails

◆ checkSourceAndTargetNotTheSame()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::checkSourceAndTargetNotTheSame ( EntityId  $fromId,
EntityId  $toId 
)
private

◆ createRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::createRedirect ( EntityId  $fromId,
EntityId  $toId,
  $bot 
)

Create a redirect at $fromId pointing to $toId.

Parameters
EntityId$fromIdThe ID of the entity to be replaced by the redirect. The entity must exist and be empty (or be a redirect already).
EntityId$toIdThe ID of the entity the redirect should point to. The Entity must exist and must not be a redirect.
bool$botWhether the edit should be marked as bot
Returns
EntityRedirect
Exceptions
RedirectCreationExceptionIf creating the redirect fails. Calling code may use RedirectCreationException::getErrorCode() to get further information about the cause of the failure. An explanation of the error codes can be obtained from getErrorCodeInfo().

◆ saveRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::saveRedirect ( EntityRedirect  $redirect,
FormatableSummary  $summary,
  $bot 
)
private
Parameters
EntityRedirect$redirect
FormatableSummary$summary
bool$botWhether the edit should be marked as bot
Exceptions
RedirectCreationException

Member Data Documentation

◆ $editFilterHookRunner

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$editFilterHookRunner
private

◆ $entityRedirectLookup

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$entityRedirectLookup
private

◆ $entityRevisionLookup

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$entityRevisionLookup
private

◆ $entityStore

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$entityStore
private

◆ $entityTitleLookup

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$entityTitleLookup
private

◆ $permissionChecker

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$permissionChecker
private

◆ $summaryFormatter

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$summaryFormatter
private

◆ $user

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$user
private

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