* bug 21063 http copy upload and upload from stash give different file path types...
authorMichael Dale <dale@users.mediawiki.org>
Thu, 8 Oct 2009 22:30:04 +0000 (22:30 +0000)
committerMichael Dale <dale@users.mediawiki.org>
Thu, 8 Oct 2009 22:30:04 +0000 (22:30 +0000)
includes/upload/UploadBase.php
includes/upload/UploadFromChunks.php
includes/upload/UploadFromStash.php

index 3a6b7e5..700338f 100644 (file)
@@ -137,6 +137,19 @@ abstract class UploadBase {
                return empty( $this->mFileSize );
        }
 
+       /*
+        * getRealPath
+        * @param string $srcPath the source path
+        * @returns the real path if it was a virtual url
+        */
+       function getRealPath( $srcPath ){
+               $repo = RepoGroup::singleton()->getLocalRepo();
+               if ( $repo->isVirtualUrl( $srcPath ) ) {
+                       return $repo->resolveVirtualUrl( $srcPath );
+               }
+               return $srcPath;
+       }
+
        /**
         * Verify whether the upload is sane.
         * Returns self::OK or else an array with error information
index fa7f4ab..1167243 100644 (file)
@@ -105,18 +105,6 @@ class UploadFromChunks extends UploadBase {
                        return true;
                }
        }
-       /*
-        * getRealPath
-        * @param string $srcPath the source path
-        * @returns the real path if it was a virtual url
-        */
-       function getRealPath( $srcPath ){
-               $repo = RepoGroup::singleton()->getLocalRepo();
-               if ( $repo->isVirtualUrl( $srcPath ) ) {
-                       return $repo->resolveVirtualUrl( $srcPath );
-               }
-               return $srcPath;
-       }
 
        // pretty ugly inter-mixing of mParam and local vars
        function setupChunkSession( $summary, $comment, $watch ) {
index 43ef2a3..6fbeb51 100644 (file)
@@ -2,24 +2,24 @@
 /**
  * @file
  * @ingroup upload
- * 
+ *
  * Implements uploading from previously stored file.
- * 
+ *
  * @author Bryan Tong Minh
  */
+
 class UploadFromStash extends UploadBase {
        public static function isValidSessionKey( $key, $sessionData ) {
-               return !empty( $key ) && 
-                       is_array( $sessionData ) && 
-                       isset( $sessionData[$key] ) && 
-                       isset( $sessionData[$key]['version'] ) && 
+               return !empty( $key ) &&
+                       is_array( $sessionData ) &&
+                       isset( $sessionData[$key] ) &&
+                       isset( $sessionData[$key]['version'] ) &&
                        $sessionData[$key]['version'] == self::SESSION_VERSION;
        }
 
        public static function isValidRequest( $request ) {
                $sessionData = $request->getSessionData( 'wsUploadData' );
-               return self::isValidSessionKey( 
+               return self::isValidSessionKey(
                        $request->getInt( 'wpSessionKey' ),
                        $sessionData
                );
@@ -34,10 +34,9 @@ class UploadFromStash extends UploadBase {
                         * them in the session on the server and just give
                         * an opaque key to the user agent.
                         */
-                        
-                       $repo = RepoGroup::singleton()->getLocalRepo();
+
                        parent::initialize( $name,
-                               $repo->resolveVirtualUrl( $sessionData['mTempPath'] ),
+                               $this->getRealPath ( $sessionData['mTempPath'] ),
                                $sessionData['mFileSize'],
                                false
                        );