MediaWiki master
MediaWiki\Page\MovePage Class Reference

Handles the backend logic of moving a page from one title to another. More...

Collaboration diagram for MediaWiki\Page\MovePage:

Public Member Functions

 __construct (Title $oldTitle, Title $newTitle, ServiceOptions $options, IConnectionProvider $dbProvider, NamespaceInfo $nsInfo, WatchedItemStoreInterface $watchedItems, RepoGroup $repoGroup, IContentHandlerFactory $contentHandlerFactory, RevisionStore $revisionStore, SpamChecker $spamChecker, HookContainer $hookContainer, WikiPageFactory $wikiPageFactory, UserFactory $userFactory, UserEditTracker $userEditTracker, MovePageFactory $movePageFactory, CollationFactory $collationFactory, PageUpdaterFactory $pageUpdaterFactory, RestrictionStore $restrictionStore)
 
 authorizeMove (Authority $performer, string $reason=null)
 Authorize the move by $performer.
 
 checkPermissions (Authority $performer, $reason)
 Check if the user is allowed to perform the move.
 
 isValidMove ()
 Does various checks that the move is valid.
 
 move (UserIdentity $user, $reason=null, $createRedirect=true, array $changeTags=[])
 Move a page without taking user permissions into account.
 
 moveIfAllowed (Authority $performer, $reason=null, $createRedirect=true, array $changeTags=[])
 Same as move(), but with permissions checks.
 
 moveSubpages (UserIdentity $user, $reason=null, $createRedirect=true, array $changeTags=[])
 Move the source page's subpages to be subpages of the target page, without checking user permissions.
 
 moveSubpagesIfAllowed (Authority $performer, $reason=null, $createRedirect=true, array $changeTags=[])
 Move the source page's subpages to be subpages of the target page, with user permission checks.
 
 probablyCanMove (Authority $performer, string $reason=null)
 Check whether $performer can execute the move.
 
 setMaximumMovedPages ( $max)
 Override $wgMaximumMovedPages.
 

Public Attributes

CollationFactory $collationFactory
 
const CONSTRUCTOR_OPTIONS
 

Protected Member Functions

 isValidFileMove ()
 Checks for when a file is being moved.
 
 isValidMoveTarget ()
 Checks if $this can be moved to a given Title.
 

Protected Attributes

IConnectionProvider $dbProvider
 
Title $newTitle
 
NamespaceInfo $nsInfo
 
Title $oldTitle
 
ServiceOptions $options
 
RepoGroup $repoGroup
 
WatchedItemStoreInterface $watchedItems
 

Detailed Description

Handles the backend logic of moving a page from one title to another.

Since
1.24

Definition at line 67 of file MovePage.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\Page\MovePage::__construct ( Title $oldTitle,
Title $newTitle,
ServiceOptions $options,
IConnectionProvider $dbProvider,
NamespaceInfo $nsInfo,
WatchedItemStoreInterface $watchedItems,
RepoGroup $repoGroup,
IContentHandlerFactory $contentHandlerFactory,
RevisionStore $revisionStore,
SpamChecker $spamChecker,
HookContainer $hookContainer,
WikiPageFactory $wikiPageFactory,
UserFactory $userFactory,
UserEditTracker $userEditTracker,
MovePageFactory $movePageFactory,
CollationFactory $collationFactory,
PageUpdaterFactory $pageUpdaterFactory,
RestrictionStore $restrictionStore )
See also
MovePageFactory
Parameters
Title$oldTitle
Title$newTitle
ServiceOptions$options
IConnectionProvider$dbProvider
NamespaceInfo$nsInfo
WatchedItemStoreInterface$watchedItems
RepoGroup$repoGroup
IContentHandlerFactory$contentHandlerFactory
RevisionStore$revisionStore
SpamChecker$spamChecker
HookContainer$hookContainer
WikiPageFactory$wikiPageFactory
UserFactory$userFactory
UserEditTracker$userEditTracker
MovePageFactory$movePageFactory
CollationFactory$collationFactory
PageUpdaterFactory$pageUpdaterFactory
RestrictionStore$restrictionStore

Definition at line 182 of file MovePage.php.

References MediaWiki\Page\MovePage\$collationFactory, MediaWiki\Page\MovePage\$dbProvider, MediaWiki\Page\MovePage\$newTitle, MediaWiki\Page\MovePage\$nsInfo, MediaWiki\Page\MovePage\$oldTitle, MediaWiki\Page\MovePage\$options, MediaWiki\Page\MovePage\$repoGroup, MediaWiki\Page\MovePage\$watchedItems, and MediaWiki\MainConfigNames\MaximumMovedPages.

Member Function Documentation

◆ authorizeMove()

MediaWiki\Page\MovePage::authorizeMove ( Authority $performer,
string $reason = null )

Authorize the move by $performer.

Note
this method should be used right before the actual move is performed. To check whether a current performer has the potential to move the page, use self::probablyCanMove instead.
Parameters
Authority$performer
string | null$reason
Returns
PermissionStatus

Definition at line 307 of file MovePage.php.

References MediaWiki\Permissions\Authority\authorizeWrite().

◆ checkPermissions()

MediaWiki\Page\MovePage::checkPermissions ( Authority $performer,
$reason )

Check if the user is allowed to perform the move.

Parameters
Authority$performer
string | null$reasonTo check against summary spam regex. Set to null to skip the check, for instance to display errors preemptively before the user has filled in a summary.
Deprecated
since 1.36, use ::authorizeMove or ::probablyCanMove instead.
Returns
Status

Definition at line 326 of file MovePage.php.

References MediaWiki\Permissions\Authority\definitelyCan().

◆ isValidFileMove()

MediaWiki\Page\MovePage::isValidFileMove ( )
protected

Checks for when a file is being moved.

See also
UploadBase::getTitle
Returns
Status

Definition at line 425 of file MovePage.php.

References NS_FILE, and wfStripIllegalFilenameChars().

◆ isValidMove()

MediaWiki\Page\MovePage::isValidMove ( )

Does various checks that the move is valid.

Only things based on the two titles should be checked here.

Returns
Status

Definition at line 344 of file MovePage.php.

References NS_FILE, and wfMessage().

◆ isValidMoveTarget()

MediaWiki\Page\MovePage::isValidMoveTarget ( )
protected

Checks if $this can be moved to a given Title.

  • Selects for update, so don't call it unless you mean business
Since
1.25
Returns
bool

Definition at line 468 of file MovePage.php.

References NS_FILE, and wfDebug().

◆ move()

MediaWiki\Page\MovePage::move ( UserIdentity $user,
$reason = null,
$createRedirect = true,
array $changeTags = [] )

Move a page without taking user permissions into account.

Only checks if the move is itself invalid, e.g., trying to move a special page or trying to move a page onto one that already exists.

Parameters
UserIdentity$user
string | null$reason
bool | null$createRedirect
string[]$changeTagsChange tags to apply to the entry in the move log
Returns
Status

Definition at line 524 of file MovePage.php.

◆ moveIfAllowed()

MediaWiki\Page\MovePage::moveIfAllowed ( Authority $performer,
$reason = null,
$createRedirect = true,
array $changeTags = [] )

Same as move(), but with permissions checks.

Parameters
Authority$performer
string | null$reason
bool$createRedirectIgnored if user doesn't have suppressredirect permission
string[]$changeTagsChange tags to apply to the entry in the move log
Returns
Status

Definition at line 544 of file MovePage.php.

References ChangeTags\canAddTagsAccompanyingChange(), MediaWiki\Permissions\Authority\getUser(), and MediaWiki\Permissions\Authority\isAllowed().

◆ moveSubpages()

MediaWiki\Page\MovePage::moveSubpages ( UserIdentity $user,
$reason = null,
$createRedirect = true,
array $changeTags = [] )

Move the source page's subpages to be subpages of the target page, without checking user permissions.

The caller is responsible for moving the source page itself. We will still not do moves that are inherently not allowed, nor will we move more than $wgMaximumMovedPages.

Parameters
UserIdentity$user
string | null$reasonThe reason for the move
bool | null$createRedirectWhether to create redirects from the old subpages to the new ones
string[]$changeTagsApplied to entries in the move log and redirect page revision
Returns
Status Good if no errors occurred. Ok if at least one page succeeded. The "value" of the top-level status is an array containing the per-title status for each page. For any move that succeeded, the "value" of the per-title status is the new page title.

Definition at line 583 of file MovePage.php.

◆ moveSubpagesIfAllowed()

MediaWiki\Page\MovePage::moveSubpagesIfAllowed ( Authority $performer,
$reason = null,
$createRedirect = true,
array $changeTags = [] )

Move the source page's subpages to be subpages of the target page, with user permission checks.

The caller is responsible for moving the source page itself.

Parameters
Authority$performer
string | null$reasonThe reason for the move
bool | null$createRedirectWhether to create redirects from the old subpages to the new ones. Ignored if the user doesn't have the 'suppressredirect' right.
string[]$changeTagsApplied to entries in the move log and redirect page revision
Returns
Status Good if no errors occurred. Ok if at least one page succeeded. The "value" of the top-level status is an array containing the per-title status for each page. For any move that succeeded, the "value" of the per-title status is the new page title.

Definition at line 608 of file MovePage.php.

References MediaWiki\Permissions\Authority\authorizeWrite().

◆ probablyCanMove()

MediaWiki\Page\MovePage::probablyCanMove ( Authority $performer,
string $reason = null )

Check whether $performer can execute the move.

Note
this method does not guarantee full permissions check, so it should only be used to to decide whether to show a move form. To authorize the move action use self::authorizeMove instead.
Parameters
Authority$performer
string | null$reason
Returns
PermissionStatus

Definition at line 286 of file MovePage.php.

References MediaWiki\Permissions\Authority\probablyCan().

◆ setMaximumMovedPages()

MediaWiki\Page\MovePage::setMaximumMovedPages ( $max)

Override $wgMaximumMovedPages.

Parameters
int$maxThe maximum number of subpages to move, or -1 for no limit

Definition at line 230 of file MovePage.php.

Member Data Documentation

◆ $collationFactory

CollationFactory MediaWiki\Page\MovePage::$collationFactory

Definition at line 141 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $dbProvider

IConnectionProvider MediaWiki\Page\MovePage::$dbProvider
protected

Definition at line 87 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $newTitle

Title MediaWiki\Page\MovePage::$newTitle
protected

Definition at line 77 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $nsInfo

NamespaceInfo MediaWiki\Page\MovePage::$nsInfo
protected

Definition at line 92 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $oldTitle

Title MediaWiki\Page\MovePage::$oldTitle
protected

Definition at line 72 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $options

ServiceOptions MediaWiki\Page\MovePage::$options
protected

Definition at line 82 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $repoGroup

RepoGroup MediaWiki\Page\MovePage::$repoGroup
protected

Definition at line 102 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ $watchedItems

WatchedItemStoreInterface MediaWiki\Page\MovePage::$watchedItems
protected

Definition at line 97 of file MovePage.php.

Referenced by MediaWiki\Page\MovePage\__construct().

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\Page\MovePage::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const CategoryCollation
Name constant for the CategoryCollation setting, for use with Config::get()
const MaximumMovedPages
Name constant for the MaximumMovedPages setting, for use with Config::get()
Access: internal
For use by PageCommandFactory

Definition at line 155 of file MovePage.php.


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