X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialUpload.php;h=0700c497420cfbca72976bf718974ba6b17649d7;hb=4e9b74945c26994f7d4bbfe7d12800a1827a780a;hp=b79aaa94fad9ae8f57a8d924e29aba9f97d76a14;hpb=a443be2747d49938dd7beb2fa08d1aefcf15ed7b;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index b79aaa94fa..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 */ @@ -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' ); @@ -1011,7 +1015,7 @@ class UploadForm extends HTMLForm { 'id' => 'wpWatchthis', 'label-message' => 'watchthisupload', 'section' => 'options', - 'default' => $user->getOption( 'watchcreations' ), + 'default' => $this->mWatch, ) ); }