mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-13 17:57:21 +00:00
Use internal diff engine
wfDiff() is deprecated and using the internal diff engine is recommended as replacement. Bug: T93625 Change-Id: I60af08888ef4e0bc9b80b75495f6e9e3fa631002
This commit is contained in:
parent
1110f038c7
commit
a1cb603bb3
|
@ -77,9 +77,12 @@ class EchoDiffParser {
|
||||||
* 'left_pos' and 'right_pos' (in 1-indexed lines) of the change.
|
* 'left_pos' and 'right_pos' (in 1-indexed lines) of the change.
|
||||||
*/
|
*/
|
||||||
public function getChangeSet( $leftText, $rightText ) {
|
public function getChangeSet( $leftText, $rightText ) {
|
||||||
$left = trim( $leftText ) . "\n";
|
$left = trim( $leftText );
|
||||||
$right = trim( $rightText ) . "\n";
|
$right = trim( $rightText );
|
||||||
$diff = wfDiff( $left, $right, '-u -w' );
|
|
||||||
|
$diffs = new Diff( explode( "\n", $left ), explode( "\n", $right ) );
|
||||||
|
$format = new UnifiedDiffFormatter();
|
||||||
|
$diff = $format->format( $diffs );
|
||||||
|
|
||||||
return $this->parse( $diff, $left, $right );
|
return $this->parse( $diff, $left, $right );
|
||||||
}
|
}
|
||||||
|
@ -87,15 +90,11 @@ class EchoDiffParser {
|
||||||
/**
|
/**
|
||||||
* Duplicates the check from the global wfDiff function to determine
|
* Duplicates the check from the global wfDiff function to determine
|
||||||
* if we are using internal or external diff utilities
|
* if we are using internal or external diff utilities
|
||||||
|
*
|
||||||
|
* @deprecated since 1.29, the internal diff parser is always used
|
||||||
*/
|
*/
|
||||||
protected static function usingInternalDiff() {
|
protected static function usingInternalDiff() {
|
||||||
global $wgDiff;
|
return true;
|
||||||
|
|
||||||
wfSuppressWarnings();
|
|
||||||
$haveDiff = $wgDiff && file_exists( $wgDiff );
|
|
||||||
wfRestoreWarnings();
|
|
||||||
|
|
||||||
return !$haveDiff;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue