http://www.mediawiki.org/wiki/Special:Code/MediaWiki/76797

Revision: 76797
Author:   catrope
Date:     2010-11-16 14:47:18 +0000 (Tue, 16 Nov 2010)
Log Message:
-----------
uploadwizard-deployment: Merge recent revs from trunk: r75995, r76354, r76386, 
r76503, r76526, r76537, r76740, r76746, r76750, r76782, r76783, r76796

Modified Paths:
--------------
    branches/uploadwizard-deployment/includes/AutoLoader.php
    branches/uploadwizard-deployment/includes/api/ApiQuery.php
    branches/uploadwizard-deployment/includes/specials/SpecialUploadStash.php
    branches/uploadwizard-deployment/includes/upload/UploadBase.php
    branches/uploadwizard-deployment/includes/upload/UploadStash.php
    branches/uploadwizard-deployment/languages/messages/MessagesEn.php

Added Paths:
-----------
    branches/uploadwizard-deployment/includes/api/ApiQueryStashImageInfo.php

Property Changed:
----------------
    branches/uploadwizard-deployment/includes/AutoLoader.php
    branches/uploadwizard-deployment/includes/specials/SpecialUploadStash.php
    branches/uploadwizard-deployment/includes/upload/UploadBase.php
    branches/uploadwizard-deployment/includes/upload/UploadStash.php
    branches/uploadwizard-deployment/languages/messages/MessagesEn.php

Modified: branches/uploadwizard-deployment/includes/AutoLoader.php
===================================================================
--- branches/uploadwizard-deployment/includes/AutoLoader.php    2010-11-16 
14:23:34 UTC (rev 76796)
+++ branches/uploadwizard-deployment/includes/AutoLoader.php    2010-11-16 
14:47:18 UTC (rev 76797)
@@ -321,6 +321,7 @@
        'ApiQueryRevisions' => 'includes/api/ApiQueryRevisions.php',
        'ApiQuerySearch' => 'includes/api/ApiQuerySearch.php',
        'ApiQuerySiteinfo' => 'includes/api/ApiQuerySiteinfo.php',
+       'ApiQueryStashImageInfo' => 'includes/api/ApiQueryStashImageInfo.php',
        'ApiQueryTags' => 'includes/api/ApiQueryTags.php',
        'ApiQueryUserInfo' => 'includes/api/ApiQueryUserInfo.php',
        'ApiQueryUsers' => 'includes/api/ApiQueryUsers.php',


Property changes on: branches/uploadwizard-deployment/includes/AutoLoader.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/AutoLoader.php:51646
/branches/new-installer/phase3/includes/AutoLoader.php:43664-66004
/branches/sqlite/includes/AutoLoader.php:58211-58321
/branches/uploadwizard/phase3/includes/AutoLoader.php:73550-75905
/branches/wmf-deployment/includes/AutoLoader.php:53381,60970
/trunk/phase3/includes/AutoLoader.php:63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,70037,71059,71098,71942,72024,72120,72525,75906,76186
   + /branches/REL1_15/phase3/includes/AutoLoader.php:51646
/branches/new-installer/phase3/includes/AutoLoader.php:43664-66004
/branches/sqlite/includes/AutoLoader.php:58211-58321
/branches/uploadwizard/phase3/includes/AutoLoader.php:73550-75905
/branches/wmf-deployment/includes/AutoLoader.php:53381,60970
/trunk/phase3/includes/AutoLoader.php:63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,70037,71059,71098,71942,72024,72120,72525,75906,76186,76503,76526,76537,76540,76740,76746,76750,76782-76783,76796

Modified: branches/uploadwizard-deployment/includes/api/ApiQuery.php
===================================================================
--- branches/uploadwizard-deployment/includes/api/ApiQuery.php  2010-11-16 
14:23:34 UTC (rev 76796)
+++ branches/uploadwizard-deployment/includes/api/ApiQuery.php  2010-11-16 
14:47:18 UTC (rev 76797)
@@ -52,6 +52,7 @@
                'langlinks' => 'ApiQueryLangLinks',
                'images' => 'ApiQueryImages',
                'imageinfo' => 'ApiQueryImageInfo',
