Merge "Made SqlBagOStuff fully avoid transactions when possible"
[lhc/web/wiklou.git] / includes / specials / SpecialUpload.php
index 09facf4..0700c49 100644 (file)
@@ -60,7 +60,7 @@ class SpecialUpload extends SpecialPage {
 
        /** User input variables from the root section **/
        public $mIgnoreWarning;
-       public $mWatchThis;
+       public $mWatchthis;
        public $mCopyrightStatus;
        public $mCopyrightSource;
 
@@ -75,8 +75,6 @@ class SpecialUpload extends SpecialPage {
        public $uploadFormTextTop;
        public $uploadFormTextAfterSummary;
 
-       public $mWatchthis;
-
        /**
         * Initialize instance variables from request and create an Upload handler
         */
@@ -517,11 +515,17 @@ class SpecialUpload extends SpecialPage {
                        return true;
                }
 
+               $desiredTitleObj = Title::makeTitleSafe( NS_FILE, $this->mDesiredDestName );
+               if ( $desiredTitleObj instanceof Title && $this->getUser()->isWatched( $desiredTitleObj ) ) {
+                       // Already watched, don't change that
+                       return true;
+               }
+
                $local = wfLocalFile( $this->mDesiredDestName );
                if ( $local && $local->exists() ) {
                        // We're uploading a new version of an existing file.
                        // No creation, so don't watch it if we're not already.
-                       return $this->getUser()->isWatched( $local->getTitle() );
+                       return false;
                } else {
                        // New page should get watched if that's our option.
                        return $this->getUser()->getOption( 'watchcreations' );
@@ -812,7 +816,7 @@ class UploadForm extends HTMLForm {
                $this->mMaxUploadSize['file'] = UploadBase::getMaxUploadSize( 'file' );
                # Limit to upload_max_filesize unless we are running under HipHop and
                # that setting doesn't exist
-               if ( !wfIsHipHop() ) {
+               if ( !wfIsHHVM() ) {
                        $this->mMaxUploadSize['file'] = min( $this->mMaxUploadSize['file'],
                                wfShorthandToInteger( ini_get( 'upload_max_filesize' ) ),
                                wfShorthandToInteger( ini_get( 'post_max_size' ) )
@@ -1011,7 +1015,7 @@ class UploadForm extends HTMLForm {
                                        'id' => 'wpWatchthis',
                                        'label-message' => 'watchthisupload',
                                        'section' => 'options',
-                                       'default' => $user->getOption( 'watchcreations' ),
+                                       'default' => $this->mWatch,
                                )
                        );
                }