getUndoContent added to get undo working again for WikiText
authorJens Ohlig <jens.ohlig@wikimedia.de>
Thu, 12 Jul 2012 11:19:11 +0000 (13:19 +0200)
committerJens Ohlig <jens.ohlig@wikimedia.de>
Thu, 12 Jul 2012 11:21:17 +0000 (13:21 +0200)
Change-Id: I51ee17ded820a41e519831323e40ee0f6eb831c4

includes/WikiPage.php

index ad1fded..0fe1b4f 100644 (file)
@@ -1379,6 +1379,21 @@ class WikiPage extends Page {
                return $ret;
        }
 
+    /**
+     * Get the content that needs to be saved in order to undo all revisions
+     * between $undo and $undoafter. Revisions must belong to the same page,
+     * must exist and must not be deleted
+     * @param $undo Revision
+     * @param $undoafter Revision Must be an earlier revision than $undo
+     * @return mixed string on success, false on failure
+     * @since 1.WD
+     * Before we had the Content object, this was done in getUndoText
+     */
+    public function getUndoContent( Revision $undo, Revision $undoafter = null ) {
+        $handler = $undo->getContentHandler();
+        return $handler->getUndoContent( $this->getRevision(), $undo, $undoafter );
+    }
+
        /**
         * Get the text that needs to be saved in order to undo all revisions
         * between $undo and $undoafter. Revisions must belong to the same page,