X-Git-Url: https://git.cyclocoop.org/%242?a=blobdiff_plain;f=includes%2FMovePage.php;h=a8f6f8e2e670f0195882e940f6836cfd48391644;hb=7a406355f8438ae77412847706f52f4ff8d8b073;hp=bc3305ab0482e727d6c630a4584d9add3b7ad3da;hpb=4b70bc2b284c6f91b310eb961b4e43b68eb54c9a;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/MovePage.php b/includes/MovePage.php index bc3305ab04..a8f6f8e2e6 100644 --- a/includes/MovePage.php +++ b/includes/MovePage.php @@ -131,6 +131,14 @@ class MovePage { ContentHandler::getLocalizedName( $this->oldTitle->getContentModel() ), ContentHandler::getLocalizedName( $this->newTitle->getContentModel() ) ); + } elseif ( + !ContentHandler::getForTitle( $this->oldTitle )->canBeUsedOn( $this->newTitle ) + ) { + $status->fatal( + 'content-not-allowed-here', + ContentHandler::getLocalizedName( $this->oldTitle->getContentModel() ), + $this->newTitle->getPrefixedText() + ); } // Image-specific checks @@ -297,19 +305,25 @@ class MovePage { if ( $protected ) { # Protect the redirect title as the title used to be... - $dbw->insertSelect( 'page_restrictions', 'page_restrictions', - [ - 'pr_page' => $redirid, - 'pr_type' => 'pr_type', - 'pr_level' => 'pr_level', - 'pr_cascade' => 'pr_cascade', - 'pr_user' => 'pr_user', - 'pr_expiry' => 'pr_expiry' - ], + $res = $dbw->select( + 'page_restrictions', + '*', [ 'pr_page' => $pageid ], __METHOD__, - [ 'IGNORE' ] + 'FOR UPDATE' ); + $rowsInsert = []; + foreach ( $res as $row ) { + $rowsInsert[] = [ + 'pr_page' => $redirid, + 'pr_type' => $row->pr_type, + 'pr_level' => $row->pr_level, + 'pr_cascade' => $row->pr_cascade, + 'pr_user' => $row->pr_user, + 'pr_expiry' => $row->pr_expiry + ]; + } + $dbw->insert( 'page_restrictions', $rowsInsert, __METHOD__, [ 'IGNORE' ] ); // Build comment for log $comment = wfMessage( @@ -440,7 +454,7 @@ class MovePage { $status = $newpage->doDeleteArticleReal( $overwriteMessage, /* $suppress */ false, - $nt->getArticleId(), + $nt->getArticleID(), /* $commit */ false, $errs, $user @@ -525,8 +539,8 @@ class MovePage { __METHOD__ ); - // clean up the old title before reset article id - bug 45348 if ( !$redirectContent ) { + // Clean up the old title *before* reset article id - bug 45348 WikiPage::onArticleDelete( $this->oldTitle ); }