From 9f2f2f92dca381d8f977bc574cc30bef1211704f Mon Sep 17 00:00:00 2001 From: Adam Roses Wight Date: Wed, 11 Mar 2015 00:21:30 -0700 Subject: [PATCH] Clean up oldid argument to Content::prepareSave() The prepareSave function expects the latest revision ID of the article being replaced. Instead, we were passing an ID only used for rollbacks and other special effects. Change-Id: I4647930566b9370052a820ae3a46e10a6bba65ce --- includes/content/AbstractContent.php | 2 +- includes/content/Content.php | 4 ++-- includes/page/WikiPage.php | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/includes/content/AbstractContent.php b/includes/content/AbstractContent.php index d8fca4da5c..6542d7dfad 100644 --- a/includes/content/AbstractContent.php +++ b/includes/content/AbstractContent.php @@ -393,7 +393,7 @@ abstract class AbstractContent implements Content { * * @see Content::prepareSave */ - public function prepareSave( WikiPage $page, $flags, $baseRevId, User $user ) { + public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user ) { if ( $this->isValid() ) { return Status::newGood(); } else { diff --git a/includes/content/Content.php b/includes/content/Content.php index 5823a9ac45..8ed761f5d3 100644 --- a/includes/content/Content.php +++ b/includes/content/Content.php @@ -464,7 +464,7 @@ interface Content { * * @param WikiPage $page The page to be saved. * @param int $flags Bitfield for use with EDIT_XXX constants, see WikiPage::doEditContent() - * @param int $baseRevId The ID of the current revision + * @param int $parentRevId The ID of the current revision * @param User $user * * @return Status A status object indicating whether the content was @@ -473,7 +473,7 @@ interface Content { * * @see WikiPage::doEditContent() */ - public function prepareSave( WikiPage $page, $flags, $baseRevId, User $user ); + public function prepareSave( WikiPage $page, $flags, $parentRevId, User $user ); /** * Returns a list of updates to perform when this content is deleted. diff --git a/includes/page/WikiPage.php b/includes/page/WikiPage.php index b1e4f2d182..8803736fc7 100644 --- a/includes/page/WikiPage.php +++ b/includes/page/WikiPage.php @@ -1608,7 +1608,9 @@ class WikiPage implements Page, IDBAccessObject { * error will be returned. These two conditions are also possible with * auto-detection due to MediaWiki's performance-optimised locking strategy. * - * @param bool|int $baseRevId The revision ID this edit was based off, if any + * @param bool|int $baseRevId The revision ID this edit was based off, if any. + * This is not the parent revision ID, rather the revision ID for older + * content used as the source for a rollback, for example. * @param User $user The user doing the edit * * @throws MWException @@ -1668,7 +1670,9 @@ class WikiPage implements Page, IDBAccessObject { * error will be returned. These two conditions are also possible with * auto-detection due to MediaWiki's performance-optimised locking strategy. * - * @param bool|int $baseRevId The revision ID this edit was based off, if any + * @param bool|int $baseRevId The revision ID this edit was based off, if any. + * This is not the parent revision ID, rather the revision ID for older + * content used as the source for a rollback, for example. * @param User $user The user doing the edit * @param string $serialFormat Format for storing the content in the * database. @@ -1802,7 +1806,7 @@ class WikiPage implements Page, IDBAccessObject { $dbw->begin( __METHOD__ ); try { - $prepStatus = $content->prepareSave( $this, $flags, $baseRevId, $user ); + $prepStatus = $content->prepareSave( $this, $flags, $oldid, $user ); $status->merge( $prepStatus ); if ( !$status->isOK() ) { @@ -1881,7 +1885,7 @@ class WikiPage implements Page, IDBAccessObject { $dbw->begin( __METHOD__ ); try { - $prepStatus = $content->prepareSave( $this, $flags, $baseRevId, $user ); + $prepStatus = $content->prepareSave( $this, $flags, $oldid, $user ); $status->merge( $prepStatus ); if ( !$status->isOK() ) { -- 2.20.1