diff options
-rw-r--r-- | RELEASE-NOTES-1.35 | 9 | ||||
-rw-r--r-- | includes/parser/CoreMagicWords.php | 4 | ||||
-rw-r--r-- | includes/parser/CoreParserFunctions.php | 7 | ||||
-rw-r--r-- | includes/parser/Parser.php | 12 |
4 files changed, 19 insertions, 13 deletions
diff --git a/RELEASE-NOTES-1.35 b/RELEASE-NOTES-1.35 index 86b7a2a8a296..54144c2d9233 100644 --- a/RELEASE-NOTES-1.35 +++ b/RELEASE-NOTES-1.35 @@ -966,10 +966,11 @@ because of Phabricator reports. Previously, the third parameter was unused. Using the old signature is hard deprecated. * Passing Article to ParserCache::get() was deprecated -* Parser::fetchCurrentRevisionOfTitle, ::statelessFetchRevision, and - ::getRevisionObject were soft deprecated in favor of the new - ::fetchCurrentRevisionRecordOfTitle, ::statelessFetchRevisionRecord, - and ::getRevisionRecordObject methods respectively. +* Parser::fetchCurrentRevisionOfTitle and ::statelessFetchRevision were soft + deprecated in favor of the new ::fetchCurrentRevisionRecordOfTitle and + ::statelessFetchRevisionRecord methods respectively. +* Parser::getRevisionObject was hard deprecated in favor of the new + ::getRevisionRecordObject method. * ParserOptions::getCurrentRevisionCallback and ::setCurrentRevisionCallback were soft deprecated in favor of the new ::getCurrentRevisionRecordCallback and ::setCurrentRevisionRecordCallback methods respectively. diff --git a/includes/parser/CoreMagicWords.php b/includes/parser/CoreMagicWords.php index 732e7adad8a7..1eaaffe37a8c 100644 --- a/includes/parser/CoreMagicWords.php +++ b/includes/parser/CoreMagicWords.php @@ -168,7 +168,7 @@ class CoreMagicWords { self::setOutputFlag( $parser, $logger, 'vary-revision-id', '{{REVISIONID}} used' ); $value = $parser->getRevisionId(); if ( $value === 0 ) { - $rev = $parser->getRevisionObject(); + $rev = $parser->getRevisionRecordObject(); $value = $rev ? $rev->getId() : $value; } if ( !$value ) { @@ -332,7 +332,7 @@ class CoreMagicWords { // Get the timezone-adjusted timestamp to be used for this revision $resNow = substr( $parser->getRevisionTimestamp(), $start, $len ); // Possibly set vary-revision if there is not yet an associated revision - if ( !$parser->getRevisionObject() ) { + if ( !$parser->getRevisionRecordObject() ) { // Get the timezone-adjusted timestamp $mtts seconds in the future. // This future is relative to the current time and not that of the // parser options. The rendered timestamp can be compared to that diff --git a/includes/parser/CoreParserFunctions.php b/includes/parser/CoreParserFunctions.php index 92b06fefb464..358cc9ddd8d2 100644 --- a/includes/parser/CoreParserFunctions.php +++ b/includes/parser/CoreParserFunctions.php @@ -1149,8 +1149,11 @@ class CoreParserFunctions { // Revision is for the same title that is currently being parsed. Only use the last // saved revision, regardless of Parser::getRevisionId() or fake revision injection // callbacks against the current title. - $parserRevision = $parser->getRevisionObject(); - if ( $parserRevision && $parserRevision->isCurrent() ) { + $parserRevisionRecord = $parser->getRevisionRecordObject(); + if ( $parserRevisionRecord && $parserRevisionRecord->isCurrent() ) { + // TODO refactor this method to return RevisionRecord + // and remove the use of Revision here + $parserRevision = new Revision( $parserRevisionRecord ); $revision = $parserRevision; } } diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index a3773794e131..9121e11be9c3 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -5733,6 +5733,8 @@ class Parser { * @since 1.23 (public since 1.23) */ public function getRevisionObject() { + wfDeprecated( __METHOD__, '1.35' ); + if ( $this->mRevisionObject ) { return $this->mRevisionObject; } @@ -5805,7 +5807,7 @@ class Parser { } # Use specified revision timestamp, falling back to the current timestamp - $revObject = $this->getRevisionObject(); + $revObject = $this->getRevisionRecordObject(); $timestamp = $revObject ? $revObject->getTimestamp() : $this->mOptions->getTimestamp(); $this->mOutput->setRevisionTimestampUsed( $timestamp ); // unadjusted time zone @@ -5826,12 +5828,12 @@ class Parser { */ public function getRevisionUser(): ?string { if ( $this->mRevisionUser === null ) { - $revObject = $this->getRevisionObject(); + $revObject = $this->getRevisionRecordObject(); # if this template is subst: the revision id will be blank, # so just use the current user's name - if ( $revObject ) { - $this->mRevisionUser = $revObject->getUserText(); + if ( $revObject && $revObject->getUser() ) { + $this->mRevisionUser = $revObject->getUser()->getName(); } elseif ( $this->ot['wiki'] || $this->mOptions->getIsPreview() ) { $this->mRevisionUser = $this->getUser()->getName(); } else { @@ -5849,7 +5851,7 @@ class Parser { */ public function getRevisionSize() { if ( $this->mRevisionSize === null ) { - $revObject = $this->getRevisionObject(); + $revObject = $this->getRevisionRecordObject(); # if this variable is subst: the revision id will be blank, # so just use the parser input size, because the own substituation |