X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=blobdiff_plain;f=includes%2FEditPage.php;h=7384ca216c5819546c624f2d5665396fbcb2a85d;hp=64b2f013dced7f5d239ebd62a9a7f4471f10c238;hb=1dee28cb5f1efd6d9e14d6cc1d0c73c3f69269b4;hpb=345618340dcab03d517a99bf13cbd0126a149957 diff --git a/includes/EditPage.php b/includes/EditPage.php index 64b2f013dc..7384ca216c 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -1222,7 +1222,9 @@ class EditPage { !$undorev->isDeleted( Revision::DELETED_TEXT ) && !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { - if ( WikiPage::hasDifferencesOutsideMainSlot( $undorev, $oldrev ) ) { + if ( WikiPage::hasDifferencesOutsideMainSlot( $undorev, $oldrev ) + || !$this->isSupportedContentModel( $oldrev->getContentModel() ) + ) { // Hack for undo while EditPage can't handle multi-slot editing $this->context->getOutput()->redirect( $this->mTitle->getFullURL( [ 'action' => 'mcrundo', @@ -1304,6 +1306,32 @@ class EditPage { $this->context->msg( 'undo-' . $undoMsg )->plain() . '', true, /* interface */true ); } + if ( $content === false ) { + // Hack for restoring old revisions while EditPage + // can't handle multi-slot editing. + + $curRevision = $this->page->getRevision(); + $oldRevision = $this->mArticle->getRevisionFetched(); + + if ( $curRevision + && $oldRevision + && $curRevision->getId() !== $oldRevision->getId() + && ( WikiPage::hasDifferencesOutsideMainSlot( $oldRevision, $curRevision ) + || !$this->isSupportedContentModel( $oldRevision->getContentModel() ) ) + ) { + $this->context->getOutput()->redirect( + $this->mTitle->getFullURL( + [ + 'action' => 'mcrrestore', + 'restore' => $oldRevision->getId(), + ] + ) + ); + + return false; + } + } + if ( $content === false ) { $content = $this->getOriginalContent( $user ); } @@ -1689,7 +1717,7 @@ class EditPage { // is if an extension hook aborted from inside ArticleSave. // Render the status object into $this->hookError // FIXME this sucks, we should just use the Status object throughout - $this->hookError = '
' ."\n" . $status->getWikiText() . + $this->hookError = '
' . "\n" . $status->getWikiText() . '
'; return true; }