$this->oldimage = $wgRequest->getText( 'oldimage', false );
$token = $wgRequest->getText( 'wpEditToken' );
+ # Flag to hide all contents of the archived revisions
+ $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed('deleterevision');
+
if( $this->oldimage && !$this->isValidOldSpec() ) {
$wgOut->showUnexpectedValueError( 'oldimage', htmlspecialchars( $this->oldimage ) );
return;
} elseif ( $reason == 'other' ) {
$reason = $this->DeleteReason;
}
+
+ $article = null;
if( $this->oldimage ) {
- $status = $this->file->deleteOld( $this->oldimage, $reason );
+ $status = $this->file->deleteOld( $this->oldimage, $reason, $suppress );
if( $status->ok ) {
// Need to do a log item
$log = new LogPage( 'delete' );
$log->addEntry( 'delete', $this->title, $logComment );
}
} else {
- $status = $this->file->delete( $reason );
+ $status = $this->file->delete( $reason, $suppress );
if( $status->ok ) {
// Need to delete the associated article
$article = new Article( $this->title );
- $article->doDeleteArticle( $reason );
+ $article->doDeleteArticle( $reason, $suppress );
}
}
+ if( $status->isGood() ) wfRunHooks('FileDeleteComplete', array(
+ &$this->file, &$this->oldimage, &$article, &$wgUser, &$reason));
+
if( !$status->isGood() )
$wgOut->addWikiText( $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) );
if( $status->ok ) {
global $wgOut, $wgUser, $wgRequest, $wgContLang;
$align = $wgContLang->isRtl() ? 'left' : 'right';
+ if( $wgUser->isAllowed( 'deleterevision' ) ) {
+ $suppress = "<tr id=\"wpDeleteSuppressRow\" name=\"wpDeleteSuppressRow\"><td></td><td>";
+ $suppress .= Xml::checkLabel( wfMsg( 'revdelete-suppress' ), 'wpSuppress', 'wpSuppress', false, array( 'tabindex' => '2' ) );
+ $suppress .= "</td></tr>";
+ } else {
+ $suppress = '';
+ }
+
$form = Xml::openElement( 'form', array( 'method' => 'post', 'action' => $this->getAction() ) ) .
Xml::openElement( 'fieldset' ) .
Xml::element( 'legend', null, wfMsg( 'filedelete-legend' ) ) .
Xml::input( 'wpReason', 60, $wgRequest->getText( 'wpReason' ), array( 'type' => 'text', 'maxlength' => '255', 'tabindex' => '2', 'id' => 'wpReason' ) ) .
"</td>
</tr>
+ {$suppress}
<tr>
<td></td>
<td>" .
Xml::closeElement( 'fieldset' ) .
Xml::closeElement( 'form' );
+ if ( $wgUser->isAllowed( 'editinterface' ) ) {
+ $skin = $wgUser->getSkin();
+ $link = $skin->makeLink ( 'MediaWiki:Filedelete-reason-dropdown', wfMsgHtml( 'filedelete-edit-reasonlist' ) );
+ $form .= '<p class="mw-filedelete-editreasons">' . $link . '</p>';
+ }
+
$wgOut->addHtml( $form );
}
* @return string
*/
private function prepareMessage( $message ) {
- global $wgLang, $wgServer;
+ global $wgLang;
if( $this->oldimage ) {
$url = $this->file->getArchiveUrl( $this->oldimage );
- if( substr( $url, 0, 1 ) == '/' ) {
- // Fully-qualify the URL if necessary
- $url = $wgServer . $url;
- }
return wfMsgExt(
"{$message}-old", # To ensure grep will find them: 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old'
'parse',
$this->title->getText(),
$wgLang->date( $this->getTimestamp(), true ),
$wgLang->time( $this->getTimestamp(), true ),
- $url
- );
+ wfExpandUrl( $this->file->getArchiveUrl( $this->oldimage ) ) );
} else {
return wfMsgExt(
$message,