[wp-trac] [WordPress Trac] #18489: Create constants in default-constants.php for the uploads folder to allow better custom uploads location

WordPress Trac wp-trac at lists.automattic.com
Fri Aug 19 20:11:41 UTC 2011


#18489: Create constants in default-constants.php for the uploads folder to allow
better custom uploads location
-------------------------+-----------------------------
 Reporter:  eddiemoya    |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  General      |    Version:  3.2.1
 Severity:  normal       |   Keywords:
-------------------------+-----------------------------
 There are cases in which a the uploads directory might need to be divorced
 WP_CONTENT_DIR, currently the only thing we can use is the UPLOADS
 constant, which works but is relative to ABSPATH and as such limits where
 the uploads directory can be moved to.

 In default-constants.php we have constants for the wp-content, and plugins
 folder - the uploads folder is a natural addition to this. Currently there
 is only a poorly documented UPLOADS override in wp_uploads_dir, which can
 be overridden in wp-config.php. I also think there should be a similar
 constant for the themes folder, but I would that would be a bit more
 complex of a change.

 I have create a new function in default-constants.php which introduce
 WP_UPLOADS_DIR and WP_UPLOADS_URL, which are called after
 wp_plugins_directory_constants() in wp-settings.php - because that
 function create WP_CONTENT_URL, which is needed in order to create
 WP_UPLOADS_URL.

 It is important to note that I have not changed any of the precedent in
 terms of what overrides what - the uploads_path option still overrides the
 default location (or now, the potentially custom location) defined by the
 new constant, ''the old UPLOADS constant will still override either of
 them if it is set''. Thats the way it worked before and that behavior has
 been preserved.

 Additionally, I have patched /wp-includes/function.php wp_uploads_dir to
 make use of these new constants as well as a little clean up of some
 related logic.

 First patch to core - go easy.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/18489>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list