X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialMovepage.php;h=a2b5be43543141d1bb80689abaf661c5b2b35105;hb=ccc1c08089b6596bc20f6d88db1909f57fab2498;hp=7d8a493a8d411c41645a651f3252ff83684b8219;hpb=cbac334f116c6546c422a67ce99d2a56eb792d30;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialMovepage.php b/includes/specials/SpecialMovepage.php index 7d8a493a8d..d30ff4329d 100644 --- a/includes/specials/SpecialMovepage.php +++ b/includes/specials/SpecialMovepage.php @@ -105,7 +105,7 @@ class MovePageForm extends UnlistedSpecialPage { $permErrors = $this->oldTitle->getUserPermissionsErrors( 'move', $user ); if ( count( $permErrors ) ) { // Auto-block user's IP if the account was "hard" blocked - DeferredUpdates::addCallableUpdate( function() use ( $user ) { + DeferredUpdates::addCallableUpdate( function () use ( $user ) { $user->spreadAnyEditBlock(); } ); throw new PermissionsError( 'move', $permErrors ); @@ -235,18 +235,18 @@ class MovePageForm extends UnlistedSpecialPage { } if ( count( $err ) ) { - $out->addHTML( "
\n" ); $action_desc = $this->msg( 'action-move' )->plain(); - $out->addWikiMsg( 'permissionserrorstext-withaction', count( $err ), $action_desc ); + $errMsgHtml = $this->msg( 'permissionserrorstext-withaction', + count( $err ), $action_desc )->parseAsBlock(); if ( count( $err ) == 1 ) { $errMsg = $err[0]; $errMsgName = array_shift( $errMsg ); if ( $errMsgName == 'hookaborted' ) { - $out->addHTML( "

{$errMsg[0]}

\n" ); + $errMsgHtml .= "

{$errMsg[0]}

\n"; } else { - $out->addWikiMsgArray( $errMsgName, $errMsg ); + $errMsgHtml .= $this->msg( $errMsgName, $errMsg )->parseAsBlock(); } } else { $errStr = []; @@ -260,9 +260,9 @@ class MovePageForm extends UnlistedSpecialPage { } } - $out->addHTML( '\n" ); + $errMsgHtml .= '\n"; } - $out->addHTML( "
\n" ); + $out->addHTML( Html::errorBox( $errMsgHtml ) ); } if ( $this->oldTitle->isProtected( 'move' ) ) { @@ -287,8 +287,8 @@ class MovePageForm extends UnlistedSpecialPage { $out->addHTML( "\n" ); } - // Byte limit (not string length limit) for wpReason and wpNewTitleMain - // is enforced in the mediawiki.special.movePage module + // Length limit for wpReason and wpNewTitleMain is enforced in the + // mediawiki.special.movePage module $immovableNamespaces = []; foreach ( array_keys( $this->getLanguage()->getNamespaces() ) as $nsId ) { @@ -326,11 +326,16 @@ class MovePageForm extends UnlistedSpecialPage { ] ); + // HTML maxlength uses "UTF-16 code units", which means that characters outside BMP + // (e.g. emojis) count for two each. This limit is overridden in JS to instead count + // Unicode codepoints (or 255 UTF-8 bytes for old schema). + $conf = $this->getConfig(); + $oldCommentSchema = $conf->get( 'CommentTableSchemaMigrationStage' ) === MIGRATION_OLD; $fields[] = new OOUI\FieldLayout( new OOUI\TextInputWidget( [ 'name' => 'wpReason', 'id' => 'wpReason', - 'maxLength' => 200, + 'maxLength' => $oldCommentSchema ? 200 : CommentStore::COMMENT_CHARACTER_LIMIT, 'infusable' => true, 'value' => $this->reason, ] ), @@ -776,6 +781,12 @@ class MovePageForm extends UnlistedSpecialPage { # Deal with watches (we don't watch subpages) WatchAction::doWatchOrUnwatch( $this->watch, $ot, $user ); WatchAction::doWatchOrUnwatch( $this->watch, $nt, $user ); + + /** + * T163966 + * Increment user_editcount during page moves + */ + $user->incEditCount(); } function showLogFragment( $title ) {