Allow access to revision deleted wikitext on action=edit
authorumherirrender <umherirrender_de.wp@web.de>
Tue, 25 Mar 2014 19:19:55 +0000 (20:19 +0100)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 4 Apr 2014 05:09:27 +0000 (05:09 +0000)
EditPage.php has a Revision::getContent() without specifiy the
visiblity, that will give a empty textbox for revision deleted revisions
of a page, when editing this with the unhide=1 param.
Adding Revision::FOR_THIS_USER to allow admins or oversighter to see the
wikitext of such a revision.

Change-Id: Ie010346b613d96eacee6e33be0ed141f7061b709

includes/EditPage.php

index f57fc60..bc525cf 100644 (file)
@@ -917,7 +917,7 @@ class EditPage {
                } else {
                        if ( $this->section != '' ) {
                                // Get section edit text (returns $def_text for invalid sections)
-                               $orig = $this->getOriginalContent();
+                               $orig = $this->getOriginalContent( $wgUser );
                                $content = $orig ? $orig->getSection( $this->section ) : null;
 
                                if ( !$content ) {
@@ -999,7 +999,7 @@ class EditPage {
                                }
 
                                if ( $content === false ) {
-                                       $content = $this->getOriginalContent();
+                                       $content = $this->getOriginalContent( $wgUser );
                                }
                        }
                }
@@ -1020,9 +1020,10 @@ class EditPage {
         * 'missing-revision' message.
         *
         * @since 1.19
+        * @param User $user The user to get the revision for
         * @return Content|null
         */
-       private function getOriginalContent() {
+       private function getOriginalContent( User $user ) {
                if ( $this->section == 'new' ) {
                        return $this->getCurrentContent();
                }
@@ -1035,7 +1036,7 @@ class EditPage {
 
                        return $handler->makeEmptyContent();
                }
-               $content = $revision->getContent();
+               $content = $revision->getContent( Revision::FOR_THIS_USER, $user );
                return $content;
        }
 
@@ -1734,7 +1735,7 @@ class EditPage {
                                        return $status;
                                }
                        } elseif ( !$this->allowBlankSummary
-                               && !$content->equals( $this->getOriginalContent() )
+                               && !$content->equals( $this->getOriginalContent( $wgUser ) )
                                && !$content->isRedirect()
                                && md5( $this->summary ) == $this->autoSumm
                        ) {