From 4ac9fa081a7c045f6a9f1cfc529d82423f485b2e Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Sun, 8 Dec 2013 09:55:49 +0100 Subject: Update to MediaWiki 1.22.0 --- includes/FileDeleteForm.php | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) (limited to 'includes/FileDeleteForm.php') diff --git a/includes/FileDeleteForm.php b/includes/FileDeleteForm.php index 28403cca..65d82b87 100644 --- a/includes/FileDeleteForm.php +++ b/includes/FileDeleteForm.php @@ -82,18 +82,18 @@ class FileDeleteForm { # Flag to hide all contents of the archived revisions $suppress = $wgRequest->getVal( 'wpSuppress' ) && $wgUser->isAllowed( 'suppressrevision' ); - if( $this->oldimage ) { + if ( $this->oldimage ) { $this->oldfile = RepoGroup::singleton()->getLocalRepo()->newFromArchiveName( $this->title, $this->oldimage ); } - if( !self::haveDeletableFile( $this->file, $this->oldfile, $this->oldimage ) ) { + if ( !self::haveDeletableFile( $this->file, $this->oldfile, $this->oldimage ) ) { $wgOut->addHTML( $this->prepareMessage( 'filedelete-nofile' ) ); $wgOut->addReturnTo( $this->title ); return; } // Perform the deletion if appropriate - if( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) { + if ( $wgRequest->wasPosted() && $wgUser->matchEditToken( $token, $this->oldimage ) ) { $deleteReasonList = $wgRequest->getText( 'wpDeleteReasonList' ); $deleteReason = $wgRequest->getText( 'wpReason' ); @@ -109,24 +109,18 @@ class FileDeleteForm { $status = self::doDelete( $this->title, $this->file, $this->oldimage, $reason, $suppress, $wgUser ); - if( !$status->isGood() ) { + if ( !$status->isGood() ) { $wgOut->addHTML( '

' . $this->prepareMessage( 'filedeleteerror-short' ) . "

\n" ); $wgOut->addWikiText( '
' . $status->getWikiText( 'filedeleteerror-short', 'filedeleteerror-long' ) . '
' ); } - if( $status->ok ) { + if ( $status->ok ) { $wgOut->setPageTitle( wfMessage( 'actioncomplete' ) ); $wgOut->addHTML( $this->prepareMessage( 'filedelete-success' ) ); // Return to the main page if we just deleted all versions of the // file, otherwise go back to the description page $wgOut->addReturnTo( $this->oldimage ? $this->title : Title::newMainPage() ); - if ( $wgUser->isLoggedIn() && $wgRequest->getCheck( 'wpWatch' ) != $wgUser->isWatched( $this->title ) ) { - if ( $wgRequest->getCheck( 'wpWatch' ) ) { - WatchAction::doWatch( $this->title, $wgUser ); - } else { - WatchAction::doUnwatch( $this->title, $wgUser ); - } - } + WatchAction::doWatchOrUnwatch( $wgRequest->getCheck( 'wpWatch' ), $this->title, $wgUser ); } return; } @@ -153,13 +147,13 @@ class FileDeleteForm { $user = $wgUser; } - if( $oldimage ) { + if ( $oldimage ) { $page = null; $status = $file->deleteOld( $oldimage, $reason, $suppress ); - if( $status->ok ) { + if ( $status->ok ) { // Need to do a log item $logComment = wfMessage( 'deletedrevision', $oldimage )->inContentLanguage()->text(); - if( trim( $reason ) != '' ) { + if ( trim( $reason ) != '' ) { $logComment .= wfMessage( 'colon-separator' ) ->inContentLanguage()->text() . $reason; } @@ -187,7 +181,7 @@ class FileDeleteForm { // or revision is missing, so check for isOK() rather than isGood() if ( $deleteStatus->isOK() ) { $status = $file->delete( $reason, $suppress ); - if( $status->isOK() ) { + if ( $status->isOK() ) { $dbw->commit( __METHOD__ ); } else { $dbw->rollback( __METHOD__ ); @@ -213,7 +207,7 @@ class FileDeleteForm { private function showForm() { global $wgOut, $wgUser, $wgRequest; - if( $wgUser->isAllowed( 'suppressrevision' ) ) { + if ( $wgUser->isAllowed( 'suppressrevision' ) ) { $suppress = " " . @@ -258,7 +252,7 @@ class FileDeleteForm { " {$suppress}"; - if( $wgUser->isLoggedIn() ) { + if ( $wgUser->isLoggedIn() ) { $form .= " @@ -314,7 +308,7 @@ class FileDeleteForm { */ private function prepareMessage( $message ) { global $wgLang; - if( $this->oldimage ) { + if ( $this->oldimage ) { return wfMessage( "{$message}-old", # To ensure grep will find them: 'filedelete-intro-old', 'filedelete-nofile-old', 'filedelete-success-old' wfEscapeWikiText( $this->title->getText() ), @@ -375,11 +369,11 @@ class FileDeleteForm { $q = array(); $q['action'] = 'delete'; - if( $this->oldimage ) { + if ( $this->oldimage ) { $q['oldimage'] = $this->oldimage; } - return $this->title->getLocalUrl( $q ); + return $this->title->getLocalURL( $q ); } /** -- cgit v1.2.2