Clean up oldid argument to Content::prepareSave()
authorAdam Roses Wight <awight@wikimedia.org>
Wed, 11 Mar 2015 07:21:30 +0000 (00:21 -0700)
committerAwight <awight@wikimedia.org>
Thu, 12 Mar 2015 23:14:26 +0000 (23:14 +0000)
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
includes/content/Content.php
includes/page/WikiPage.php

index d8fca4d..6542d7d 100644 (file)
@@ -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 {
index 5823a9a..8ed761f 100644 (file)
@@ -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.
index b1e4f2d..8803736 100644 (file)
@@ -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() ) {