summaryrefslogtreecommitdiff
path: root/includes/specials/SpecialRevisiondelete.php
diff options
context:
space:
mode:
Diffstat (limited to 'includes/specials/SpecialRevisiondelete.php')
-rw-r--r--includes/specials/SpecialRevisiondelete.php42
1 files changed, 18 insertions, 24 deletions
diff --git a/includes/specials/SpecialRevisiondelete.php b/includes/specials/SpecialRevisiondelete.php
index 3c643253..df60a26a 100644
--- a/includes/specials/SpecialRevisiondelete.php
+++ b/includes/specials/SpecialRevisiondelete.php
@@ -111,15 +111,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
}
public function execute( $par ) {
+ $this->checkPermissions();
+ $this->checkReadOnly();
+
$output = $this->getOutput();
$user = $this->getUser();
- if( !$user->isAllowed( 'deletedhistory' ) ) {
- $output->permissionRequired( 'deletedhistory' );
- return;
- } elseif( wfReadOnly() ) {
- $output->readOnlyPage();
- return;
- }
+
$this->mIsAllowed = $user->isAllowed('deleterevision'); // for changes
$this->setHeaders();
$this->outputHeader();
@@ -137,7 +134,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
// $this->ids = array_map( 'intval', $this->ids );
$this->ids = array_unique( array_filter( $this->ids ) );
- if ( $request->getVal( 'action' ) == 'historysubmit' ) {
+ if ( $request->getVal( 'action' ) == 'historysubmit' || $request->getVal( 'action' ) == 'revisiondelete' ) {
// For show/hide form submission from history page
// Since we are access through index.php?title=XXX&action=historysubmit
// getFullTitle() will contain the target title and not our title
@@ -206,12 +203,12 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
# Show relevant lines from the deletion log
$output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'delete' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $output, 'delete',
- $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
+ $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
# Show relevant lines from the suppression log
if( $user->isAllowed( 'suppressionlog' ) ) {
$output->addHTML( "<h2>" . htmlspecialchars( LogPage::logName( 'suppress' ) ) . "</h2>\n" );
LogEventsList::showLogExtract( $output, 'suppress',
- $this->targetObj->getPrefixedText(), '', array( 'lim' => 25, 'conds' => $qc ) );
+ $this->targetObj, '', array( 'lim' => 25, 'conds' => $qc ) );
}
}
@@ -228,7 +225,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
array(),
array( 'page' => $this->targetObj->getPrefixedText() )
);
- if ( $this->targetObj->getNamespace() != NS_SPECIAL ) {
+ if ( !$this->targetObj->isSpecialPage() ) {
# Give a link to the page history
$links[] = Linker::linkKnown(
$this->targetObj,
@@ -248,7 +245,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
}
}
# Logs themselves don't have histories or archived revisions
- $this->getOutput()->setSubtitle( '<p>' . $this->getLang()->pipeList( $links ) . '</p>' );
+ $this->getOutput()->addSubtitle( $this->getLanguage()->pipeList( $links ) );
}
}
@@ -278,7 +275,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$this->getOutput()->addWikiMsg( 'revdelete-no-file' );
return;
}
- if( !$oimage->userCan(File::DELETED_FILE) ) {
+ if( !$oimage->userCan( File::DELETED_FILE, $this->getUser() ) ) {
if( $oimage->isDeleted( File::DELETED_RESTRICTED ) ) {
$this->getOutput()->permissionRequired( 'suppressrevision' );
} else {
@@ -289,15 +286,15 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
if ( !$this->getUser()->matchEditToken( $this->token, $archiveName ) ) {
$this->getOutput()->addWikiMsg( 'revdelete-show-file-confirm',
$this->targetObj->getText(),
- $this->getLang()->date( $oimage->getTimestamp() ),
- $this->getLang()->time( $oimage->getTimestamp() ) );
+ $this->getLanguage()->date( $oimage->getTimestamp() ),
+ $this->getLanguage()->time( $oimage->getTimestamp() ) );
$this->getOutput()->addHTML(
Xml::openElement( 'form', array(
'method' => 'POST',
'action' => $this->getTitle()->getLocalUrl(
'target=' . urlencode( $oimage->getName() ) .
'&file=' . urlencode( $archiveName ) .
- '&token=' . urlencode( $this->getUser()->editToken( $archiveName ) ) )
+ '&token=' . urlencode( $this->getUser()->getEditToken( $archiveName ) ) )
)
) .
Xml::submitButton( wfMsg( 'revdelete-show-file-submit' ) ) .
@@ -314,12 +311,9 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$this->getRequest()->response()->header( 'Cache-Control: no-cache, no-store, max-age=0, must-revalidate' );
$this->getRequest()->response()->header( 'Pragma: no-cache' );
- # Stream the file to the client
- global $IP;
- require_once( "$IP/includes/StreamFile.php" );
$key = $oimage->getStorageKey();
$path = $repo->getZonePath( 'deleted' ) . '/' . $repo->getDeletedHashPath( $key ) . $key;
- wfStreamFile( $path );
+ $repo->streamFile( $path );
}
/**
@@ -341,7 +335,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
$UserAllowed = true;
if ( $this->typeName == 'logging' ) {
- $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLang()->formatNum( count($this->ids) ) );
+ $this->getOutput()->addWikiMsg( 'logdelete-selected', $this->getLanguage()->formatNum( count($this->ids) ) );
} else {
$this->getOutput()->addWikiMsg( 'revdelete-selected',
$this->targetObj->getPrefixedText(), count( $this->ids ) );
@@ -410,7 +404,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
'</td>' .
"</tr>\n" .
Xml::closeElement( 'table' ) .
- Html::hidden( 'wpEditToken', $this->getUser()->editToken() ) .
+ Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
Html::hidden( 'target', $this->targetObj->getPrefixedText() ) .
Html::hidden( 'type', $this->typeName ) .
Html::hidden( 'ids', implode( ',', $this->ids ) ) .
@@ -541,7 +535,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
* Report that the submit operation succeeded
*/
protected function success() {
- $this->getOutput()->setPagetitle( wfMsg( 'actioncomplete' ) );
+ $this->getOutput()->setPageTitle( $this->msg( 'actioncomplete' ) );
$this->getOutput()->wrapWikiMsg( "<span class=\"success\">\n$1\n</span>", $this->typeInfo['success'] );
$this->list->reloadFromMaster();
$this->showForm();
@@ -551,7 +545,7 @@ class SpecialRevisionDelete extends UnlistedSpecialPage {
* Report that the submit operation failed
*/
protected function failure( $status ) {
- $this->getOutput()->setPagetitle( wfMsg( 'actionfailed' ) );
+ $this->getOutput()->setPageTitle( $this->msg( 'actionfailed' ) );
$this->getOutput()->addWikiText( $status->getWikiText( $this->typeInfo['failure'] ) );
$this->showForm();
}