MediaWiki
1.34.0
|
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) | |
Calling this directly is deprecated in 1.34. More... | |
checkPermissions (User $user, $reason) | |
Check if the user is allowed to perform the move. More... | |
isValidMove () | |
Does various sanity checks that the move is valid. More... | |
move (User $user, $reason=null, $createRedirect=true, array $changeTags=[]) | |
Move a page without taking user permissions into account. More... | |
moveIfAllowed (User $user, $reason=null, $createRedirect=true, array $changeTags=[]) | |
Same as move(), but with permissions checks. More... | |
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. More... | |
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. More... | |
Protected Member Functions | |
isValidFileMove () | |
Sanity checks for when a file is being moved. More... | |
isValidMoveTarget () | |
Checks if $this can be moved to a given Title. More... | |
Private Member Functions | |
moveFile ( $oldTitle, $newTitle) | |
Move a file associated with a page to a new location. More... | |
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. More... | |
moveUnsafe (User $user, $reason, $createRedirect, array $changeTags) | |
Moves without any sort of safety or sanity checks. More... | |
Handles the backend logic of moving a page from one title to another.
Definition at line 36 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 |
||
) |
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 |
Definition at line 89 of file MovePage.php.
References $loadBalancer, $newTitle, $nsInfo, $oldTitle, $options, $permMgr, $repoGroup, and $watchedItems.
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 121 of file MovePage.php.
References $status, EditPage\matchSummarySpamRegex(), Hooks\run(), and wfMergeErrorArrays().
Referenced by moveIfAllowed().
|
protected |
Sanity checks for when a file is being moved.
Definition at line 237 of file MovePage.php.
References $file, $status, File\checkExtensionCompatibility(), 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 163 of file MovePage.php.
References $status, ContentHandler\getForTitle(), ContentHandler\getLocalizedName(), isValidFileMove(), isValidMoveTarget(), NS_FILE, and Hooks\run().
Referenced by move(), and moveIfAllowed().
|
protected |
Checks if $this can be moved to a given Title.
Definition at line 267 of file MovePage.php.
References $content, $file, Revision\newFromTitle(), NS_FILE, and wfDebug().
Referenced by isValidMove().
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 319 of file MovePage.php.
References $status, 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.
Title | $oldTitle | Old location to move the file from. |
Title | $newTitle | New location to move the file to. |
Definition at line 687 of file MovePage.php.
References $file, $newTitle, $oldTitle, $status, Title\getPrefixedText(), and StatusValue\newFatal().
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 339 of file MovePage.php.
References $status, 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 377 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 396 of file MovePage.php.
References moveSubpagesInternal().
|
private |
bool | $checkPermissions | |
User | $user | |
string | $reason | |
bool | $createRedirect | |
array | $changeTags |
Definition at line 410 of file MovePage.php.
References $nsInfo, $status, $wgMaximumMovedPages, StringUtils\escapeRegexReplacement(), NamespaceInfo\getCanonicalName(), NamespaceInfo\hasSubpages(), Title\makeTitleSafe(), StatusValue\newFatal(), and StatusValue\newGood().
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 720 of file MovePage.php.
References $oldTitle, $status, ChangeTags\addTags(), DB_MASTER, WikiPage\factory(), ContentHandler\getDefaultModelFor(), ContentHandler\getForTitle(), User\getId(), User\getName(), ChangeTags\getSoftwareTags(), User\incEditCount(), Revision\insertOn(), RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), Revision\newNullRevision(), NS_CATEGORY, WikiPage\onArticleCreate(), WikiPage\onArticleDelete(), IDBAccessObject\READ_LOCKING, Hooks\run(), 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 499 of file MovePage.php.
References $newTitle, $oldTitle, $res, $status, $type, DeferredUpdates\addUpdate(), DB_MASTER, moveFile(), moveToInternal(), StatusValue\newGood(), NS_FILE, Hooks\run(), Collation\singleton(), and wfMessage().
Referenced by move(), and moveIfAllowed().
|
protected |
Definition at line 56 of file MovePage.php.
Referenced by __construct().
|
protected |
Definition at line 46 of file MovePage.php.
Referenced by __construct(), moveFile(), and moveUnsafe().
|
protected |
Definition at line 61 of file MovePage.php.
Referenced by __construct(), and moveSubpagesInternal().
|
protected |
Definition at line 41 of file MovePage.php.
Referenced by __construct(), moveFile(), moveToInternal(), and moveUnsafe().
|
protected |
Definition at line 51 of file MovePage.php.
Referenced by __construct().
|
protected |
Definition at line 71 of file MovePage.php.
Referenced by __construct().
|
protected |
Definition at line 76 of file MovePage.php.
Referenced by __construct().
|
protected |
Definition at line 66 of file MovePage.php.
Referenced by __construct().