Merge "FormatJson: Skip whitespace cleanup when unnecessary"
[lhc/web/wiklou.git] / includes / FileDeleteForm.php
index 9fc70eb..44aaeb4 100644 (file)
@@ -48,7 +48,7 @@ class FileDeleteForm {
        /**
         * Constructor
         *
-        * @param $file File object we're deleting
+        * @param File $file File object we're deleting
         */
        public function __construct( $file ) {
                $this->title = $file->getTitle();
@@ -120,13 +120,7 @@ class FileDeleteForm {
                                // 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;
                }
@@ -138,12 +132,12 @@ class FileDeleteForm {
        /**
         * Really delete the file
         *
-        * @param $title Title object
-        * @param File $file: file object
-        * @param string $oldimage archive name
-        * @param string $reason reason of the deletion
-        * @param $suppress Boolean: whether to mark all deleted versions as restricted
-        * @param $user User object performing the request
+        * @param Title $title
+        * @param File $file
+        * @param string $oldimage Archive name
+        * @param string $reason Reason of the deletion
+        * @param bool $suppress Whether to mark all deleted versions as restricted
+        * @param User $user User object performing the request
         * @throws MWException
         * @return bool|Status
         */
@@ -309,8 +303,8 @@ class FileDeleteForm {
         * showing an appropriate message depending upon whether
         * it's a current file or an old version
         *
-        * @param string $message message base
-        * @return String
+        * @param string $message Message base
+        * @return string
         */
        private function prepareMessage( $message ) {
                global $wgLang;
@@ -342,6 +336,7 @@ class FileDeleteForm {
        /**
         * Is the provided `oldimage` value valid?
         *
+        * @param string $oldimage
         * @return bool
         */
        public static function isValidOldSpec( $oldimage ) {
@@ -355,9 +350,9 @@ class FileDeleteForm {
         * value was provided, does it correspond to an
         * existing, local, old version of this file?
         *
-        * @param $file File
-        * @param $oldfile File
-        * @param $oldimage File
+        * @param File $file
+        * @param File $oldfile
+        * @param File $oldimage
         * @return bool
         */
        public static function haveDeletableFile( &$file, &$oldfile, $oldimage ) {