Pages should never be moved in a way that would change their content model.
Without this explicite check, that might happen when $wgContentHandlerUseDB
is disabled.
Change-Id: Id1a101f56bee6f13a7259d34019c587e75a4c182
* @return Mixed True on success, getUserPermissionsErrors()-like array on failure
*/
public function isValidMoveOperation( &$nt, $auth = true, $reason = '' ) {
- global $wgUser;
+ global $wgUser, $wgContentHandlerUseDB;
$errors = array();
if ( !$nt ) {
$errors[] = array( 'badarticleerror' );
}
+ // Content model checks
+ if ( !$wgContentHandlerUseDB &&
+ $this->getContentModel() !== $nt->getContentModel() ) {
+ // can't move a page if that would change the page's content model
+ $errors[] = array( 'bad-target-model',
+ ContentHandler::getLocalizedName( $this->getContentModel() ),
+ ContentHandler::getLocalizedName( $nt->getContentModel() ) );
+ }
+
// Image-specific checks
if ( $this->getNamespace() == NS_FILE ) {
$errors = array_merge( $errors, $this->validateFileMoveOperation( $nt ) );
'immobile-target-namespace-iw' => 'Interwiki link is not a valid target for page move.',
'immobile-source-page' => 'This page is not movable.',
'immobile-target-page' => 'Cannot move to that destination title.',
+'bad-target-model' => 'The desired destination uses a different content model. Can not convert from $1 to $2.',
'imagenocrossnamespace' => 'Cannot move file to non-file namespace',
'nonfile-cannot-move-to-file' => 'Cannot move non-file to file namespace',
'imagetypemismatch' => 'The new file extension does not match its type',
'immobile-target-namespace-iw' => "This message appears when attempting to move a page, if a person has typed an interwiki link as a namespace prefix in the input box labelled 'To new title'. The special page 'Movepage' cannot be used to move a page to another wiki.
'Destination' can be used instead of 'target' in this message.",
+'bad-target-model' => "This message is shown when attempting to move a page, but the move would change the page's content model.
+This may be the case when \$wgContentHandlerUseDB is set to false, because then a page's content model is derived from the page's title.
+* $1: The localized name of the original page's content model.
+* $2: The localized name of the content model used by the destination title.",
'fix-double-redirects' => 'This is a checkbox in [[Special:MovePage]] which allows to move all redirects from the old title to the new title.',
'protectedpagemovewarning' => 'Related message: [[MediaWiki:protectedpagewarning/{{#titleparts:{{PAGENAME}}|1|2}}]]
{{Related|Semiprotectedpagewarning}}',