jenkins-bot has submitted this change and it was merged.

Change subject: Report correct rev_id in missing-revision message
......................................................................


Report correct rev_id in missing-revision message

When trying to fetch the current revision, it currently always reports
"0" even when it's trying to fetch some other revision.

Bug: T92046
Change-Id: Ia5eb73ac32de0f654ac28ee929d5c4dda71c2f1b
---
M includes/page/Article.php
1 file changed, 7 insertions(+), 4 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/page/Article.php b/includes/page/Article.php
index eb597d2..91e9971 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -378,7 +378,7 @@
                # Pre-fill content with error message so that if something
                # fails we'll have something telling us what we intended.
                //XXX: this isn't page content but a UI message. horrible.
-               $this->mContentObject = new MessageContent( 'missing-revision', 
array( $oldid ), array() );
+               $this->mContentObject = new MessageContent( 'missing-revision', 
array( $oldid ) );
 
                if ( $oldid ) {
                        # $this->mRevision might already be fetched by 
getOldIDFromRequest()
@@ -390,17 +390,20 @@
                                }
                        }
                } else {
-                       if ( !$this->mPage->getLatest() ) {
+                       $oldid = $this->mPage->getLatest();
+                       if ( !$oldid ) {
                                wfDebug( __METHOD__ . " failed to find page 
data for title " .
                                        $this->getTitle()->getPrefixedText() . 
"\n" );
                                return false;
                        }
 
+                       # Update error message with correct oldid
+                       $this->mContentObject = new MessageContent( 
'missing-revision', array( $oldid ) );
+
                        $this->mRevision = $this->mPage->getRevision();
 
                        if ( !$this->mRevision ) {
-                               wfDebug( __METHOD__ . " failed to retrieve 
current page, rev_id " .
-                                       $this->mPage->getLatest() . "\n" );
+                               wfDebug( __METHOD__ . " failed to retrieve 
current page, rev_id $oldid\n" );
                                return false;
                        }
                }

-- 
To view, visit https://gerrit.wikimedia.org/r/202408
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ia5eb73ac32de0f654ac28ee929d5c4dda71c2f1b
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Anomie <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Alex Monk <[email protected]>
Gerrit-Reviewer: TheDJ <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to