From 521742a9ff60dcd7c5c79d6fdf79a5201cf41b3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bartosz=20Dziewo=C5=84ski?= Date: Tue, 2 Aug 2016 23:24:32 +0200 Subject: [PATCH] UploadBase: Formally deprecate old methods for stashing files Change-Id: I4c60083a4e773e401aae8c90b99a051cbca4c961 --- RELEASE-NOTES-1.28 | 2 ++ includes/specials/SpecialUpload.php | 4 ++-- includes/upload/UploadBase.php | 8 +++++--- includes/upload/UploadFromStash.php | 8 -------- 4 files changed, 9 insertions(+), 13 deletions(-) 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 -- 2.20.1