X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FEditPage.php;h=f1f0572bacebe83fc6ab632d0baf6b6b0edc202f;hb=0f65db0f2a5e40e17474b9dfea1d0516e697dd5b;hp=6b4dcc21c819f0d24d459d2d39d46c3d971b739d;hpb=fede766fe9950e3a036c263bf17d19d31278221c;p=lhc%2Fweb%2Fwiklou.git
diff --git a/includes/EditPage.php b/includes/EditPage.php
index 6b4dcc21c8..f1f0572bac 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1689,7 +1689,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;
}
@@ -2490,6 +2490,8 @@ ERROR;
$displayTitle = isset( $this->mParserOutput ) ? $this->mParserOutput->getDisplayTitle() : false;
if ( $displayTitle === false ) {
$displayTitle = $contextTitle->getPrefixedText();
+ } else {
+ $out->setDisplayTitle( $displayTitle );
}
$out->setPageTitle( $this->context->msg( $msg, $displayTitle ) );
@@ -3786,7 +3788,7 @@ ERROR;
/**
* Get the last log record of this page being deleted, if ever. This is
- * used to detect whether a delete occured during editing.
+ * used to detect whether a delete occurred during editing.
* @return bool|stdClass
*/
protected function getLastDelete() {
@@ -3997,6 +3999,12 @@ ERROR;
$parserOptions->setIsPreview( true );
$parserOptions->setIsSectionPreview( !is_null( $this->section ) && $this->section !== '' );
$parserOptions->enableLimitReport();
+
+ // XXX: we could call $parserOptions->setCurrentRevisionCallback here to force the
+ // current revision to be null during PST, until setupFakeRevision is called on
+ // the ParserOptions. Currently, we rely on Parser::getRevisionObject() to ignore
+ // existing revisions in preview mode.
+
return $parserOptions;
}
@@ -4012,9 +4020,14 @@ ERROR;
protected function doPreviewParse( Content $content ) {
$user = $this->context->getUser();
$parserOptions = $this->getPreviewParserOptions();
+
+ // NOTE: preSaveTransform doesn't have a fake revision to operate on.
+ // Parser::getRevisionObject() will return null in preview mode,
+ // causing the context user to be used for {{subst:REVISIONUSER}}.
+ // XXX: Alternatively, we could also call setupFakeRevision() a second time:
+ // once before PST with $content, and then after PST with $pstContent.
$pstContent = $content->preSaveTransform( $this->mTitle, $user, $parserOptions );
- $scopedCallback = $parserOptions->setupFakeRevision(
- $this->mTitle, $pstContent, $user );
+ $scopedCallback = $parserOptions->setupFakeRevision( $this->mTitle, $pstContent, $user );
$parserOutput = $pstContent->getParserOutput( $this->mTitle, null, $parserOptions );
ScopedCallback::consume( $scopedCallback );
return [