Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fallback for the default font folder path #6259

Closed
Changes from 11 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6e1e8e0
Add fallback for the default font folder path
matiasbenedetto Mar 11, 2024
0fb2cec
improve dir is_writable check
matiasbenedetto Mar 11, 2024
7a46783
format php
matiasbenedetto Mar 11, 2024
b85cdf3
remove unwanted early return
matiasbenedetto Mar 12, 2024
b8e35cc
re-order actual and expected
matiasbenedetto Mar 12, 2024
4f4e63c
remove not needed assignement
matiasbenedetto Mar 12, 2024
e655888
do not suppres errors
matiasbenedetto Mar 12, 2024
8e23ae4
format php
matiasbenedetto Mar 12, 2024
25d3c80
use the same format as in the wp-content/fonts default path
matiasbenedetto Mar 12, 2024
030b626
removing database persistence
matiasbenedetto Mar 12, 2024
48d7534
remove wp_default_font_dir function as not needed
matiasbenedetto Mar 12, 2024
171b621
save wp_mkdir_p result in a variable
matiasbenedetto Mar 13, 2024
596f452
check if the dir couldn't be created
matiasbenedetto Mar 13, 2024
9b05b6a
use array syntax
matiasbenedetto Mar 13, 2024
895984b
Update wp_get_font_dir function to use wp_get_upload_dir instead of w…
matiasbenedetto Mar 13, 2024
d2f6e5c
If the `wp-content/uploads/fonts` can not be created or written, an e…
matiasbenedetto Mar 13, 2024
928a564
be consistent in the use of $defaults['path'] to determine the path
matiasbenedetto Mar 13, 2024
9c51258
add a test using chmod (is failing)
matiasbenedetto Mar 13, 2024
e405ba8
format php
matiasbenedetto Mar 13, 2024
c3f21ea
undo unwanted changes
matiasbenedetto Mar 13, 2024
b2a34dd
fix test
matiasbenedetto Mar 13, 2024
e901a3f
Make test more robust
swissspidy Mar 13, 2024
ac77349
Delete files in directory too
swissspidy Mar 13, 2024
5f7b3d1
Fake a failure for creating wp-content/fonts directory.
hellofromtonya Mar 13, 2024
de55afb
Improve texts
matiasbenedetto Mar 14, 2024
e3e8289
improve test message
matiasbenedetto Mar 14, 2024
90a3982
If the font_dir was filtered it uses the filtered values and it doesn…
matiasbenedetto Mar 14, 2024
f7de278
remove error supression
matiasbenedetto Mar 14, 2024
45c8ece
format php
matiasbenedetto Mar 14, 2024
f0c3f3d
rename test case
matiasbenedetto Mar 14, 2024
206543a
Merge branch 'trunk' into add/font-dir-default-non-persisted
matiasbenedetto Mar 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/wp-includes/fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,17 @@ function wp_get_font_dir() {
'error' => false,
);

wp_mkdir_p( $defaults['path'] );
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved

if ( ! wp_is_writable( $defaults['path'] ) ) {
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved
$defaults = wp_upload_dir();
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved
$defaults['path'] = path_join( $defaults['basedir'], 'fonts' );
$defaults['url'] = $defaults['baseurl'] . '/fonts';
$defaults['subdir'] = '';
$defaults['basedir'] = path_join( $defaults['basedir'], 'fonts' );
$defaults['baseurl'] = $defaults['baseurl'] . '/fonts';
matiasbenedetto marked this conversation as resolved.
Show resolved Hide resolved
}

/**
* Filters the fonts directory data.
*
Expand Down
Loading