[wp-trac] [WordPress Trac] #34359: Cache output of `wp_upload_dir()` to improve performance

WordPress Trac noreply at wordpress.org
Wed Feb 17 22:51:03 UTC 2016


#34359: Cache output of `wp_upload_dir()` to improve performance
-------------------------------------------+-------------------------------
 Reporter:  mikeschroder                   |       Owner:  azaozz
     Type:  defect (bug)                   |      Status:  assigned
 Priority:  normal                         |   Milestone:  4.5
Component:  Media                          |     Version:
 Severity:  normal                         |  Resolution:
 Keywords:  needs-testing has-patch early  |     Focuses:  multisite,
                                           |  performance
-------------------------------------------+-------------------------------

Comment (by azaozz):

 In [changeset:"36565"]:
 {{{
 #!CommitTicketReference repository="" revision="36565"
 Improve the performance of `wp_upload_dir()`:
 - Cache the output in non-persistent cache.
 - Cache the result from `wp_mkdir_p()` in persistent cache (when present).
 - Introduce `wp_get_upload_dir()` for use when not uploading files. It is
 equivalent to `wp_upload_dir()` but does not check for the existence or
 create the upload directory.
 - Change tests to use the non-cached `_wp_upload_dir()`. They change
 options on the fly (should never be used in production) to simulate
 different environments.
 - Introduce `_upload_dir_no_subdir()` and `_upload_dir_https()` to
 facilitate testing. These use the proper `upload_dir` filter to simulate
 different environments.

 Props kovshenin, azaozz.
 See #34359.
 }}}

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


More information about the wp-trac mailing list