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
This commit is contained in:
umherirrender 2014-03-25 20:19:55 +01:00 committed by Umherirrender
parent 0088c506bb
commit 46172a8433

View 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
) {