From: Lupin Date: Wed, 1 Mar 2006 03:28:48 +0000 (+0000) Subject: Bug 5136: corner cases with relative oldids are wrong X-Git-Tag: 1.6.0~251 X-Git-Url: https://git.cyclocoop.org/admin/?a=commitdiff_plain;ds=sidebyside;h=2f256763f0f70563e576f390adc8ee33e4e95daf;p=lhc%2Fweb%2Fwiklou.git Bug 5136: corner cases with relative oldids are wrong --- diff --git a/includes/RawPage.php b/includes/RawPage.php index b622fec433..0e46df5bde 100644 --- a/includes/RawPage.php +++ b/includes/RawPage.php @@ -44,10 +44,21 @@ class RawPage { $oldid = $this->mRequest->getInt( 'oldid' ); switch ( $wgRequest->getText( 'direction' ) ) { case 'next': - $oldid = $this->mTitle->getNextRevisionId( $oldid ); + # output next revision, or nothing if there isn't one + if ( $oldid ) { + $oldid = $this->mTitle->getNextRevisionId( $oldid ); + } + $oldid = $oldid ? $oldid : -1; break; case 'prev': - $oldid = $this->mTitle->getPreviousRevisionId( $oldid ); + # output previous revision, or nothing if there isn't one + if ( ! $oldid ) { + # get the current revision so we can get the penultimate one + $this->mArticle->getTouched(); + $oldid = $this->mArticle->mLatest; + } + $prev = $this->mTitle->getPreviousRevisionId( $oldid ); + $oldid = $prev ? $prev : -1 ; break; case 'cur': $oldid = 0;