# Note that wpSectionTitle is not yet a part of the actual edit form, as wpSummary is
# currently doing double duty as both edit summary and section title. Right now this
# is just to allow API edits to work around this limitation, but this should be
- # incorporated into the actual edit form when EditPage is rewritten (Bugs 18654, 26312).
+ # incorporated into the actual edit form when EditPage is rewritten (T20654, T28312).
$this->sectiontitle = $request->getText( 'wpSectionTitle' );
$this->sectiontitle = preg_replace( '/^\s*=+\s*(.*?)\s*=+\s*$/', '$1', $this->sectiontitle );
!$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',
$this->context->msg( 'undo-' . $undoMsg )->plain() . '</div>', 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 );
}
$title = Title::newFromText( $this->editintro );
if ( $title instanceof Title && $title->exists() && $title->userCan( 'read' ) ) {
// Added using template syntax, to take <noinclude>'s into account.
- $this->context->getOutput()->addWikiTextTitleTidy(
+ $this->context->getOutput()->addWikiTextAsContent(
'<div class="mw-editintro">{{:' . $title->getFullText() . '}}</div>',
+ /*linestart*/true,
$this->mTitle
);
return true;
*
* @param string|null|bool $text Text to unserialize
* @return Content|bool|null The content object created from $text. If $text was false
- * or null, false resp. null will be returned instead.
+ * or null, then false or null will be returned instead.
*
* @throws MWException If unserializing the text results in a Content
* object that is not an instance of TextContent and
$this->contentFormat,
$ex->getMessage()
);
- $out->addWikiText( '<div class="error">' . $msg->text() . '</div>' );
+ $out->addWikiText( '<div class="error">' . $msg->plain() . '</div>' );
}
}
$this->contentFormat,
$ex->getMessage()
);
- $out->addWikiText( '<div class="error">' . $msg->text() . '</div>' );
+ $out->addWikiText( '<div class="error">' . $msg->plain() . '</div>' );
}
}
}