+ $baseRevId = null;
+ if ( $edittime && $section !== 'new' ) {
+ $dbw = wfGetDB( DB_MASTER );
+ $rev = Revision::loadFromTimestamp( $dbw, $this->mTitle, $edittime );
+ if ( $rev ) {
+ $baseRevId = $rev->getId();
+ }
+ }
+
+ wfProfileOut( __METHOD__ );
+ return $this->replaceSectionAtRev( $section, $sectionContent, $sectionTitle, $baseRevId );
+ }
+
+ /**
+ * @param string|null|bool $section Null/false, a section number (0, 1, 2, T1, T2, ...) or "new".
+ * @param Content $sectionContent New content of the section.
+ * @param string $sectionTitle New section's subject, only if $section is "new".
+ * @param string $baseRevId integer|null
+ *
+ * @throws MWException
+ * @return Content New complete article content, or null if error.
+ *
+ * @since 1.24
+ */
+ public function replaceSectionAtRev( $section, Content $sectionContent,
+ $sectionTitle = '', $baseRevId = null
+ ) {
+ wfProfileIn( __METHOD__ );
+