way. Run `composer install` to install it and other dev dependencies to run unit tests.
* wl_id field added to the watchlist table.
* Revision::getRawText() was removed (deprecated since 1.21).
+* WikiPage::replaceSection() was removed (deprecated since 1.21).
+* Article::replaceSection() was removed (deprecated since 1.21).
== Compatibility ==
* Get the content of the wanted revision, without section extraction.
*
* The result of this function can be used to compare user's input with
- * section replaced in its context (using WikiPage::replaceSection())
+ * section replaced in its context (using WikiPage::replaceSectionAtRev())
* to the original text of the edit.
*
* This differs from Article::getContent() that when a missing revision is
} elseif ( $this->section != '' ) {
# Try to get a section anchor from the section source, redirect
# to edited section if header found.
- # XXX: Might be better to integrate this into Article::replaceSection
+ # XXX: Might be better to integrate this into Article::replaceSectionAtRev
# for duplicate heading checking and maybe parsing.
$hasmatch = preg_match( "/^ *([=]{1,6})(.*?)(\\1) *\\n/i", $this->textbox1, $matches );
# We can't deal with anchors, includes, html etc in the header for now,
return $this->mPage->protectDescriptionLog( $limit, $expiry );
}
- /**
- * Call to WikiPage function for backwards compatibility.
- * @see WikiPage::replaceSection
- */
- public function replaceSection( $sectionId, $text, $sectionTitle = '',
- $edittime = null
- ) {
- ContentHandler::deprecated( __METHOD__, '1.21' );
- return $this->mPage->replaceSection( $sectionId, $text, $sectionTitle,
- $edittime
- );
- }
-
/**
* Call to WikiPage function for backwards compatibility.
* @see WikiPage::replaceSectionAtRev
return false;
}
- /**
- * @param string|number|null|bool $sectionId Section identifier as a number or string
- * (e.g. 0, 1 or 'T-1'), null/false or an empty string for the whole page
- * or 'new' for a new section.
- * @param string $text New text of the section.
- * @param string $sectionTitle New section's subject, only if $section is "new".
- * @param string $edittime Revision timestamp or null to use the current revision.
- *
- * @throws MWException
- * @return string|null New complete article text, or null if error.
- *
- * @deprecated since 1.21, use replaceSectionAtRev() instead
- */
- public function replaceSection( $sectionId, $text, $sectionTitle = '',
- $edittime = null
- ) {
- ContentHandler::deprecated( __METHOD__, '1.21' );
-
- // NOTE: keep condition in sync with condition in replaceSectionContent!
- if ( strval( $sectionId ) === '' ) {
- // Whole-page edit; let the whole text through
- return $text;
- }
-
- if ( !$this->supportsSections() ) {
- throw new MWException( "sections not supported for content model " .
- $this->getContentHandler()->getModelID() );
- }
-
- // could even make section title, but that's not required.
- $sectionContent = ContentHandler::makeContent( $text, $this->getTitle() );
-
- $newContent = $this->replaceSectionContent( $sectionId, $sectionContent, $sectionTitle,
- $edittime );
-
- return ContentHandler::getContentText( $newContent );
- }
-
/**
* Returns true if this page's content model supports sections.
*
];
}
- /**
- * @dataProvider dataReplaceSection
- * @covers WikiPage::replaceSection
- */
- public function testReplaceSection( $title, $model, $text, $section, $with,
- $sectionTitle, $expected
- ) {
- $this->hideDeprecated( "WikiPage::replaceSection" );
-
- $page = $this->createPage( $title, $text, $model );
- $text = $page->replaceSection( $section, $with, $sectionTitle );
- $text = trim( $text );
-
- $this->assertEquals( $expected, $text );
- }
-
/**
* @dataProvider dataReplaceSection
* @covers WikiPage::replaceSectionContent