Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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, EditFilterHookRunner $editFilterHookRunner, EntityRedirectTargetLookup $entityRedirectLookup, EntityTitleStoreLookup $entityTitleLookup)
 
 createRedirect (EntityId $fromId, EntityId $toId, bool $bot, array $tags, IContextSource $context)
 Create a redirect at $fromId pointing to $toId.
 

Protected Member Functions

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

Private Member Functions

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

Private Attributes

 $entityTitleLookup
 
 $entityRevisionLookup
 
 $entityStore
 
 $permissionChecker
 
 $summaryFormatter
 
 $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,
EditFilterHookRunner $editFilterHookRunner,
EntityRedirectTargetLookup $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,
IContextSource $context )
private

Check user's permissions for the given entity ID.

Parameters
EntityId$entityId
IContextSource$context
Exceptions
RedirectCreationExceptionif the permission check fails

◆ checkRateLimits()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::checkRateLimits ( IContextSource $context)
private

◆ checkSourceAndTargetNotTheSame()

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

◆ createRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::createRedirect ( EntityId $fromId,
EntityId $toId,
bool $bot,
array $tags,
IContextSource $context )

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
string[]$tags
IContextSource | null$contextThe context to pass to the edit filter hook and check permissions
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(). PhanTypeMismatchDeclaredParam

◆ saveRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::saveRedirect ( EntityRedirect $redirect,
FormatableSummary $summary,
IContextSource $context,
bool $bot,
array $tags )
private
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

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