Last modified: 2014-02-21 03:28:08 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T63705, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 61705 - Extension code can't get stashed file's path from UploadFromStash
Extension code can't get stashed file's path from UploadFromStash
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
1.23.0
All All
: Unprioritized normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-02-20 21:54 UTC by Lee Worden
Modified: 2014-02-21 03:28 UTC (History)
6 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Lee Worden 2014-02-20 21:54:16 UTC
I have not completely deciphered the Upload classes, so I apologize if I misunderstand.

For the extension development I'm doing, I'm working with a specialized subclass of SpecialUpload that sometimes interrupts the final stage of uploading, and does other work with the file contents rather than publishing it to a File: page.

When the file is uploaded directly, it seems I can find it using $this->mUpload->getTempPath() and operate on the file contents, but if the file has been stashed and mUpload is now an UploadFromStash object, that doesn't work.

The only way I can see to get the stashed file's path is to ignore mUpload, go back to the session key from the request data, and use UploadStash::getMetadata() to find out where the file is.  This requires me to violate UploadBase's polymorphism and handle the separate cases in my calling code.

Another option would be to call $this->mUpload->stashSession(), but if I'm not mistaken that would actually copy the file to a second stashed location, which is wasteful.

It would be helpful to have getTempPath() or a similar method give me the path of the stashed file, so that my code would not have to know whether $this->mUpload is stashed or not.
Comment 1 Lee Worden 2014-02-21 03:28:08 UTC
looks like getTempPath() works better than I thought when I use clearstatcache() at the right moments, so I'm going to withdraw this ticket.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links