From: Alexandre Emsenhuber Date: Mon, 26 Dec 2011 15:54:10 +0000 (+0000) Subject: In EditPage::showDiff(): X-Git-Tag: 1.31.0-rc.0~25743 X-Git-Url: http://git.cyclocoop.org/data/Luca_Pacioli_%28Gemaelde%29.jpeg?a=commitdiff_plain;h=286d7be039d0711289bac7f0743cb67b91a4e174;p=lhc%2Fweb%2Fwiklou.git In EditPage::showDiff(): * Group global declarations * Only get 'currentrev' and 'yourtext' messages if needed --- diff --git a/includes/EditPage.php b/includes/EditPage.php index 8358cc56bc..a443f6dd17 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -2163,7 +2163,7 @@ HTML * save and then make a comparison. */ function showDiff() { - global $wgUser, $wgContLang, $wgParser; + global $wgUser, $wgContLang, $wgParser, $wgOut; if ( $this->section == 'new' ) { $oldtext = $this->mArticle->getRawText(); @@ -2177,9 +2177,11 @@ HTML $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); $newtext = $wgParser->preSaveTransform( $newtext, $this->mTitle, $wgUser, $popts ); - $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) ); - $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) ); + if ( $oldtext !== false || $newtext != '' ) { + $oldtitle = wfMsgExt( 'currentrev', array( 'parseinline' ) ); + $newtitle = wfMsgExt( 'yourtext', array( 'parseinline' ) ); + $de = new DifferenceEngine( $this->mArticle->getContext() ); $de->setText( $oldtext, $newtext ); $difftext = $de->getDiff( $oldtitle, $newtitle ); @@ -2188,7 +2190,6 @@ HTML $difftext = ''; } - global $wgOut; $wgOut->addHTML( '
' . $difftext . '
' ); }