* The constant DB_SLAVE, deprecated in 1.28, has been removed. Use DB_REPLICA.
* Replacer, DoubleReplacer, HashtableReplacer and RegexlikeReplacer
(deprecated in 1.32) have been removed. Closures should be used instead.
+* OutputPage::addWikiText(), ::addWikiTextWithTitle(), ::addWikiTextTitleTidy(),
+ ::addWikiTextTidy(), ::addWikiTextTitle(), deprecated in 1.32, have been
+ removed.
* …
=== Deprecations in 1.34 ===
return $this->mImageTimeKeys;
}
- /**
- * Convert wikitext to HTML and add it to the buffer
- * Default assumes that the current page title will be used.
- *
- * @param string $text
- * @param bool $linestart Is this the start of a line?
- * @param bool $interface Is this text in the user interface language?
- * @throws MWException
- * @deprecated since 1.32 due to untidy output; use
- * addWikiTextAsInterface() if $interface is default value or true,
- * or else addWikiTextAsContent() if $interface is false.
- */
- public function addWikiText( $text, $linestart = true, $interface = true ) {
- wfDeprecated( __METHOD__, '1.32' );
- $title = $this->getTitle();
- if ( !$title ) {
- throw new MWException( 'Title is null' );
- }
- $this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/false, $interface );
- }
-
/**
* Convert wikitext *in the user interface language* to HTML and
* add it to the buffer. The result will not be
if ( !$title ) {
throw new MWException( 'Title is null' );
}
- $this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/true, /*interface*/true );
+ $this->addWikiTextTitleInternal( $text, $title, $linestart, /*interface*/true );
}
/**
) {
$this->addWikiTextTitleInternal(
$text, $this->getTitle(),
- /*linestart*/true, /*tidy*/true, /*interface*/true,
+ /*linestart*/true, /*interface*/true,
$wrapperClass
);
}
if ( !$title ) {
throw new MWException( 'Title is null' );
}
- $this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/true, /*interface*/false );
- }
-
- /**
- * Add wikitext with a custom Title object
- *
- * @param string $text Wikitext
- * @param Title $title
- * @param bool $linestart Is this the start of a line?
- * @deprecated since 1.32 due to untidy output; use
- * addWikiTextAsInterface()
- */
- public function addWikiTextWithTitle( $text, Title $title, $linestart = true ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/false, /*interface*/false );
- }
-
- /**
- * Add wikitext *in content language* with a custom Title object.
- * Output will be tidy.
- *
- * @param string $text Wikitext in content language
- * @param Title $title
- * @param bool $linestart Is this the start of a line?
- * @deprecated since 1.32 to rename methods consistently; use
- * addWikiTextAsContent()
- */
- function addWikiTextTitleTidy( $text, Title $title, $linestart = true ) {
- wfDeprecated( __METHOD__, '1.32' );
- $this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/true, /*interface*/false );
- }
-
- /**
- * Add wikitext *in content language*. Output will be tidy.
- *
- * @param string $text Wikitext in content language
- * @param bool $linestart Is this the start of a line?
- * @deprecated since 1.32 to rename methods consistently; use
- * addWikiTextAsContent()
- */
- public function addWikiTextTidy( $text, $linestart = true ) {
- wfDeprecated( __METHOD__, '1.32' );
- $title = $this->getTitle();
- if ( !$title ) {
- throw new MWException( 'Title is null' );
- }
- $this->addWikiTextTitleInternal( $text, $title, $linestart, /*tidy*/true, /*interface*/false );
- }
-
- /**
- * Add wikitext with a custom Title object.
- * Output is unwrapped.
- *
- * @param string $text Wikitext
- * @param Title $title
- * @param bool $linestart Is this the start of a line?
- * @param bool $tidy Whether to use tidy.
- * Setting this to false (or omitting it) is deprecated
- * since 1.32; all wikitext should be tidied.
- * For backwards-compatibility with prior MW releases,
- * you may wish to invoke this method but set $tidy=true;
- * this will result in equivalent output to the non-deprecated
- * addWikiTextAsContent()/addWikiTextAsInterface() methods.
- * @param bool $interface Whether it is an interface message
- * (for example disables conversion)
- * @deprecated since 1.32, use addWikiTextAsContent() or
- * addWikiTextAsInterface() (depending on $interface)
- */
- public function addWikiTextTitle( $text, Title $title, $linestart,
- $tidy = false, $interface = false
- ) {
- wfDeprecated( __METHOD__, '1.32' );
- return $this->addWikiTextTitleInternal( $text, $title, $linestart, $tidy, $interface );
+ $this->addWikiTextTitleInternal( $text, $title, $linestart, /*interface*/false );
}
/**
* @private
*/
private function addWikiTextTitleInternal(
- $text, Title $title, $linestart, $tidy, $interface, $wrapperClass = null
+ $text, Title $title, $linestart, $interface, $wrapperClass = null
) {
- if ( !$tidy ) {
- wfDeprecated( 'disabling tidy', '1.32' );
- }
-
$parserOutput = $this->parseInternal(
- $text, $title, $linestart, $tidy, $interface, /*language*/null
+ $text, $title, $linestart, true, $interface, /*language*/null
);
$this->addParserOutput( $parserOutput, [
/**
* @dataProvider provideAddWikiText
- * @covers OutputPage::addWikiText
* @covers OutputPage::addWikiTextAsInterface
* @covers OutputPage::wrapWikiTextAsInterface
* @covers OutputPage::addWikiTextAsContent
- * @covers OutputPage::addWikiTextWithTitle
- * @covers OutputPage::addWikiTextTitle
- * @covers OutputPage::addWikiTextTidy
- * @covers OutputPage::addWikiTextTitleTidy
* @covers OutputPage::getHTML
*/
public function testAddWikiText( $method, array $args, $expected ) {
$op = $this->newInstance();
$this->assertSame( '', $op->getHTML() );
- $this->hideDeprecated( 'OutputPage::addWikiText' );
- $this->hideDeprecated( 'OutputPage::addWikiTextTitle' );
- $this->hideDeprecated( 'OutputPage::addWikiTextWithTitle' );
- $this->hideDeprecated( 'OutputPage::addWikiTextTidy' );
- $this->hideDeprecated( 'OutputPage::addWikiTextTitleTidy' );
- $this->hideDeprecated( 'disabling tidy' );
-
- if ( in_array(
- $method,
- [ 'addWikiTextWithTitle', 'addWikiTextTitleTidy', 'addWikiTextTitle' ]
- ) && count( $args ) >= 2 && $args[1] === null ) {
- // Special placeholder because we can't get the actual title in the provider
- $args[1] = $op->getTitle();
- }
if ( in_array(
$method,
[ 'addWikiTextAsInterface', 'addWikiTextAsContent' ]
public function provideAddWikiText() {
$tests = [
- 'addWikiText' => [
- // Not tidied; this API is deprecated.
- 'Simple wikitext' => [
- [ "'''Bold'''" ],
- "<p><b>Bold</b>\n</p>",
- ], 'List at start' => [
- [ '* List' ],
- "<ul><li>List</li></ul>\n",
- ], 'List not at start' => [
- [ '* Not a list', false ],
- '* Not a list',
- ], 'Non-interface' => [
- [ "'''Bold'''", true, false ],
- "<p><b>Bold</b>\n</p>",
- ], 'No section edit links' => [
- [ '== Title ==' ],
- "<h2><span class=\"mw-headline\" id=\"Title\">Title</span></h2>",
- ],
- ],
- 'addWikiTextWithTitle' => [
- // Untidied; this API is deprecated
- 'With title at start' => [
- [ '* {{PAGENAME}}', Title::newFromText( 'Talk:Some page' ) ],
- "<ul><li>Some page</li></ul>\n",
- ], 'With title at start' => [
- [ '* {{PAGENAME}}', Title::newFromText( 'Talk:Some page' ), false ],
- "* Some page",
- ],
- ],
'addWikiTextAsInterface' => [
- // Preferred interface: output is tidied
'Simple wikitext' => [
[ "'''Bold'''" ],
"<p><b>Bold</b>\n</p>",
],
],
'addWikiTextAsContent' => [
- // Preferred interface: output is tidied
'SpecialNewimages' => [
[ "<p lang='en' dir='ltr'>\nMy message" ],
'<p lang="en" dir="ltr">' . "\nMy message</p>"
],
];
- // Test all the others on addWikiTextTitle as well
- foreach ( $tests['addWikiText'] as $key => $val ) {
- $args = [ $val[0][0], null, $val[0][1] ?? true, false, $val[0][2] ?? true ];
- $tests['addWikiTextTitle']["$key (addWikiTextTitle)"] =
- array_merge( [ $args ], array_slice( $val, 1 ) );
- }
- foreach ( $tests['addWikiTextWithTitle'] as $key => $val ) {
- $args = [ $val[0][0], $val[0][1], $val[0][2] ?? true ];
- $tests['addWikiTextTitle']["$key (addWikiTextTitle)"] =
- array_merge( [ $args ], array_slice( $val, 1 ) );
- }
- foreach ( $tests['addWikiTextAsInterface'] as $key => $val ) {
- $args = [ $val[0][0], $val[0][2] ?? null, $val[0][1] ?? true, true, true ];
- $tests['addWikiTextTitle']["$key (addWikiTextTitle)"] =
- array_merge( [ $args ], array_slice( $val, 1 ) );
- }
- foreach ( $tests['addWikiTextAsContent'] as $key => $val ) {
- $args = [ $val[0][0], $val[0][2] ?? null, $val[0][1] ?? true, true, false ];
- $tests['addWikiTextTitle']["$key (addWikiTextTitle)"] =
- array_merge( [ $args ], array_slice( $val, 1 ) );
- }
- // addWikiTextTidy / addWikiTextTitleTidy were old aliases of
- // addWikiTextAsContent
- foreach ( $tests['addWikiTextAsContent'] as $key => $val ) {
- if ( count( $val[0] ) > 2 ) {
- $args = [ $val[0][0], $val[0][2], $val[0][1] ?? true ];
- $tests['addWikiTextTitleTidy']["$key (addWikiTextTitleTidy)"] =
- array_merge( [ $args ], array_slice( $val, 1 ) );
- } else {
- $args = [ $val[0][0], $val[0][1] ?? true ];
- $tests['addWikiTextTidy']["$key (addWikiTextTidy)"] =
- array_merge( [ $args ], array_slice( $val, 1 ) );
- }
- }
-
// We have to reformat our array to match what PHPUnit wants
$ret = [];
foreach ( $tests as $key => $subarray ) {
return $ret;
}
- /**
- * @covers OutputPage::addWikiText
- */
- public function testAddWikiTextNoTitle() {
- $this->hideDeprecated( 'OutputPage::addWikiText' );
- $this->setExpectedException( MWException::class, 'Title is null' );
-
- $op = $this->newInstance( [], null, 'notitle' );
- $op->addWikiText( 'a' );
- }
-
/**
* @covers OutputPage::addWikiTextAsInterface
*/