From: Reedy Date: Thu, 1 Dec 2016 12:45:36 +0000 (+0000) Subject: Article::getAutosummary() and WikiPage::getAutosummary() were removed X-Git-Tag: 1.31.0-rc.0~4678 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=ec6d6762eabf5ce0714ec561747d2cf50e22444f Article::getAutosummary() and WikiPage::getAutosummary() were removed Bug: T145728 Change-Id: I233571658b902c93a148a992ea99eb159551e732 --- diff --git a/RELEASE-NOTES-1.29 b/RELEASE-NOTES-1.29 index caa35eff28..ab7cdd446d 100644 --- a/RELEASE-NOTES-1.29 +++ b/RELEASE-NOTES-1.29 @@ -62,6 +62,8 @@ changes to languages because of Phabricator reports. * Xml::escapeJsString() (deprecated in 1.21) was removed. * Article::getText() and Article::prepareTextForEdit() (deprecated in 1.21) were removed. +* Article::getAutosummary() and WikiPage::getAutosummary (deprecated in 1.21) + were removed. == Compatibility == diff --git a/includes/page/Article.php b/includes/page/Article.php index ac363b299d..d30f034eab 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -2725,15 +2725,5 @@ class Article implements Page { WikiPage::onArticleEdit( $title ); } - /** - * @param string $oldtext - * @param string $newtext - * @param int $flags - * @return string - * @deprecated since 1.21, use ContentHandler::getAutosummary() instead - */ - public static function getAutosummary( $oldtext, $newtext, $flags ) { - return WikiPage::getAutosummary( $oldtext, $newtext, $flags ); - } // ****** } diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index f016494432..284a343057 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -3519,28 +3519,6 @@ class WikiPage implements Page, IDBAccessObject { return $result; } - /** - * Return an applicable autosummary if one exists for the given edit. - * @param string|null $oldtext The previous text of the page. - * @param string|null $newtext The submitted text of the page. - * @param int $flags Bitmask: a bitmask of flags submitted for the edit. - * @return string An appropriate autosummary, or an empty string. - * - * @deprecated since 1.21, use ContentHandler::getAutosummary() instead - */ - public static function getAutosummary( $oldtext, $newtext, $flags ) { - // NOTE: stub for backwards-compatibility. assumes the given text is - // wikitext. will break horribly if it isn't. - - wfDeprecated( __METHOD__, '1.21' ); - - $handler = ContentHandler::getForModelID( CONTENT_MODEL_WIKITEXT ); - $oldContent = is_null( $oldtext ) ? null : $handler->unserializeContent( $oldtext ); - $newContent = is_null( $newtext ) ? null : $handler->unserializeContent( $newtext ); - - return $handler->getAutosummary( $oldContent, $newContent, $flags ); - } - /** * Auto-generates a deletion reason * diff --git a/tests/phpunit/includes/page/ArticleTest.php b/tests/phpunit/includes/page/ArticleTest.php index a96a2960fb..7d0813d141 100644 --- a/tests/phpunit/includes/page/ArticleTest.php +++ b/tests/phpunit/includes/page/ArticleTest.php @@ -63,13 +63,9 @@ class ArticleTest extends MediaWikiTestCase { * @covers Article::onArticleCreate * @covers Article::onArticleDelete * @covers Article::onArticleEdit - * @covers Article::getAutosummary */ public function testStaticFunctions() { $this->hideDeprecated( 'Article::selectFields' ); - $this->hideDeprecated( 'Article::getAutosummary' ); - $this->hideDeprecated( 'WikiPage::getAutosummary' ); - $this->hideDeprecated( 'CategoryPage::getAutosummary' ); // Inherited from Article $this->assertEquals( WikiPage::selectFields(), Article::selectFields(), "Article static functions" ); @@ -79,7 +75,5 @@ class ArticleTest extends MediaWikiTestCase { "Article static functions" ); $this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ), "Article static functions" ); - $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ), - "Article static functions" ); } } diff --git a/tests/phpunit/includes/page/WikiPageTest.php b/tests/phpunit/includes/page/WikiPageTest.php index 4b7ebd3ab3..49d9fd2ae5 100644 --- a/tests/phpunit/includes/page/WikiPageTest.php +++ b/tests/phpunit/includes/page/WikiPageTest.php @@ -1034,63 +1034,6 @@ more stuff $this->assertEquals( "one", $page->getContent()->getNativeData() ); } - public static function provideGetAutosummary() { - return [ - [ - 'Hello there, world!', - '#REDIRECT [[Foo]]', - 0, - '/^Redirected page .*Foo/' - ], - - [ - null, - 'Hello world!', - EDIT_NEW, - '/^Created page .*Hello/' - ], - - [ - 'Hello there, world!', - '', - 0, - '/^Blanked/' - ], - - [ - 'Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy - eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam - voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet - clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.', - 'Hello world!', - 0, - '/^Replaced .*Hello/' - ], - - [ - 'foo', - 'bar', - 0, - '/^$/' - ], - ]; - } - - /** - * @dataProvider provideGetAutoSummary - * @covers WikiPage::getAutosummary - */ - public function testGetAutosummary( $old, $new, $flags, $expected ) { - $this->hideDeprecated( "WikiPage::getAutosummary" ); - - $page = $this->newPage( "WikiPageTest_testGetAutosummary" ); - - $summary = $page->getAutosummary( $old, $new, $flags ); - - $this->assertTrue( (bool)preg_match( $expected, $summary ), - "Autosummary didn't match expected pattern $expected: $summary" ); - } - public static function provideGetAutoDeleteReason() { return [ [