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:
+ Collaboration diagram for Wikibase\Repo\Interactors\EntityRedirectCreationInteractor:

Public Member Functions

 __construct (EntityRevisionLookup $entityRevisionLookup, EntityStore $entityStore, EntityPermissionChecker $permissionChecker, SummaryFormatter $summaryFormatter, EditFilterHookRunner $editFilterHookRunner, EntityRedirectTargetLookup $entityRedirectLookup, EntityTitleStoreLookup $entityTitleLookup, TempUserCreator $tempUserCreator)
 
 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

EntityTitleStoreLookup $entityTitleLookup
 
EntityRevisionLookup $entityRevisionLookup
 
EntityStore $entityStore
 
EntityPermissionChecker $permissionChecker
 
SummaryFormatter $summaryFormatter
 
EditFilterHookRunner $editFilterHookRunner
 
EntityRedirectTargetLookup $entityRedirectLookup
 
TempUserCreator $tempUserCreator
 

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,
TempUserCreator $tempUserCreator )

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
EntityRedirectCreationStatus Note that the status is only returned to wrap the created redirect, context and saved temp user in a strongly typed container. Errors are (currently) reported as exceptions, not as a failed status. (It would be nice to fix this at some point and use status consistently.)
Exceptions
RedirectCreationExceptionIf creating the redirect fails. Calling code may use RedirectCreationException::getErrorCode() to get further information about the cause of the failure. PhanTypeMismatchDeclaredParam

◆ saveRedirect()

Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::saveRedirect ( EntityRedirect $redirect,
FormatableSummary $summary,
IContextSource $context,
bool $bot,
array $tags )
private
Exceptions
RedirectCreationException

Member Data Documentation

◆ $editFilterHookRunner

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

◆ $entityRedirectLookup

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

◆ $entityRevisionLookup

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

◆ $entityStore

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

◆ $entityTitleLookup

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

◆ $permissionChecker

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

◆ $summaryFormatter

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

◆ $tempUserCreator

TempUserCreator Wikibase\Repo\Interactors\EntityRedirectCreationInteractor::$tempUserCreator
private

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