[wp-trac] [WordPress Trac] #31066: wp_upload_dir calls wp_mkdir_p on each invocation

WordPress Trac noreply at wordpress.org
Thu Feb 18 13:33:38 UTC 2016


#31066: wp_upload_dir calls wp_mkdir_p on each invocation
-------------------------------------------------+-------------------------
 Reporter:  rmccue                               |       Owner:
     Type:  defect (bug)                         |      Status:  new
 Priority:  normal                               |   Milestone:  Future
Component:  Filesystem API                       |  Release
 Severity:  normal                               |     Version:
 Keywords:  has-patch needs-unit-tests needs-    |  Resolution:
  testing close                                  |     Focuses:
                                                 |  performance
-------------------------------------------------+-------------------------
Changes (by joemcgill):

 * keywords:  has-patch needs-unit-tests needs-testing => has-patch needs-
     unit-tests needs-testing close


Comment:

 As of r36565, we can pass a second parameter to `wp_upload_dir()` to skip
 the call to `wp_mkdir_p()` or make use of a new function,
 `wp_get_upload_dir()`, which essentially does the same. Additionally,
 `wp_upload_dir()` now saves the value returned by `wp_mkdir_p()` to
 persistent cache so it only runs once per page load (at most).

 Also, r36569 updates several internal media functions which are only used
 to display images so they now use the new `wp_get_upload_dir()` function
 to avoid the `wp_mkdir_p()` call.

 See #34359

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31066#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list