From 46172a8433f34ef2e3660c43e0edf745c4f7a7ad Mon Sep 17 00:00:00 2001 From: umherirrender Date: Tue, 25 Mar 2014 20:19:55 +0100 Subject: [PATCH] Allow access to revision deleted wikitext on action=edit 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 | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/includes/EditPage.php b/includes/EditPage.php index f57fc60581..bc525cfbd6 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -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 ) { -- 2.20.1