// Yes, the use of getVal() and getText() is wanted, see bug 20365
$oldTitleText = $request->getVal( 'wpOldTitle', $target );
- if ( is_string( $oldTitleText ) ) {
- $this->oldTitle = Title::newFromText( $oldTitleText );
- }
+ $this->oldTitle = Title::newFromText( $oldTitleText );
- if ( $this->oldTitle === null ) {
+ if ( !$this->oldTitle ) {
// Either oldTitle wasn't passed, or newFromText returned null
throw new ErrorPageError( 'notargettitle', 'notargettext' );
}
$out->addModuleStyles( 'mediawiki.special.movePage.styles' );
$this->addHelpLink( 'Help:Moving a page' );
+ if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
+ $out->wrapWikiMsg(
+ "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
+ 'moveuserpage-warning'
+ );
+ } elseif ( $this->oldTitle->getNamespace() == NS_CATEGORY ) {
+ $out->wrapWikiMsg(
+ "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
+ 'movecategorypage-warning'
+ );
+ }
+
+ $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
+ 'movepagetext' :
+ 'movepagetext-noredirectfixer'
+ );
+ $submitVar = 'wpMove';
+ $confirm = false;
+
$newTitle = $this->newTitle;
if ( !$newTitle ) {
&& $newTitle->quickUserCan( 'delete', $user )
) {
$out->addWikiMsg( 'delete_and_move_text', $newTitle->getPrefixedText() );
- $movepagebtn = $this->msg( 'delete_and_move' )->text();
$submitVar = 'wpDeleteAndMove';
$confirm = true;
$err = array();
- } else {
- if ( $this->oldTitle->getNamespace() == NS_USER && !$this->oldTitle->isSubpage() ) {
- $out->wrapWikiMsg(
- "<div class=\"error mw-moveuserpage-warning\">\n$1\n</div>",
- 'moveuserpage-warning'
- );
- } elseif ( $this->oldTitle->getNamespace() == NS_CATEGORY ) {
- $out->wrapWikiMsg(
- "<div class=\"error mw-movecategorypage-warning\">\n$1\n</div>",
- 'movecategorypage-warning'
- );
- }
-
- $out->addWikiMsg( $this->getConfig()->get( 'FixDoubleRedirects' ) ?
- 'movepagetext' :
- 'movepagetext-noredirectfixer'
- );
- $movepagebtn = $this->msg( 'movepagebtn' )->text();
- $submitVar = 'wpMove';
- $confirm = false;
}
if ( count( $err ) == 1 && isset( $err[0][0] ) && $err[0][0] == 'file-exists-sharedrepo'
'infusable' => true,
) ),
array(
- 'label' => $this->msg( 'move-new-title' )->text(),
+ 'label' => $this->msg( 'newtitle' )->text(),
'align' => 'top',
)
);
$fields[] = new OOUI\FieldLayout(
new OOUI\ButtonInputWidget( array(
'name' => $submitVar,
- 'value' => $movepagebtn,
- 'label' => $movepagebtn,
+ 'value' => $this->msg( 'movepagebtn' )->text(),
+ 'label' => $this->msg( 'movepagebtn' )->text(),
'flags' => array( 'constructive', 'primary' ),
'type' => 'submit',
) ),
* than a more direct method, but this is not a highly performance-cri-
* tical code path and readable code is more important here.
*
- * Note: this query works nicely on MySQL 5, but the optimizer in MySQL
- * 4 might get confused. If so, consider rewriting as a UNION.
- *
* If the target namespace doesn't allow subpages, moving with subpages
* would mean that you couldn't move them back in one operation, which
* is bad.