From 2eec94991b50945a78336e8cad01c368114dd3d9 Mon Sep 17 00:00:00 2001 From: Adam Wight Date: Wed, 22 May 2019 15:42:20 +0200 Subject: [PATCH] Deprecate $wgWikiDiff2MovedParagraphDetectionCutoff Bug: T194272 Change-Id: I174192dc2b91409e023c06b054bc1bba8bfc571f --- RELEASE-NOTES-1.34 | 4 +++- includes/DefaultSettings.php | 1 + includes/content/ContentHandler.php | 3 --- includes/diff/DifferenceEngine.php | 1 - includes/diff/TextSlotDiffRenderer.php | 19 +------------------ .../diff/TextSlotDiffRendererTest.php | 1 - 6 files changed, 5 insertions(+), 24 deletions(-) diff --git a/RELEASE-NOTES-1.34 b/RELEASE-NOTES-1.34 index f1bdfd30b1..7a7442747d 100644 --- a/RELEASE-NOTES-1.34 +++ b/RELEASE-NOTES-1.34 @@ -38,7 +38,9 @@ For notes on 1.33.x and older releases, see HISTORY. * … ==== Removed configuration ==== -* … +* $wgWikiDiff2MovedParagraphDetectionCutoff — If you still want a custom change + size threshold, please specify in php.ini, using the configuration variable + wikidiff2.moved_paragraph_detection_cutoff. === New user-facing features in 1.34 === * … diff --git a/includes/DefaultSettings.php b/includes/DefaultSettings.php index 69da9c71d9..9efcfb47a3 100644 --- a/includes/DefaultSettings.php +++ b/includes/DefaultSettings.php @@ -8497,6 +8497,7 @@ $wgExternalDiffEngine = false; * See $wgExternalDiffEngine. * * @since 1.30 + * @deprecated since 1.34 */ $wgWikiDiff2MovedParagraphDetectionCutoff = 0; diff --git a/includes/content/ContentHandler.php b/includes/content/ContentHandler.php index b62737d5bb..65a7b7daac 100644 --- a/includes/content/ContentHandler.php +++ b/includes/content/ContentHandler.php @@ -646,9 +646,6 @@ abstract class ContentHandler { $slotDiffRenderer->setStatsdDataFactory( $statsdDataFactory ); // XXX using the page language would be better, but it's unclear how that should be injected $slotDiffRenderer->setLanguage( $contentLanguage ); - $slotDiffRenderer->setWikiDiff2MovedParagraphDetectionCutoff( - $context->getConfig()->get( 'WikiDiff2MovedParagraphDetectionCutoff' ) - ); $engine = DifferenceEngine::getEngine(); if ( $engine === false ) { diff --git a/includes/diff/DifferenceEngine.php b/includes/diff/DifferenceEngine.php index 1ab1246ba0..f7658fc54d 100644 --- a/includes/diff/DifferenceEngine.php +++ b/includes/diff/DifferenceEngine.php @@ -1172,7 +1172,6 @@ class DifferenceEngine extends ContextSource { if ( $engine === 'wikidiff2' ) { $params[] = phpversion( 'wikidiff2' ); - $params[] = $this->getConfig()->get( 'WikiDiff2MovedParagraphDetectionCutoff' ); } if ( !$this->isSlotDiffRenderer ) { diff --git a/includes/diff/TextSlotDiffRenderer.php b/includes/diff/TextSlotDiffRenderer.php index bb965e1781..510465bd96 100644 --- a/includes/diff/TextSlotDiffRenderer.php +++ b/includes/diff/TextSlotDiffRenderer.php @@ -51,14 +51,6 @@ class TextSlotDiffRenderer extends SlotDiffRenderer { /** @var Language|null The language this content is in. */ private $language; - /** - * Number of paragraph moves the algorithm should attempt to detect. - * Only used with the wikidiff2 engine. - * @var int - * @see $wgWikiDiff2MovedParagraphDetectionCutoff - */ - private $wikiDiff2MovedParagraphDetectionCutoff = 0; - /** @var string One of the ENGINE_* constants. */ private $engine = self::ENGINE_PHP; @@ -86,15 +78,6 @@ class TextSlotDiffRenderer extends SlotDiffRenderer { $this->language = $language; } - /** - * @param int $cutoff - * @see $wgWikiDiff2MovedParagraphDetectionCutoff - */ - public function setWikiDiff2MovedParagraphDetectionCutoff( $cutoff ) { - Assert::parameterType( 'integer', $cutoff, '$cutoff' ); - $this->wikiDiff2MovedParagraphDetectionCutoff = $cutoff; - } - /** * Set which diff engine to use. * @param string $type One of the ENGINE_* constants. @@ -205,7 +188,7 @@ class TextSlotDiffRenderer extends SlotDiffRenderer { $oldText, $newText, 2, - $this->wikiDiff2MovedParagraphDetectionCutoff + 0 ); } else { // Don't pass the 4th parameter introduced in version 1.5.0 and removed in version 1.8.0 diff --git a/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php b/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php index e08efacd26..c523561827 100644 --- a/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php +++ b/tests/phpunit/includes/diff/TextSlotDiffRendererTest.php @@ -84,7 +84,6 @@ class TextSlotDiffRendererTest extends MediaWikiTestCase { $slotDiffRenderer = new TextSlotDiffRenderer(); $slotDiffRenderer->setStatsdDataFactory( new NullStatsdDataFactory() ); $slotDiffRenderer->setLanguage( Language::factory( 'en' ) ); - $slotDiffRenderer->setWikiDiff2MovedParagraphDetectionCutoff( 0 ); $slotDiffRenderer->setEngine( TextSlotDiffRenderer::ENGINE_PHP ); return $slotDiffRenderer; } -- 2.20.1