MediaWiki  1.33.0
MovePage Class Reference

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

Collaboration diagram for MovePage:

Public Member Functions

 __construct (Title $oldTitle, Title $newTitle)
 
 checkPermissions (User $user, $reason)
 
 isValidMove ()
 Does various sanity checks that the move is valid. More...
 
 move (User $user, $reason, $createRedirect, array $changeTags=[])
 

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...
 

Protected Attributes

Title $newTitle
 
Title $oldTitle
 

Private Member Functions

 moveFile ( $oldTitle, $newTitle)
 Move a file associated with a page to a new location. More...
 
 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...
 

Detailed Description

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

Since
1.24

Definition at line 32 of file MovePage.php.

Constructor & Destructor Documentation

◆ __construct()

MovePage::__construct ( Title  $oldTitle,
Title  $newTitle 
)

Definition at line 44 of file MovePage.php.

References $newTitle, and $oldTitle.

Member Function Documentation

◆ checkPermissions()

MovePage::checkPermissions ( User  $user,
  $reason 
)

Definition at line 49 of file MovePage.php.

References $user, as, EditPage\matchSummarySpamRegex(), Hooks\run(), and wfMergeErrorArrays().

◆ isValidFileMove()

MovePage::isValidFileMove ( )
protected

Sanity checks for when a file is being moved.

Returns
Status

Definition at line 167 of file MovePage.php.

References $file, File\checkExtensionCompatibility(), NS_FILE, wfLocalFile(), and wfStripIllegalFilenameChars().

Referenced by isValidMove().

◆ isValidMove()

MovePage::isValidMove ( )

Does various sanity checks that the move is valid.

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

Returns
Status

Definition at line 90 of file MovePage.php.

References $wgContentHandlerUseDB, ContentHandler\getForTitle(), ContentHandler\getLocalizedName(), isValidFileMove(), isValidMoveTarget(), NS_FILE, and Hooks\run().

◆ isValidMoveTarget()

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 194 of file MovePage.php.

References $content, $file, $rev, Revision\newFromTitle(), NS_FILE, wfDebug(), and wfLocalFile().

Referenced by isValidMove().

◆ move()

MovePage::move ( User  $user,
  $reason,
  $createRedirect,
array  $changeTags = [] 
)
Parameters
User$user
string$reason
bool$createRedirect
string[]$changeTagsChange tags to apply to the entry in the move log. Caller should perform permission checks with ChangeTags::canAddTagsAccompanyingChange
Returns
Status

Definition at line 243 of file MovePage.php.

References $newTitle, $oldTitle, $params, $res, $type, $user, $wgCategoryCollation, DeferredUpdates\addUpdate(), as, DB_MASTER, Title\GAID_FOR_UPDATE, MWNamespace\getCategoryLinkType(), MWNamespace\getSubject(), moveFile(), moveToInternal(), StatusValue\newGood(), NS_FILE, Hooks\run(), Collation\singleton(), use, wfGetDB(), and wfMessage().

◆ moveFile()

MovePage::moveFile (   $oldTitle,
  $newTitle 
)
private

Move a file associated with a page to a new location.

Can also be used to revert after a DB failure.

Access:\n private
Parameters
Title$oldTitleOld location to move the file from.
Title$newTitleNew location to move the file to.
Returns
Status

Definition at line 434 of file MovePage.php.

References $file, $newTitle, $oldTitle, cache, Title\getPrefixedText(), StatusValue\newFatal(), RepoGroup\singleton(), and wfLocalFile().

Referenced by move().

◆ moveToInternal()

MovePage::moveToInternal ( User  $user,
$nt,
  $reason = '',
  $createRedirect = true,
array  $changeTags = [] 
)
private

Move page to a title which is either a redirect to the source page or nonexistent.

Todo:
This was basically directly moved from Title, it should be split into smaller functions
Parameters
User$userthe User doing the move
Title$ntThe page to move to, which should be a redirect or non-existent
string$reasonThe reason for the move
bool$createRedirectWhether to leave a redirect at the old title. Does not check if the user has the suppressredirect right
string[]$changeTagsChange tags to apply to the entry in the move log
Returns
Revision the revision created by the move
Exceptions
MWException

Definition at line 467 of file MovePage.php.

References $oldTitle, $user, ChangeTags\addTags(), DB_MASTER, WikiPage\factory(), ContentHandler\getDefaultModelFor(), ContentHandler\getForTitle(), ChangeTags\getSoftwareTags(), Revision\insertOn(), RequestContext\newExtraneousContext(), LogFormatter\newFromEntry(), Revision\newNullRevision(), NS_CATEGORY, WikiPage\onArticleCreate(), WikiPage\onArticleDelete(), plain, IDBAccessObject\READ_LOCKING, Hooks\run(), wfGetDB(), and wfMessage().

Referenced by move().

Member Data Documentation

◆ $newTitle

Title MovePage::$newTitle
protected

Definition at line 42 of file MovePage.php.

Referenced by __construct(), move(), and moveFile().

◆ $oldTitle

Title MovePage::$oldTitle
protected

Definition at line 37 of file MovePage.php.

Referenced by __construct(), move(), moveFile(), and moveToInternal().


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