From: Brad Jorsch Date: Tue, 7 Apr 2015 15:11:21 +0000 (-0400) Subject: Report correct rev_id in missing-revision message X-Git-Tag: 1.31.0-rc.0~11800^2 X-Git-Url: http://git.cyclocoop.org/%24action?a=commitdiff_plain;h=fbc636d39d7493c6a8bbfcc0ce0a374de9c31297;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; } }