mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-11-23 21:53:35 +00:00
Replace custom regex with TextContent::normalizeLineEndings()
This does the same as before, replacing \r\n as well as \r with \n. Additionally the new method applies an rtrim() on both strings. I believe this is even a good thing. It possibly removes irrelevant noise from the diff. Change-Id: I584740a24e6b25bbcbc928c2369f09b785a485c8
This commit is contained in:
parent
208398d96b
commit
0e8a08ebca
|
@ -16,6 +16,7 @@ use MediaWiki\Extension\AbuseFilter\SpecsFormatter;
|
|||
use MediaWiki\Extension\AbuseFilter\TableDiffFormatterFullContext;
|
||||
use MediaWiki\Linker\LinkRenderer;
|
||||
use OOUI;
|
||||
use TextContent;
|
||||
use Xml;
|
||||
|
||||
class AbuseFilterViewDiff extends AbuseFilterView {
|
||||
|
@ -336,10 +337,10 @@ class AbuseFilterViewDiff extends AbuseFilterView {
|
|||
*/
|
||||
public function getDiffRow( $msg, $old, $new ) {
|
||||
if ( !is_array( $old ) ) {
|
||||
$old = explode( "\n", preg_replace( "/\\\r\\\n?/", "\n", $old ) );
|
||||
$old = explode( "\n", TextContent::normalizeLineEndings( $old ) );
|
||||
}
|
||||
if ( !is_array( $new ) ) {
|
||||
$new = explode( "\n", preg_replace( "/\\\r\\\n?/", "\n", $new ) );
|
||||
$new = explode( "\n", TextContent::normalizeLineEndings( $new ) );
|
||||
}
|
||||
|
||||
if ( $old === $new ) {
|
||||
|
|
Loading…
Reference in a new issue