MediaWiki REL1_35
|
Handles the backend logic of moving a page from one title to another. More...
Public Member Functions | |
__construct (Title $oldTitle, Title $newTitle, ServiceOptions $options=null, ILoadBalancer $loadBalancer=null, NamespaceInfo $nsInfo=null, WatchedItemStoreInterface $watchedItems=null, PermissionManager $permMgr=null, RepoGroup $repoGroup=null, IContentHandlerFactory $contentHandlerFactory=null, RevisionStore $revisionStore=null, SpamChecker $spamChecker=null, HookContainer $hookContainer=null) | |
Calling this directly is deprecated in 1.34. | |
checkPermissions (User $user, $reason) | |
Check if the user is allowed to perform the move. | |
isValidMove () | |
Does various sanity checks that the move is valid. | |
move (User $user, $reason=null, $createRedirect=true, array $changeTags=[]) | |
Move a page without taking user permissions into account. | |
moveIfAllowed (User $user, $reason=null, $createRedirect=true, array $changeTags=[]) | |
Same as move(), but with permissions checks. | |
moveSubpages (User $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 (User $user, $reason=null, $createRedirect=true, array $changeTags=[]) | |
Move the source page's subpages to be subpages of the target page, with user permission checks. | |
Public Attributes | |
const | CONSTRUCTOR_OPTIONS |
Protected Member Functions | |
isValidFileMove () | |
Sanity checks for when a file is being moved. | |
isValidMoveTarget () | |
Checks if $this can be moved to a given Title. | |
Private Member Functions | |
moveFile ( $oldTitle, $newTitle) | |
Move a file associated with a page to a new location. | |
moveSubpagesInternal ( $checkPermissions, User $user, $reason, $createRedirect, array $changeTags) | |
moveToInternal (User $user, &$nt, $reason='', $createRedirect=true, array $changeTags=[]) | |
Move page to a title which is either a redirect to the source page or nonexistent. | |
moveUnsafe (User $user, $reason, $createRedirect, array $changeTags) | |
Moves without any sort of safety or sanity checks. | |
Private Attributes | |
IContentHandlerFactory | $contentHandlerFactory |
HookContainer | $hookContainer |
HookRunner | $hookRunner |
RevisionStore | $revisionStore |
SpamChecker | $spamChecker |
Handles the backend logic of moving a page from one title to another.
Definition at line 42 of file MovePage.php.
MovePage::__construct | ( | Title | $oldTitle, |
Title | $newTitle, | ||
ServiceOptions | $options = null , |
||
ILoadBalancer | $loadBalancer = null , |
||
NamespaceInfo | $nsInfo = null , |
||
WatchedItemStoreInterface | $watchedItems = null , |
||
PermissionManager | $permMgr = null , |
||
RepoGroup | $repoGroup = null , |
||
IContentHandlerFactory | $contentHandlerFactory = null , |
||
RevisionStore | $revisionStore = null , |
||
SpamChecker | $spamChecker = null , |
||
HookContainer | $hookContainer = null |
||
) |
Calling this directly is deprecated in 1.34.
Use MovePageFactory instead.
Title | $oldTitle | |
Title | $newTitle | |
ServiceOptions | null | $options | |
ILoadBalancer | null | $loadBalancer | |
NamespaceInfo | null | $nsInfo | |
WatchedItemStoreInterface | null | $watchedItems | |
PermissionManager | null | $permMgr | |
RepoGroup | null | $repoGroup | |
IContentHandlerFactory | null | $contentHandlerFactory | |
RevisionStore | null | $revisionStore | |
SpamChecker | null | $spamChecker | |
HookContainer | null | $hookContainer |
Definition at line 129 of file MovePage.php.
MovePage::checkPermissions | ( | User | $user, |
$reason | |||
) |
Check if the user is allowed to perform the move.
User | $user | |
string | null | $reason | To 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. |
Definition at line 174 of file MovePage.php.
References wfMergeErrorArrays().
Referenced by moveIfAllowed().
|
protected |
Sanity checks for when a file is being moved.
Definition at line 291 of file MovePage.php.
References $file, NS_FILE, and wfStripIllegalFilenameChars().
Referenced by isValidMove().
MovePage::isValidMove | ( | ) |
Does various sanity checks that the move is valid.
Only things based on the two titles should be checked here.
Definition at line 214 of file MovePage.php.
References isValidFileMove(), NS_FILE, and wfMessage().
Referenced by move(), and moveIfAllowed().
|
protected |
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.
User | $user | |
string | null | $reason | |
bool | null | $createRedirect | |
string[] | $changeTags | Change tags to apply to the entry in the move log |
Definition at line 377 of file MovePage.php.
References isValidMove(), and moveUnsafe().
|
private |
Move a file associated with a page to a new location.
Can also be used to revert after a DB failure.
Definition at line 768 of file MovePage.php.
References $file.
Referenced by moveUnsafe().
MovePage::moveIfAllowed | ( | User | $user, |
$reason = null , |
|||
$createRedirect = true , |
|||
array | $changeTags = [] |
||
) |
Same as move(), but with permissions checks.
User | $user | |
string | null | $reason | |
bool | null | $createRedirect | Ignored if user doesn't have suppressredirect permission |
string[] | $changeTags | Change tags to apply to the entry in the move log |
Definition at line 397 of file MovePage.php.
References ChangeTags\canAddTagsAccompanyingChange(), checkPermissions(), isValidMove(), moveUnsafe(), and User\spreadAnyEditBlock().
MovePage::moveSubpages | ( | User | $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.
User | $user | |
string | null | $reason | The reason for the move |
bool | null | $createRedirect | Whether to create redirects from the old subpages to the new ones |
string[] | $changeTags | Applied to entries in the move log and redirect page revision |
Definition at line 434 of file MovePage.php.
References moveSubpagesInternal().
MovePage::moveSubpagesIfAllowed | ( | User | $user, |
$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.
User | $user | |
string | null | $reason | The reason for the move |
bool | null | $createRedirect | Whether to create redirects from the old subpages to the new ones. Ignored if the user doesn't have the 'suppressredirect' right. |
string[] | $changeTags | Applied to entries in the move log and redirect page revision |
Definition at line 453 of file MovePage.php.
References moveSubpagesInternal().
|
private |
bool | $checkPermissions | |
User | $user | |
string | $reason | |
bool | $createRedirect | |
array | $changeTags |
Definition at line 467 of file MovePage.php.
References $wgMaximumMovedPages, and StringUtils\escapeRegexReplacement().
Referenced by moveSubpages(), and moveSubpagesIfAllowed().
|
private |
Move page to a title which is either a redirect to the source page or nonexistent.
User | $user | the User doing the move |
Title | &$nt | The page to move to, which should be a redirect or non-existent |
string | $reason | The reason for the move |
bool | $createRedirect | Whether to leave a redirect at the old title. Does not check if the user has the suppressredirect right |
string[] | $changeTags | Change tags to apply to the entry in the move log |
MWException |
Definition at line 798 of file MovePage.php.
References ChangeTags\addTags(), DB_MASTER, ChangeTags\getSoftwareTags(), User\incEditCount(), LogFormatter\newFromEntry(), NS_CATEGORY, and wfMessage().
Referenced by moveUnsafe().
|
private |
Moves without any sort of safety or sanity checks.
Hooks can still fail the move, however.
User | $user | |
string | $reason | |
bool | $createRedirect | |
string[] | $changeTags | Change tags to apply to the entry in the move log |
Definition at line 553 of file MovePage.php.
References $res, $type, DB_MASTER, moveFile(), moveToInternal(), NS_FILE, and wfMessage().
Referenced by move(), and moveIfAllowed().
|
private |
Definition at line 87 of file MovePage.php.
|
private |
Definition at line 102 of file MovePage.php.
|
private |
Definition at line 107 of file MovePage.php.
|
protected |
Definition at line 62 of file MovePage.php.
|
protected |
Definition at line 52 of file MovePage.php.
|
protected |
Definition at line 67 of file MovePage.php.
|
protected |
Definition at line 47 of file MovePage.php.
|
protected |
Definition at line 57 of file MovePage.php.
|
protected |
Definition at line 77 of file MovePage.php.
|
protected |
Definition at line 82 of file MovePage.php.
|
private |
Definition at line 92 of file MovePage.php.
|
private |
Definition at line 97 of file MovePage.php.
|
protected |
Definition at line 72 of file MovePage.php.
const MovePage::CONSTRUCTOR_OPTIONS |
Definition at line 109 of file MovePage.php.