[wp-trac] [WordPress Trac] #16236: Method to stream file downloads in HTTP API, to reduce update memory footprint
WordPress Trac
wp-trac at lists.automattic.com
Sat Feb 12 05:52:21 UTC 2011
#16236: Method to stream file downloads in HTTP API, to reduce update memory
footprint
----------------------------+-----------------------------
Reporter: markjaquith | Owner:
Type: task (blessed) | Status: new
Priority: normal | Milestone: Future Release
Component: HTTP | Version:
Severity: normal | Resolution:
Keywords: 3.2-early |
----------------------------+-----------------------------
Comment (by dd32):
> I wonder about allowing the user to specify the destination directory.
I'm thinking of when WordPress is used as a external library in another
project, or included on the CLI. In those cases, you don't want to be
limited to the WordPress directory.
Given it's a developer function, Passing an absolute path seems
appropriate to me.
> Should we also make it clear that the directory should exist first?
IMO, it should be assumed the folder is readable (and well, error if we're
not able to open the specified file for writing), We do have the option of
wp_mkdir_p(), but once again, to decrease complexity, I see no reason not
to trust the caller has done their homework.
> Should we introduce a new section to the return? Or just add it to the
'response' section? Currently headers should be populated, and an empty
body should be returned.
I'm thinking of a response like this:
{{{
array
'headers' =>
array
'date' => string 'Sat, 12 Feb 2011 05:47:20 GMT' (length=29)
'server' => string 'Apache/2.2.14 (Win32) PHP/5.3.2' (length=31)
<snip>
'body' => string '' (length=0)
'response' =>
array
'code' => int 200
'message' => string 'OK' (length=2)
'cookies' =>
array
empty
'filename' => '/blahblahblah/file.zip'
}}}
But if we only accept a absolute filepath then having the filename in the
return might be overkill.. but I still feel it'd be nice to include there
somewhere. It doesnt fit into the other sections, so I see no reason not
to give it it's own element.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/16236#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list