UploadBase: Formally deprecate old methods for stashing files
authorBartosz Dziewoński <matma.rex@gmail.com>
Tue, 2 Aug 2016 21:24:32 +0000 (23:24 +0200)
committerBartosz Dziewoński <matma.rex@gmail.com>
Tue, 2 Aug 2016 23:59:36 +0000 (01:59 +0200)
Change-Id: I4c60083a4e773e401aae8c90b99a051cbca4c961

RELEASE-NOTES-1.28
includes/specials/SpecialUpload.php
includes/upload/UploadBase.php
includes/upload/UploadFromStash.php

index 9acd1d8..990a917 100644 (file)
@@ -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 ==
 
index 0ef6af1..a0e3096 100644 (file)
@@ -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 = '<h2>' . $this->msg( 'uploaderror' )->escaped() . "</h2>\n" .
                        '<div class="error">' . $message . "</div>\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' );
index f4bb7ec..5320673 100644 (file)
@@ -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();
        }
 
        /**
index 1276842..908c8aa 100644 (file)
@@ -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