* @param array $err Error messages. Each item is an error message.
* It may either be a string message name or array message name and
* parameters, like the second argument to OutputPage::wrapWikiMsg().
+ * @param bool $isPermError Whether the error message is about user permissions.
*/
- function showForm( $err ) {
+ function showForm( $err, $isPermError = false ) {
$this->getSkin()->setRelevantTitle( $this->oldTitle );
$out = $this->getOutput();
}
if ( count( $err ) ) {
- $action_desc = $this->msg( 'action-move' )->plain();
- $errMsgHtml = $this->msg( 'permissionserrorstext-withaction',
- count( $err ), $action_desc )->parseAsBlock();
+ if ( $isPermError ) {
+ $action_desc = $this->msg( 'action-move' )->plain();
+ $errMsgHtml = $this->msg( 'permissionserrorstext-withaction',
+ count( $err ), $action_desc )->parseAsBlock();
+ } else {
+ $errMsgHtml = $this->msg( 'cannotmove', count( $err ) )->parseAsBlock();
+ }
if ( count( $err ) == 1 ) {
$errMsg = $err[0];
$permErrors = $nt->getUserPermissionsErrors( 'delete', $user );
if ( count( $permErrors ) ) {
# Only show the first error
- $this->showForm( $permErrors );
+ $this->showForm( $permErrors, true );
+
+ return;
+ }
+
+ $page = WikiPage::factory( $nt );
+
+ // Small safety margin to guard against concurrent edits
+ if ( $page->isBatchedDelete( 5 ) ) {
+ $this->showForm( [ [ 'movepage-delete-first' ] ] );
return;
}
}
$error = ''; // passed by ref
- $page = WikiPage::factory( $nt );
$deleteStatus = $page->doDeleteArticleReal( $reason, false, 0, true, $error, $user );
if ( !$deleteStatus->isGood() ) {
$this->showForm( $deleteStatus->getErrorsArray() );
$permStatus = $mp->checkPermissions( $user, $this->reason );
if ( !$permStatus->isOK() ) {
- $this->showForm( $permStatus->getErrorsArray() );
+ $this->showForm( $permStatus->getErrorsArray(), true );
return;
}
# 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 ) {