From: Bartosz DziewoƄski Date: Tue, 2 Aug 2016 21:24:32 +0000 (+0200) Subject: UploadBase: Formally deprecate old methods for stashing files X-Git-Tag: 1.31.0-rc.0~6184^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=521742a9ff60dcd7c5c79d6fdf79a5201cf41b3d;p=lhc%2Fweb%2Fwiklou.git UploadBase: Formally deprecate old methods for stashing files Change-Id: I4c60083a4e773e401aae8c90b99a051cbca4c961 --- diff --git a/RELEASE-NOTES-1.28 b/RELEASE-NOTES-1.28 index 9acd1d8049..990a917667 100644 --- a/RELEASE-NOTES-1.28 +++ b/RELEASE-NOTES-1.28 @@ -93,6 +93,8 @@ changes to languages because of Phabricator reports. * Disabled "bug 2702" HTML tidying of parsed UI messages on wikis where Tidy is disabled. * DifferenceEngine::generateDiffBody() was removed (deprecated since 1.21). +* UploadBase::stashFileGetKey() and UploadBase::stashSession() were deprecated. + Use ...->stashFile()->getFileKey() instead. == Compatibility == diff --git a/includes/specials/SpecialUpload.php b/includes/specials/SpecialUpload.php index 0ef6af161f..a0e3096f9b 100644 --- a/includes/specials/SpecialUpload.php +++ b/includes/specials/SpecialUpload.php @@ -336,7 +336,7 @@ class SpecialUpload extends SpecialPage { * @param string $message HTML message to be passed to mainUploadForm */ protected function showRecoverableUploadError( $message ) { - $sessionKey = $this->mUpload->stashSession(); + $sessionKey = $this->mUpload->stashFile()->getFileKey(); $message = '

' . $this->msg( 'uploaderror' )->escaped() . "

\n" . '
' . $message . "
\n"; @@ -365,7 +365,7 @@ class SpecialUpload extends SpecialPage { return false; } - $sessionKey = $this->mUpload->stashSession(); + $sessionKey = $this->mUpload->stashFile()->getFileKey(); // Add styles for the warning, reused from the live preview $this->getOutput()->addModuleStyles( 'mediawiki.special.upload.styles' ); diff --git a/includes/upload/UploadBase.php b/includes/upload/UploadBase.php index f4bb7ec212..5320673f0e 100644 --- a/includes/upload/UploadBase.php +++ b/includes/upload/UploadBase.php @@ -960,8 +960,6 @@ abstract class UploadBase { * @return UploadStashFile Stashed file */ public function stashFile( User $user = null ) { - // was stashSessionFile - $stash = RepoGroup::singleton()->getLocalRepo()->getUploadStash( $user ); $file = $stash->stashFile( $this->mTempPath, $this->getSourceType() ); $this->mLocalFile = $file; @@ -973,19 +971,23 @@ abstract class UploadBase { * Stash a file in a temporary directory, returning a key which can be used * to find the file again. See stashFile(). * + * @deprecated since 1.28 * @return string File key */ public function stashFileGetKey() { + wfDeprecated( __METHOD__, '1.28' ); return $this->stashFile()->getFileKey(); } /** * alias for stashFileGetKey, for backwards compatibility * + * @deprecated since 1.28 * @return string File key */ public function stashSession() { - return $this->stashFileGetKey(); + wfDeprecated( __METHOD__, '1.28' ); + return $this->stashFile()->getFileKey(); } /** diff --git a/includes/upload/UploadFromStash.php b/includes/upload/UploadFromStash.php index 1276842365..908c8aa6c5 100644 --- a/includes/upload/UploadFromStash.php +++ b/includes/upload/UploadFromStash.php @@ -161,14 +161,6 @@ class UploadFromStash extends UploadBase { return $this->mLocalFile; } - /** - * This should return the key instead of the UploadStashFile instance, for backward compatibility. - * @return string - */ - public function stashSession() { - return $this->stashFile()->getFileKey(); - } - /** * Remove a temporarily kept file stashed by saveTempUploadedFile(). * @return bool Success