* Fix backup dump text prefetch for XMLReader constant changes in PHP 5.1
* Suppress useless percentage indicator on output from 7za during dumps
* (bug 4633) Add (previous 200) (next 200) also above catlinks
+* (bug 4686) Fix regression where ?diff=0&oldid=0 caused fatal error on
+ pages with only one revision. Fixes message diff link on first edit.
=== Caveats ===
*/
function DifferenceEngine( $titleObj = null, $old = 0, $new = 0, $rcid = 0 ) {
$this->mTitle = $titleObj;
+ wfDebug("DifferenceEngine old '$old' new '$new' rcid '$rcid'\n");
if ( 'prev' == $new ) {
# Show diff between revision $old and the previous one.
return;
}
- # mOldid is false if the difference engine is called with a "vague" query for
- # a diff between a version V and its previous version V' AND the version V
- # is the first version of that article. In that case, V' does not exist.
- if ( $this->mOldid === false ) {
- $this->showFirstRevision();
- wfProfileOut( $fname );
- return;
- }
-
$t = $this->mTitle->getPrefixedText() . " (Diff: {$this->mOldid}, " .
"{$this->mNewid})";
$mtext = wfMsg( 'missingarticle', "<nowiki>$t</nowiki>" );
$wgOut->setArticleFlag( true );
}
+ # mOldid is false if the difference engine is called with a "vague" query for
+ # a diff between a version V and its previous version V' AND the version V
+ # is the first version of that article. In that case, V' does not exist.
+ if ( $this->mOldid === false ) {
+ $this->showFirstRevision();
+ wfProfileOut( $fname );
+ return;
+ }
+
$wgOut->suppressQuickbar();
$oldTitle = $this->mOldPage->getPrefixedText();
if( $this->mOldid ) {
$this->mOldRev = Revision::newFromId( $this->mOldid );
} elseif ( $this->mOldid === 0 ) {
- $this->mOldRev = $this->mNewRev->getPrevious();
- $this->mOldid = $this->mOldRev->getId();
+ $rev = $this->mNewRev->getPrevious();
+ if( $rev ) {
+ $this->mOldid = $rev->getId();
+ $this->mOldRev = $rev;
+ } else {
+ // No previous revision; mark to show as first-version only.
+ $this->mOldid = false;
+ $this->mOldRev = false;
+ }
}/* elseif ( $this->mOldid === false ) leave mOldRev false; */
if( is_null( $this->mOldRev ) ) {