X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUpload.php;h=0700c497420cfbca72976bf718974ba6b17649d7;hb=4e9b74945c26994f7d4bbfe7d12800a1827a780a;hp=51a0a867d1b6147e20b25196dadea96a78d781f8;hpb=543f0ea46e51ec7c10c3f3200aa1ef9a6261a189;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 51a0a867d1..0700c49742 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -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 */ @@ -221,6 +219,8 @@ class SpecialUpload extends SpecialPage { */ protected function getUploadForm( $message = '', $sessionKey = '', $hideIgnoreWarning = false ) { # Initialize form + $context = new DerivativeContext( $this->getContext() ); + $context->setTitle( $this->getTitle() ); // Remove subpage $form = new UploadForm( array( 'watch' => $this->getWatchCheck(), 'forreupload' => $this->mForReUpload, @@ -232,8 +232,7 @@ class SpecialUpload extends SpecialPage { 'texttop' => $this->uploadFormTextTop, 'textaftersummary' => $this->uploadFormTextAfterSummary, 'destfile' => $this->mDesiredDestName, - ), $this->getContext() ); - $form->setTitle( $this->getTitle() ); + ), $context ); # Check the token, but only if necessary if ( @@ -516,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' ); @@ -811,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' ) ) @@ -1010,7 +1015,7 @@ class UploadForm extends HTMLForm { 'id' => 'wpWatchthis', 'label-message' => 'watchthisupload', 'section' => 'options', - 'default' => $user->getOption( 'watchcreations' ), + 'default' => $this->mWatch, ) ); }