Remove (WikiPage|Article)::replaceSection()
authorFlorian <florian.schmidt.stargatewissen@gmail.com>
Fri, 1 Apr 2016 19:56:56 +0000 (21:56 +0200)
committerReedy <reedy@wikimedia.org>
Fri, 1 Apr 2016 20:32:01 +0000 (20:32 +0000)
Bug: T122754
Change-Id: I1415c8de7be3b9d952fad265b439dd820e284fb2
Depends-On: I3d37f7e778d569970ed749c22ba49a63cc4ba0ec

RELEASE-NOTES-1.27
includes/EditPage.php
includes/page/Article.php
includes/page/WikiPage.php
tests/phpunit/includes/page/WikiPageTest.php

index ab200b8..a08fc56 100644 (file)
@@ -388,6 +388,8 @@ changes to languages because of Phabricator reports.
   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 ==
 
index b3bb07a..3522531 100644 (file)
@@ -1175,7 +1175,7 @@ class EditPage {
         * 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
@@ -1982,7 +1982,7 @@ class EditPage {
                        } 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,
index 7592017..c4ccade 100644 (file)
@@ -2551,19 +2551,6 @@ class Article implements Page {
                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
index 0e3512b..48f2a7f 100644 (file)
@@ -1383,44 +1383,6 @@ class WikiPage implements Page, IDBAccessObject {
                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.
         *
index d488eee..10e0f59 100644 (file)
@@ -767,22 +767,6 @@ more stuff
                ];
        }
 
-       /**
-        * @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