[wp-trac] [WordPress Trac] #34359: Cache output of `wp_upload_dir()` to improve performance
WordPress Trac
noreply at wordpress.org
Thu Feb 11 18:01:22 UTC 2016
#34359: Cache output of `wp_upload_dir()` to improve performance
-------------------------------------------+-------------------------------
Reporter: mikeschroder | Owner: mikeschroder
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 joemcgill):
I take it all back—sorta.
Running the failing test in isolation was also causing the above test to
fail, so I spent some more time debugging and the issue is that the
`WP_UnitTestCase::setUp()` method calls `wp_upload_dir()` in
`WP_UnitTestCase::scan_user_uploads()`, which is what warms the static
cache inside `wp_upload_dir()`. All of this happens before we have a
chance to modify the scheme of the 'siteurl' option for the purposes of
our tests.
So, in short, the `WP_UnitTestCase::setUp()` method is polluting the
static cache inside `wp_uploads_dir()`. We may need a way to make sure a
static cache value is _not_ set in certain instances, rather than only
being able to force a refresh on a subsequent run.
As an aside, we should probably refresh the whole 15928 group of tests so
they're not each uploading the same data.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34359#comment:47>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list