+               'stashimageinfo' => 'ApiQueryStashImageInfo',
                'templates' => 'ApiQueryLinks',
                'categories' => 'ApiQueryCategories',
                'extlinks' => 'ApiQueryExternalLinks',

Copied: 
branches/uploadwizard-deployment/includes/api/ApiQueryStashImageInfo.php (from 
rev 76782, trunk/phase3/includes/api/ApiQueryStashImageInfo.php)
===================================================================
--- branches/uploadwizard-deployment/includes/api/ApiQueryStashImageInfo.php    
                        (rev 0)
+++ branches/uploadwizard-deployment/includes/api/ApiQueryStashImageInfo.php    
2010-11-16 14:47:18 UTC (rev 76797)
@@ -0,0 +1,152 @@
+<?php
+/**
+ * API for MediaWiki 1.16+
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ * http://www.gnu.org/copyleft/gpl.html
+ *
+ * @file
+ */
+
+/**
+ * A query action to get image information from temporarily stashed files.
+ *
+ * @ingroup API
+ */
+class ApiQueryStashImageInfo extends ApiQueryImageInfo {
+
+       public function __construct( $query, $moduleName ) {
+               parent::__construct( $query, $moduleName, 'sii' );
+       }
+
+       public function execute() {
+               $params = $this->extractRequestParams();
+               $modulePrefix = $this->getModulePrefix();
+
+               $prop = array_flip( $params['prop'] );
+
+               $scale = $this->getScale( $params );
+               
+               $result = $this->getResult();
+               
+               try {
+                       $stash = new UploadStash();
+               
+                       foreach ( $params['sessionkey'] as $sessionkey ) {      
+                               $file = $stash->getFile( $sessionkey );
+                               $imageInfo = self::getInfo( $file, $prop, 
$result, $scale );
+                               $result->addValue( array( 'query', 
$this->getModuleName() ), null, $imageInfo );
+                               $result->setIndexedTagName_internal( array( 
'query', $this->getModuleName() ), $modulePrefix );
+                       }
+
+               } catch ( UploadStashNotAvailableException $e ) {
+                       $this->dieUsage( "Session not available: " . 
$e->getMessage(), "nosession" );
+               } catch ( UploadStashFileNotFoundException $e ) {
+                       $this->dieUsage( "File not found: " . $e->getMessage(), 
"invalidsessiondata" );
+               } catch ( UploadStashBadPathException $e ) {
+                       $this->dieUsage( "Bad path: " . $e->getMessage(), 
"invalidsessiondata" );
+               }       
+
+       }
+
+       /**
+        * Returns all valid parameters to siiprop
+        */
+       public static function getPropertyNames() {
+               return array(
+                       'timestamp',
+                       'url',
+                       'size',
+                       'dimensions', // For backwards compatibility with 
Allimages
+                       'sha1',
+                       'mime',
+                       'thumbmime',
+                       'metadata',
+                       'bitdepth',
+               );
+       }
+
+
+       public function getAllowedParams() {
+               return array(
+                       'sessionkey' => array( 
+                               ApiBase::PARAM_ISMULTI => true,
+                               ApiBase::PARAM_REQUIRED => true,
+                               ApiBase::PARAM_DFLT => null
+                       ),
+                       'prop' => array(
+                               ApiBase::PARAM_ISMULTI => true,
+                               ApiBase::PARAM_DFLT => 'timestamp|url',
+                               ApiBase::PARAM_TYPE => self::getPropertyNames()
+                       ),
+                       'urlwidth' => array(
+                               ApiBase::PARAM_TYPE => 'integer',
+                               ApiBase::PARAM_DFLT => -1
+                       ),
+                       'urlheight' => array(
+                               ApiBase::PARAM_TYPE => 'integer',
+                               ApiBase::PARAM_DFLT => -1
+                       )
+               );
+       }
+
+       /**
+        * Return the API documentation for the parameters.
+        * @return {Array} parameter documentation.
+        */
+       public function getParamDescription() {
+               $p = $this->getModulePrefix();
+               return array(
+                       'prop' => array(
+                               'What image information to get:',
+                               ' timestamp    - Adds timestamp for the 
uploaded version',
+                               ' url          - Gives URL to the image and the 
description page',
+                               ' size         - Adds the size of the image in 
bytes and the height and width',
+                               ' dimensions   - Alias for size',
+                               ' sha1         - Adds sha1 hash for the image',
+                               ' mime         - Adds MIME of the image',
+                               ' thumbmime    - Adss MIME of the image 
thumbnail (requires url)',
+                               ' metadata     - Lists EXIF metadata for the 
version of the image',
+                               ' bitdepth     - Adds the bit depth of the 
version',
+                       ),
+                       'sessionkey' => 'Session key that identifies a previous 
upload that was stashed temporarily.',
+                       'urlwidth' => "If {$p}prop=url is set, a URL to an 
image scaled to this width will be returned.",
+                       'urlheight' => "Similar to {$p}urlwidth. Cannot be used 
without {$p}urlwidth"
+               );
+       }
+
+       public function getDescription() {
+               return 'Returns image information for stashed images';
+       }
+
+       public function getPossibleErrors() {
+               return array_merge( parent::getPossibleErrors(), array(
+                       array( 'code' => 'siiurlwidth', 'info' => 'siiurlheight 
cannot be used without iiurlwidth' ),
+               ) );
+       }
+
+       protected function getExamples() {
+               return array(
+                       
'api.php?action=query&prop=stashimageinfo&siisessionkey=124sd34rsdf567',
+                       
'api.php?action=query&prop=stashimageinfo&siisessionkey=b34edoe3|bceffd4&siiurlwidth=120&siiprop=url',
+               );
+       }
+
+       public function getVersion() {
+               return __CLASS__ . ': $Id$';
+       }
+
+}
+

Modified: 
branches/uploadwizard-deployment/includes/specials/SpecialUploadStash.php
===================================================================
--- branches/uploadwizard-deployment/includes/specials/SpecialUploadStash.php   
2010-11-16 14:23:34 UTC (rev 76796)
+++ branches/uploadwizard-deployment/includes/specials/SpecialUploadStash.php   
2010-11-16 14:47:18 UTC (rev 76797)
@@ -16,27 +16,27 @@
  * @ingroup Upload
  */
 
-class SpecialUploadStash extends SpecialPage {
-
-       static $HttpErrors = array( // FIXME: Use 
OutputPage::getStatusMessage() --RK
-               400 => 'Bad Request',
-               403 => 'Access Denied',
-               404 => 'File not found',
-               500 => 'Internal Server Error',
-       );
-
+class SpecialUploadStash extends UnlistedSpecialPage {
        // UploadStash
        private $stash;
 
-       // we should not be reading in really big files and serving them out
-       private $maxServeFileSize = 262144; // 256K
+       // Since we are directly writing the file to STDOUT, 
+       // we should not be reading in really big files and serving them out.
+       //
+       // We also don't want people using this as a file drop, even if they
+       // share credentials.
+       //
+       // This service is really for thumbnails and other such previews while
+       // uploading.
+       const MAX_SERVE_BYTES = 262144; // 256K
 
-       // $request is the request (usually wgRequest)
-       // $subpage is everything in the URL after Special:UploadStash
-       // FIXME: These parameters don't match SpecialPage::__construct()'s 
params at all, and are unused --RK
-       public function __construct( $request = null, $subpage = null ) {
-                parent::__construct( 'UploadStash', 'upload' );
-               $this->stash = new UploadStash();
+       public function __construct( ) {
+               parent::__construct( 'UploadStash', 'upload' );
+               try {
+                       $this->stash = new UploadStash( );
+               } catch (UploadStashNotAvailableException $e) {
+                       return null;
+               }
        }
 
        /**
@@ -44,7 +44,7 @@
         * n.b. Most sanity checking done in UploadStashLocalFile, so this is 
straightforward.
         * 
         * @param {String} $subPage: subpage, e.g. in 
http://example.com/wiki/Special:UploadStash/foo.jpg, the "foo.jpg" part
-        * @return {Boolean} success 
+        * @return {Boolean} success 
         */
        public function execute( $subPage ) {
                global $wgOut, $wgUser;
@@ -57,23 +57,43 @@
                // prevent callers from doing standard HTML output -- we'll 
take it from here
                $wgOut->disable();
 
-               try { 
-                       $file = $this->getStashFile( $subPage );
-                       if ( $file->getSize() > $this->maxServeFileSize ) {
-                               throw new MWException( 'file size too large' );
+               $code = 500;
+               $message = 'Unknown error';
+
+               if ( !isset( $subPage ) || $subPage === '' ) {
+                       // the user probably visited the page just to see what 
would happen, so explain it a bit.
+                       $code = '400';
+                       $message = "Missing key\n\n" 
+                                  . 'This page provides access to temporarily 
stashed files for the user that '
+                                  . 'uploaded those files. See the upload API 
documentation. To access a stashed file, '
+                                  . 'use the URL of this page, with a slash 
and the key of the stashed file appended.';
+               } else {
+                       try {
+                               $file = $this->getStashFile( $subPage );
+                               $size = $file->getSize();
+                               if ( $size === 0 ) {
+                                       $code = 500;
+                                       $message = 'File is zero length';
+                               } else if ( $size > self::MAX_SERVE_BYTES ) {
+                                       $code = 500;
+                                       $message = 'Cannot serve a file larger 
than ' . self::MAX_SERVE_BYTES . ' bytes';
+                               } else {
+                                       $this->outputFile( $file );
+                                       return true;
+                               }
+                       } catch( UploadStashFileNotFoundException $e ) {
+                               $code = 404; 
+                               $message = $e->getMessage();
+                       } catch( UploadStashBadPathException $e ) {
+                               $code = 500;
+                               $message = $e->getMessage();
+                       } catch( Exception $e ) {
+                               $code = 500;
+                               $message = $e->getMessage();
                        }
-                       $this->outputFile( $file );
-                       return true;
-
-               } catch( UploadStashFileNotFoundException $e ) {
-                       $code = 404;
-               } catch( UploadStashBadPathException $e ) {
-                       $code = 403;
-               } catch( Exception $e ) {
-                       $code = 500;
                }
                        
-               wfHttpError( $code, self::$HttpErrors[$code], $e->getCode(), 
$e->getMessage() );
+               wfHttpError( $code, OutputPage::getStatusMessage( $code ), 
$message );
                return false;
        }
 
@@ -89,8 +109,8 @@
                // the stash key doesn't have an extension 
                $key = $subPage;
                $n = strrpos( $subPage, '.' );
-                if ( $n !== false ) {
-                        $key = $n ? substr( $subPage, 0, $n ) : $subPage;
+               if ( $n !== false ) {
+                       $key = $n ? substr( $subPage, 0, $n ) : $subPage;
                }
 
                try {
@@ -119,7 +139,7 @@
                        }
                        $file = $thumbnailImage->thumbnailFile;
                }
- 
+
                return $file;
        }
 
@@ -127,14 +147,12 @@
         * Output HTTP response for file
         * Side effects, obviously, of echoing lots of stuff to stdout.
         * @param {File} file
-        */             
+        */
        private function outputFile( $file ) { 
                header( 'Content-Type: ' . $file->getMimeType(), true );
                header( 'Content-Transfer-Encoding: binary', true );
                header( 'Expires: Sun, 17-Jan-2038 19:14:07 GMT', true );
-               header( 'Pragma: public', true );
-               header( 'Content-Length: ' . $file->getSize(), true ); // 
FIXME: PHP can handle Content-Length for you just fine --RK
+               header( 'Content-Length: ' . $file->getSize(), true ); 
                readfile( $file->getPath() );
        }
 }
-


Property changes on: 
branches/uploadwizard-deployment/includes/specials/SpecialUploadStash.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/specials/SpecialUploadStash.php:51646
/branches/sqlite/includes/specials/SpecialUploadStash.php:58211-58321
/branches/wmf-deployment/includes/specials/SpecialUploadStash.php:53381,56967
/trunk/phase3/includes/specials/SpecialUploadStash.php:73549-75058,75060-75821,76175,76177,76186
   + /branches/REL1_15/phase3/includes/specials/SpecialUploadStash.php:51646
/branches/sqlite/includes/specials/SpecialUploadStash.php:58211-58321
/branches/wmf-deployment/includes/specials/SpecialUploadStash.php:53381,56967
/trunk/phase3/includes/specials/SpecialUploadStash.php:73549-75058,75060-75821,76175,76177,76186,76386,76503,76526,76537,76540,76740,76746,76750,76782-76783,76796

Modified: branches/uploadwizard-deployment/includes/upload/UploadBase.php
===================================================================
--- branches/uploadwizard-deployment/includes/upload/UploadBase.php     
2010-11-16 14:23:34 UTC (rev 76796)
+++ branches/uploadwizard-deployment/includes/upload/UploadBase.php     
2010-11-16 14:47:18 UTC (rev 76797)
@@ -412,9 +412,15 @@
         * @return mixed Status indicating the whether the upload succeeded.
         */
        public function performUpload( $comment, $pageText, $watch, $user ) {
-               wfDebug( "\n\n\performUpload: sum:" . $comment . ' c: ' . 
$pageText . ' w:' . $watch );
-               $status = $this->getLocalFile()->upload( $this->mTempPath, 
$comment, $pageText,
-                       File::DELETE_SOURCE, $this->mFileProps, false, $user );
+               $status = $this->getLocalFile()->upload( 
+                       $this->mTempPath, 
+                       $comment, 
+                       $pageText,
+                       File::DELETE_SOURCE,
+                       $this->mFileProps, 
+                       false, 
+                       $user 
+               );
 
                if( $status->isGood() && $watch ) {
                        $user->addWatch( $this->getLocalFile()->getTitle() );
@@ -549,8 +555,7 @@
                        'mFileProps' => $this->mFileProps
                );
                $file = $stash->stashFile( $this->mTempPath, $data, $key );
-               // TODO should we change the "local file" here? 
-               // $this->mLocalFile = $file;
+               $this->mLocalFile = $file;
                return $file;
        }
 
@@ -1120,7 +1125,15 @@
         */
        public function getImageInfo( $result ) {
                $file = $this->getLocalFile();
-               $imParam = ApiQueryImageInfo::getPropertyNames();
-               return ApiQueryImageInfo::getInfo( $file, array_flip( $imParam 
), $result );
+               // TODO This cries out for refactoring. We really want to say 
$file->getAllInfo(); here. 
+               // Perhaps "info" methods should be moved into files, and the 
API should just wrap them in queries.
+               if ( $file instanceof UploadStashFile ) {
+                       $imParam = ApiQueryStashImageInfo::getPropertyNames();
+                       $info = ApiQueryStashImageInfo::getInfo( $file, 
array_flip( $imParam ), $result );
+               } else {
+                       $imParam = ApiQueryImageInfo::getPropertyNames();
+                       $info = ApiQueryImageInfo::getInfo( $file, array_flip( 
$imParam ), $result );
+               }
+               return $info;
        }
 }


Property changes on: 
branches/uploadwizard-deployment/includes/upload/UploadBase.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/upload/UploadBase.php:51646
/branches/new-installer/phase3/includes/upload/UploadBase.php:43664-66004
/branches/sqlite/includes/upload/UploadBase.php:58211-58321
/branches/uploadwizard/phase3/includes/upload/UploadBase.php:73550-75905
/branches/wmf-deployment/includes/upload/UploadBase.php:53381,60970
/trunk/phase3/includes/upload/UploadBase.php:63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,71059,71098,71942,72024,72120,72525,75906
   + /branches/REL1_15/phase3/includes/upload/UploadBase.php:51646
/branches/new-installer/phase3/includes/upload/UploadBase.php:43664-66004
/branches/sqlite/includes/upload/UploadBase.php:58211-58321
/branches/uploadwizard/phase3/includes/upload/UploadBase.php:73550-75905
/branches/wmf-deployment/includes/upload/UploadBase.php:53381,60970
/trunk/phase3/includes/upload/UploadBase.php:63549,63764,63897-63901,64113,64509,65387,65391,65555,65590,65650,65816,71059,71098,71942,72024,72120,72525,75906,76354,76503,76526,76537,76540,76740,76746,76750,76782-76783,76796

Modified: branches/uploadwizard-deployment/includes/upload/UploadStash.php
===================================================================
--- branches/uploadwizard-deployment/includes/upload/UploadStash.php    
2010-11-16 14:23:34 UTC (rev 76796)
+++ branches/uploadwizard-deployment/includes/upload/UploadStash.php    
2010-11-16 14:47:18 UTC (rev 76797)
@@ -24,9 +24,6 @@
        // array of initialized objects obtained from session (lazily 
initialized upon getFile())
        private $files = array();  
 
-       // the base URL for files in the stash
-       private $baseUrl;
-       
        // TODO: Once UploadBase starts using this, switch to use these 
constants rather than UploadBase::SESSION*
        // const SESSION_VERSION = 2;
        // const SESSION_KEYNAME = 'wsUploadData';
@@ -52,18 +49,9 @@
                        $_SESSION[UploadBase::SESSION_KEYNAME] = array();
                }
                
-               $this->baseUrl = SpecialPage::getTitleFor( 'UploadStash' 
)->getLocalURL(); 
        }
 
        /**
-        * Get the base of URLs by which one can access the files 
-        * @return {String} url
-        */
-       public function getBaseUrl() { 
-               return $this->baseUrl;
-       }
-
-       /** 
         * Get a file and its metadata from the stash.
         * May throw exception if session data cannot be parsed due to schema 
change, or key not found.
         * @param {Integer} $key: key
@@ -78,7 +66,7 @@
  
                if ( !isset( $this->files[$key] ) ) {
                        if ( !isset( 
$_SESSION[UploadBase::SESSION_KEYNAME][$key] ) ) {
-                               throw new UploadStashFileNotFoundException( 
"key '$key' not found in session" );
+                               throw new UploadStashFileNotFoundException( 
"key '$key' not found in stash" );
                        }
 
                        $data = $_SESSION[UploadBase::SESSION_KEYNAME][$key];
@@ -113,7 +101,7 @@
         */
        public function stashFile( $path, $data = array(), $key = null ) {
                if ( ! file_exists( $path ) ) {
-                       throw new UploadStashBadPathException( "path '$path' 
doesn't exist" );
+                       throw new UploadStashBadPathException( "path doesn't 
exist" );
                }
                 $fileProps = File::getPropsFromPath( $path );
 
@@ -196,12 +184,12 @@
                $repoTempPath = $repo->getZonePath( 'temp' );
                if ( ( ! $repo->validateFilename( $path ) ) || 
                                ( strpos( $path, $repoTempPath ) !== 0 ) ) {
-                       throw new UploadStashBadPathException( "path '$path' is 
not valid or is not in repo temp area: '$repoTempPath'" );
+                       throw new UploadStashBadPathException( 'path is not 
valid' );
                }
 
                // check if path exists! and is a plain file.
                if ( ! $repo->fileExists( $path, FileRepo::FILES_ONLY ) ) {
-                       throw new UploadStashFileNotFoundException( "cannot 
find path '$path'" );
+                       throw new UploadStashFileNotFoundException( 'cannot 
find path, or not a plain file' );
                }
 
                parent::__construct( false, $repo, $path, false );
@@ -252,7 +240,7 @@
                }
 
                if ( is_null( $extension ) ) {
-                       throw new UploadStashFileException( "extension 
'$extension' is null" );
+                       throw new UploadStashFileException( "extension is null" 
);
                }
 
                $this->extension = parent::normalizeExtension( $extension );
@@ -293,6 +281,16 @@
                return $thumbName;
        }
 
+       /**
+        * Helper function -- given a 'subpage', return the local URL e.g. 
/wiki/Special:UploadStash/subpage
+        * @param {String} $subPage
+        * @return {String} local URL for this subpage in the 
Special:UploadStash space. 
+        */
+       private function getSpecialUrl( $subPage ) {
+               return SpecialPage::getTitleFor( 'UploadStash', $subPage 
)->getLocalURL();
+       }
+
+
        /** 
         * Get a URL to access the thumbnail 
         * This is required because the model of how files work requires that 
@@ -303,11 +301,7 @@
         * @return {String} URL to access thumbnail, or URL with partial path
         */
        public function getThumbUrl( $thumbName = false ) { 
-               $path = $this->sessionStash->getBaseUrl();
-               if ( $thumbName !== false ) {
-                       $path .= '/' . rawurlencode( $thumbName );
-               }
-               return $path;
+               return self::getSpecialUrl( $thumbName );
        }
 
        /** 
@@ -329,7 +323,7 @@
         */
        public function getUrl() {
                if ( !isset( $this->url ) ) {
-                       $this->url = $this->sessionStash->getBaseUrl() . '/' . 
$this->getUrlName();
+                       $this->url = self::getSpecialUrl( $this->getUrlName() );
                }
                return $this->url;
        }
@@ -381,7 +375,7 @@
                }
 
                // stash the thumbnail File, and provide our caller with a way 
to get at its properties
-               $stashedThumbFile = $this->sessionStash->stashFile( 
$thumb->path, array(), $key );
+               $stashedThumbFile = $this->sessionStash->stashFile( 
$thumb->getPath(), array(), $key );
                $thumb->thumbnailFile = $stashedThumbFile;
 
                return $thumb;  


Property changes on: 
branches/uploadwizard-deployment/includes/upload/UploadStash.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/REL1_15/phase3/includes/upload/UploadStash.php:51646
/branches/new-installer/phase3/includes/upload/UploadStash.php:43664-66004
/branches/sqlite/includes/upload/UploadStash.php:58211-58321
/branches/uploadwizard/extensions/includes/upload/UploadStash.php:73550-74029
/trunk/phase3/includes/upload/UploadStash.php:74019-75058,75060-75821
   + /branches/REL1_15/phase3/includes/upload/UploadStash.php:51646
/branches/new-installer/phase3/includes/upload/UploadStash.php:43664-66004
/branches/sqlite/includes/upload/UploadStash.php:58211-58321
/branches/uploadwizard/extensions/includes/upload/UploadStash.php:73550-74029
/trunk/phase3/includes/upload/UploadStash.php:74019-75058,75060-75821,76354,76503,76526,76537,76540,76740,76746,76750,76782-76783,76796

Modified: branches/uploadwizard-deployment/languages/messages/MessagesEn.php
===================================================================
--- branches/uploadwizard-deployment/languages/messages/MessagesEn.php  
2010-11-16 14:23:34 UTC (rev 76796)
+++ branches/uploadwizard-deployment/languages/messages/MessagesEn.php  
2010-11-16 14:47:18 UTC (rev 76797)
@@ -373,6 +373,7 @@
        'Watchlist'                 => array( 'Watchlist' ),
        'Recentchanges'             => array( 'RecentChanges' ),
        'Upload'                    => array( 'Upload' ),
+       'UploadStash'               => array( 'UploadStash' ),
        'Listfiles'                 => array( 'ListFiles', 'FileList', 
'ImageList' ),
        'Newimages'                 => array( 'NewFiles', 'NewImages' ),
        'Listusers'                 => array( 'ListUsers', 'UserList' ),


Property changes on: 
branches/uploadwizard-deployment/languages/messages/MessagesEn.php
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/wmf/1.16wmf3/languages/messages/MessagesEn.php:64760
/branches/wmf-deployment/languages/messages/MessagesEn.php:60970
/trunk/phase3/languages/messages/MessagesEn.php:63545-63546,63549,63643,63764,63897-63901,64784,64786,64789,64800,64851,64876,65027,65112,66823,68224
   + /branches/wmf/1.16wmf3/languages/messages/MessagesEn.php:64760
/branches/wmf-deployment/languages/messages/MessagesEn.php:60970
/trunk/phase3/languages/messages/MessagesEn.php:63545-63546,63549,63643,63764,63897-63901,64784,64786,64789,64800,64851,64876,65027,65112,66823,68224,75995


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to