* 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 ==
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 );
- }
// ******
}
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
*
* @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" );
"Article static functions" );
$this->assertEquals( true, is_callable( "ImagePage::onArticleEdit" ),
"Article static functions" );
- $this->assertTrue( is_string( CategoryPage::getAutosummary( '', '', 0 ) ),
- "Article static functions" );
}
}
$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 [
[