From fbc636d39d7493c6a8bbfcc0ce0a374de9c31297 Mon Sep 17 00:00:00 2001 From: Brad Jorsch Date: Tue, 7 Apr 2015 11:11:21 -0400 Subject: [PATCH] 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 --- includes/page/Article.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/page/Article.php b/includes/page/Article.php index eb597d2924..91e9971573 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -378,7 +378,7 @@ class Article implements Page { # 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 @@ class Article implements Page { } } } 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; } } -- 2.20.1