+ /**
+ * Replaces the section with the given id.
+ *
+ * @param String $sectionId the section's id
+ * @param Content $with the section's new content
+ * @return Boolean true if te section was replaced sucessfully, false otherwise
+ */
+ #FIXME: implement replaceSection(), use in WikiPage
+
+ /**
+ * @param $section empty/null/false or a section number (0, 1, 2, T1, T2...)
+ * @param $text String: new text of the section
+ * @param $sectionTitle String: new section's subject, only if $section is 'new'
+ * @param $edittime String: revision timestamp or null to use the current revision
+ * @return string Complete article text, or null if error
+ */
+ /*public function replaceSection( $section, $text, $sectionTitle = '', $edittime = null ) { #FIXME: adopt this!
+ wfProfileIn( __METHOD__ );
+
+ if ( strval( $section ) == '' ) {
+ // Whole-page edit; let the whole text through
+ } else {
+ // Bug 30711: always use current version when adding a new section
+ if ( is_null( $edittime ) || $section == 'new' ) {
+ $oldtext = $this->getRawText();
+ if ( $oldtext === false ) {
+ wfDebug( __METHOD__ . ": no page text\n" );
+ wfProfileOut( __METHOD__ );
+ return null;
+ }
+ } else {
+ $dbw = wfGetDB( DB_MASTER );
+ $rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime );
+
+ if ( !$rev ) {
+ wfDebug( "WikiPage::replaceSection asked for bogus section (page: " .
+ $this->getId() . "; section: $section; edittime: $edittime)\n" );
+ wfProfileOut( __METHOD__ );
+ return null;
+ }
+
+ $oldtext = $rev->getText();
+ }
+
+ if ( $section == 'new' ) {
+ # Inserting a new section
+ $subject = $sectionTitle ? wfMsgForContent( 'newsectionheaderdefaultlevel', $sectionTitle ) . "\n\n" : '';
+ if ( wfRunHooks( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) {
+ $text = strlen( trim( $oldtext ) ) > 0
+ ? "{$oldtext}\n\n{$subject}{$text}"
+ : "{$subject}{$text}";
+ }
+ } else {
+ # Replacing an existing section; roll out the big guns
+ global $wgParser;
+
+ $text = $wgParser->replaceSection( $oldtext, $section, $text );
+ }
+ }
+
+ wfProfileOut( __METHOD__ );
+ return $text;
+ } */
+