Alternative fallback for the default /fonts path#6292
Alternative fallback for the default /fonts path#6292azaozz wants to merge 36 commits intoWordPress:trunkfrom
Conversation
Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
…p_upload_dir Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
…rror message is added in the 'error' key of the returned array following the `wp_font_dir` pattern: https://github.com/matiasbenedetto/wordpress-develop/blob/trunk/src/wp-includes/functions.php#L2393-L2406 Co-authored-by: Peter Wilson <519727+peterwilsoncc@users.noreply.github.com>
To trigger the fallback logic, need to create a fake where `wp_mkdir_p()` bails out early and returns `false`.
Looking at wp_mkdir_p(), notice this code:
```
if ( file_exists( $target ) ) {
return @is_dir( $target );
}
```
When the `$target` exists but is a file (not a directory), then `false` gets returned. Aha! Props to @costdev.
This commit:
* Adds a fake file, reworks the test, and then removes the file in the tear_down().
* Refactors the removing of the fonts directory by putting it into a separate method.
These new methods can be put into a trait or base abstraction that all of the Font Library test classes use to ensure the filesystem is restored between tests (that's out-of-scope for this PR).
Co-authored-by: Brian Alexander <824344+ironprogrammer@users.noreply.github.com>
Co-authored-by: Brian Alexander <824344+ironprogrammer@users.noreply.github.com>
…'t fall back to the /wp-content/uploads/fonts folder.
Depend only on `wp_is_writable( WP_CONTENT_DIR )` to change the location to /uploads/fonts.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
|
Closing this PR off per https://make.wordpress.org/core/2024/03/21/font-library-update-storage-of-font-files/. Thanks everyone for your work on this, I appreciate it. |
An alternative to #6259. Reuses some of the code from there.
Trac ticket: https://core.trac.wordpress.org/ticket/60751
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.