aboutsummaryrefslogtreecommitdiffstats
path: root/includes/parser
diff options
context:
space:
mode:
authorDannyS712 <DannyS712.enwiki@gmail.com>2020-04-17 20:29:22 +0000
committerDannyS712 <DannyS712.enwiki@gmail.com>2020-04-28 21:02:58 +0000
commitb8e69031838e70f7985b5a0a41301124ec617e93 (patch)
tree6ec89f158c60e3123f4815879846883f413cd918 /includes/parser
parent72a97878f6436fabd045d0ec23452615d6e91af7 (diff)
downloadmediawikicore-b8e69031838e70f7985b5a0a41301124ec617e93.tar.gz
mediawikicore-b8e69031838e70f7985b5a0a41301124ec617e93.zip
Replace uses and hard deprecate Parser::getRevisionObject
Also removes a use of Revision::getUserText Bug: T249384 Bug: T250579 Change-Id: I9c7763cc1d3442cd41d1ffc804fb18bfbd8be84f
Diffstat (limited to 'includes/parser')
-rw-r--r--includes/parser/CoreMagicWords.php4
-rw-r--r--includes/parser/CoreParserFunctions.php7
-rw-r--r--includes/parser/Parser.php12
3 files changed, 14 insertions, 9 deletions
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