From: Timo Tijhof Date: Tue, 4 Oct 2016 21:06:38 +0000 (+0100) Subject: page: Remove unused WikiPage::doQuickEditContent() X-Git-Tag: 1.31.0-rc.0~5215^2 X-Git-Url: https://git.cyclocoop.org/%27.%24link.%27?a=commitdiff_plain;h=6aa6519293ecef1e346d351a42cf4565a700bd0b;p=lhc%2Fweb%2Fwiklou.git page: Remove unused WikiPage::doQuickEditContent() This is a rather hakcy method that bypasses various cache invalidation updates. This method shouldn't be (and, fortunately, isn't) called anywhere in Wikimedia Git. Change-Id: I03ede077294344c420827e4a6527d4c5fc3509b0 --- diff --git a/includes/page/Article.php b/includes/page/Article.php index f57df9b4b2..338b1aeb89 100644 --- a/includes/page/Article.php +++ b/includes/page/Article.php @@ -2154,18 +2154,6 @@ class Article implements Page { return $this->mPage->getLastPurgeTimestamp(); } - /** - * Call to WikiPage function for backwards compatibility. - * @see WikiPage::doQuickEditContent - */ - public function doQuickEditContent( - Content $content, User $user, $comment = '', $minor = false, $serialFormat = null - ) { - return $this->mPage->doQuickEditContent( - $content, $user, $comment, $minor, $serialFormat - ); - } - /** * Call to WikiPage function for backwards compatibility. * @see WikiPage::doViewUpdates diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index 4fa042e781..98428dd0e8 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -2396,41 +2396,6 @@ class WikiPage implements Page, IDBAccessObject { } } - /** - * Edit an article without doing all that other stuff - * The article must already exist; link tables etc - * are not updated, caches are not flushed. - * - * @param Content $content Content submitted - * @param User $user The relevant user - * @param string $comment Comment submitted - * @param bool $minor Whereas it's a minor modification - * @param string $serialFormat Format for storing the content in the database - */ - public function doQuickEditContent( - Content $content, User $user, $comment = '', $minor = false, $serialFormat = null - ) { - - $serialized = $content->serialize( $serialFormat ); - - $dbw = wfGetDB( DB_MASTER ); - $revision = new Revision( [ - 'title' => $this->getTitle(), // for determining the default content model - 'page' => $this->getId(), - 'user_text' => $user->getName(), - 'user' => $user->getId(), - 'text' => $serialized, - 'length' => $content->getSize(), - 'comment' => $comment, - 'minor_edit' => $minor ? 1 : 0, - ] ); // XXX: set the content object? - $revision->insertOn( $dbw ); - $this->updateRevisionOn( $dbw, $revision ); - - Hooks::run( 'NewRevisionFromEditComplete', [ $this, $revision, false, $user ] ); - - } - /** * Update the article's restriction field, and leave a log entry. * This works for protection both existing and non-existing pages. diff --git a/tests/phpunit/includes/page/WikiPageTest.php b/tests/phpunit/includes/page/WikiPageTest.php index e55efeea45..4b7ebd3ab3 100644 --- a/tests/phpunit/includes/page/WikiPageTest.php +++ b/tests/phpunit/includes/page/WikiPageTest.php @@ -92,6 +92,9 @@ class WikiPageTest extends MediaWikiLangTestCase { /** * @covers WikiPage::doEditContent + * @covers WikiPage::doModify + * @covers WikiPage::doCreate + * @covers WikiPage::doEditUpdates */ public function testDoEditContent() { $page = $this->newPage( "WikiPageTest_testDoEditContent" ); @@ -213,30 +216,6 @@ class WikiPageTest extends MediaWikiLangTestCase { $this->assertEquals( 2, $n, 'pagelinks should contain two links from the page' ); } - /** - * @covers WikiPage::doQuickEditContent - */ - public function testDoQuickEditContent() { - global $wgUser; - - $page = $this->createPage( - "WikiPageTest_testDoQuickEditContent", - "original text", - CONTENT_MODEL_WIKITEXT - ); - - $content = ContentHandler::makeContent( - "quick text", - $page->getTitle(), - CONTENT_MODEL_WIKITEXT - ); - $page->doQuickEditContent( $content, $wgUser, "testing q" ); - - # --------------------- - $page = new WikiPage( $page->getTitle() ); - $this->assertTrue( $content->equals( $page->getContent() ) ); - } - /** * @covers WikiPage::doDeleteArticle */