mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-11 17:00:10 +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.
|
||||
*/
|
||||
public function getChangeSet( $leftText, $rightText ) {
|
||||
$left = trim( $leftText ) . "\n";
|
||||
$right = trim( $rightText ) . "\n";
|
||||
$diff = wfDiff( $left, $right, '-u -w' );
|
||||
$left = trim( $leftText );
|
||||
$right = trim( $rightText );
|
||||
|
||||
$diffs = new Diff( explode( "\n", $left ), explode( "\n", $right ) );
|
||||
$format = new UnifiedDiffFormatter();
|
||||
$diff = $format->format( $diffs );
|
||||
|
||||
return $this->parse( $diff, $left, $right );
|
||||
}
|
||||
|
@ -87,15 +90,11 @@ class EchoDiffParser {
|
|||
/**
|
||||
* Duplicates the check from the global wfDiff function to determine
|
||||
* if we are using internal or external diff utilities
|
||||
*
|
||||
* @deprecated since 1.29, the internal diff parser is always used
|
||||
*/
|
||||
protected static function usingInternalDiff() {
|
||||
global $wgDiff;
|
||||
|
||||
wfSuppressWarnings();
|
||||
$haveDiff = $wgDiff && file_exists( $wgDiff );
|
||||
wfRestoreWarnings();
|
||||
|
||||
return !$haveDiff;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue