Florianschmidtwelzow has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/280966

Change subject: Remove (WikiPage|Article)::replaceSection()
......................................................................

Remove (WikiPage|Article)::replaceSection()

Bug: T122754
Change-Id: I1415c8de7be3b9d952fad265b439dd820e284fb2
Depends-On: I3d37f7e778d569970ed749c22ba49a63cc4ba0ec
---
M RELEASE-NOTES-1.27
M includes/EditPage.php
M includes/page/Article.php
M includes/page/WikiPage.php
M tests/phpunit/includes/page/WikiPageTest.php
5 files changed, 4 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/66/280966/1

diff --git a/RELEASE-NOTES-1.27 b/RELEASE-NOTES-1.27
index 8adb498..4022b1d 100644
--- a/RELEASE-NOTES-1.27
+++ b/RELEASE-NOTES-1.27
@@ -382,6 +382,8 @@
   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 ==
 
diff --git a/includes/EditPage.php b/includes/EditPage.php
index b3bb07a..3522531 100644
--- a/includes/EditPage.php
+++ b/includes/EditPage.php
@@ -1175,7 +1175,7 @@
         * 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 @@
                        } 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,
diff --git a/includes/page/Article.php b/includes/page/Article.php
index 7592017..c4ccade 100644
--- a/includes/page/Article.php
+++ b/includes/page/Article.php
@@ -2553,19 +2553,6 @@
 
        /**
         * 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
         */
        public function replaceSectionAtRev( $sectionId, Content 
$sectionContent,
diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php
index 0e3512b..48f2a7f 100644
--- a/includes/page/WikiPage.php
+++ b/includes/page/WikiPage.php
@@ -1384,44 +1384,6 @@
        }
 
        /**
-        * @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.
         *
         * @return bool
diff --git a/tests/phpunit/includes/page/WikiPageTest.php 
b/tests/phpunit/includes/page/WikiPageTest.php
index d488eee..10e0f59 100644
--- a/tests/phpunit/includes/page/WikiPageTest.php
+++ b/tests/phpunit/includes/page/WikiPageTest.php
@@ -769,22 +769,6 @@
 
        /**
         * @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
         */
        public function testReplaceSectionContent( $title, $model, $text, 
$section,

-- 
To view, visit https://gerrit.wikimedia.org/r/280966
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1415c8de7be3b9d952fad265b439dd820e284fb2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Florianschmidtwelzow <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to