[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
Sun Feb 13 02:28:41 UTC 2011


#16236: Method to stream file downloads in HTTP API, to reduce update memory
footprint
---------------------------------+-----------------------------
 Reporter:  markjaquith          |       Owner:  sivel
     Type:  task (blessed)       |      Status:  accepted
 Priority:  normal               |   Milestone:  Future Release
Component:  HTTP                 |     Version:
 Severity:  normal               |  Resolution:
 Keywords:  3.2-early has-patch  |
---------------------------------+-----------------------------

Comment (by dd32):

 More patch review:
 > `if ( ! is_dir( dirname( $r['filename'] ) ) || ! is_writable( dirname(
 $r['filename'] ) ) ) `

 I think the is_dir() should be able to be droped here, Just checking the
 parent folder of the file to be created is writable should suffice? Only
 case i can think of would be $filename = __FILE__ . '/somefile.zip'; which
 would fail without the usage of is_dir..

 > `if ( $r['stream'] ) `
 >   ` $stream_handle = fopen( $r['filename'], 'w+' ); `

 $stream_handle needs to be checked that it's a valid resource, ie. that
 opening the file was possible, is_writable may suceed, but i have a
 feeling that certain security functionalities can get in the way of that
 (For example, File already exists and is not writable)

 > `isset( $args['stream'] ) && $args['stream']`
  `!empty($args['stream'])` ? `false || 0 || '' || !isset() ` is taken as
 empty, so should be able to simplify that block down a bit

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/16236#comment:19>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list