X-Git-Url: http://git.cyclocoop.org/%22.%28%24lien.?a=blobdiff_plain;f=includes%2Fdiff%2FDifferenceEngine.php;h=5f6974eac5a30bef8c6312f8c4f6263aa53c3170;hb=43a548a5c3436b5d07091b504bbf5eb80d1ed215;hp=0b58cc1bc63ef45ab6d8e4ab29d0e00eee46ba06;hpb=098a93b2ed96e1c953a36f9e9bc988164afd5425;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 0b58cc1bc6..5f6974eac5 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -908,10 +908,35 @@ class DifferenceEngine extends ContextSource { $wgExternalDiffEngine = false; } + // Better external diff engine, the 2 may some day be dropped + // This one does the escaping and segmenting itself if ( function_exists( 'wikidiff2_do_diff' ) && $wgExternalDiffEngine === false ) { - # Better external diff engine, the 2 may some day be dropped - # This one does the escaping and segmenting itself - $text = wikidiff2_do_diff( $otext, $ntext, 2 ); + $wikidiff2Version = phpversion( 'wikidiff2' ); + if ( + $wikidiff2Version !== false && + version_compare( $wikidiff2Version, '0.3.0', '>=' ) + ) { + $text = wikidiff2_do_diff( + $otext, + $ntext, + 2, + $this->getConfig()->get( 'WikiDiff2MovedParagraphDetectionCutoff' ) + ); + } else { + // Don't pass the 4th parameter for compatibility with older versions of wikidiff2 + $text = wikidiff2_do_diff( + $otext, + $ntext, + 2 + ); + + // Log a warning in case the configuration value is set to not silently ignore it + if ( $this->getConfig()->get( 'WikiDiff2MovedParagraphDetectionCutoff' ) > 0 ) { + wfLogWarning( '$wgWikiDiff2MovedParagraphDetectionCutoff is set but has no + effect since the used version of WikiDiff2 does not support it.' ); + } + } + $text .= $this->debug( 'wikidiff2' ); return $text;