-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Architectural discussion allowing for fonts folder fallbacks. #59699
Comments
This feels like the ideal for me, can we persist it using a site option or something? It's also important to consider the filter. I'm guessing the filter always takes over, even if previous fonts were uploaded to the default (or fallback) folders? |
Providing some context from the enterprise hosting side of things (read-only filesystem), we use It's a small difference, but just to be specific, we'd want it to fallback to $upload_dir = wp_upload_dir();
$defaults['basedir'] = $upload_dir['basedir'] . '/fonts';
$defaults['baseurl'] = $upload_dir['baseurl'] . '/fonts';
$defaults['path'] = $defaults['basedir'];
$defaults['url'] = $defaults['baseurl'];
return $defaults; |
Thanks for opening the ticket and start the discussion! I wanted to chime in earlier, but WC Asia and travelling came in the way.
Good question. What do we gain by making this persistent (e.g. on database upgrade)? I don't see any benefits. The regardless of whether the file system settings change part is key here. The idea behind the strategy described in the make/core post is for WordPress to figure the right location so that the user does not need to worry about it. If we persist the location and then the permissions change, font uploads would no longer work, which is the scenario we want to avoid. So I'd suggest not making this persistent.
Appreciate the callout to performance here 🙏 Given that the location is only really needed during creation & deletion operations, I don't see an issue with just doing a writable check on demand. Something like this (pseudo code):
The upload location can change, either because of filesystem permission changes or because of filters. So we should just store the full path IMO.
Good question. What is the current file structure for non-fallbacks on multisite? Is For the fallback location, I think the main site should probably use |
Thinking about the use of filters and the fallback a bit, I think it would make sense to have a short circuit for when a site has chosen its own directory. So something along the lines of:
|
👋 I submitted a PR with a draft of the fallback default font dir: WordPress/wordpress-develop#6252 |
The non-fallback directory uses the same sub-folder structure as the upload directory, ie
This makes sense to me. Given the fallback is to the uploads directory then let's use the default uploads directory. I think this will make falling back a little less complex too.
This is the most difficult one. The full file path I like the idea of storing a more complete path though, maybe it could be relative to
I like @youknowriad's idea of making the fallback persistent with something like:
But I don't have super strong feelings on it. |
I agree. I do not find too much value in persisting the path. I imagine that for extenders, it could be a little unexpected to have that path stored in the database (no other base path is persisted like that) and unclear how to refresh it. I submitted another PR without the database persistence: WordPress/wordpress-develop#6259 |
The reason I like the idea of the database option is that it allows for:
|
I think that storing the location of where things have been uploaded is valuable, but in my eyes the decision of where to upload should be made at runtime since systems can change especially when it deals with people moving between environments. |
As the likely PR is using non-persistence then it will need to include some indicator of where the file is stored in each posts meta data (simply whether it's the default or the fallback, not the full path). Without it, there's no way of knowing where to attempt deletion of the file in |
Noting here that the current behavior (check if That means that installing a font on your server would install to I don't necessarily think this should block or change the behavior of having a fallback. However, it does not change the need for hosts to use the |
After learning a little more about including a fallback within Core by default, its' been decided not to include the feature in 6.5. An announcement post has posted on the Make Core blog. The original feature announcement dev note has been updated to reflect this change. For now I will close this ticket as unplanned as there isn't a maybe later option on GitHub. The issue can be reopened if it is decided to include the fallback later. |
Following the discussion in #59417 and the related make post, it has been decided to prefer placing fonts in
wp-content/fonts
and fallback towp-content/uploads/fonts
if the directory is not writable.In order to get the best possible outcome for this decision, the following will need to be decided upon:
Fallbacks
_wp_font_face_file
post metaServer relocations from one file system type to another
File location
What is the file structure for multisite installs using the fallback location?
wp-content/uploads/site/X/fonts/*.*
, orwp-content/uploads/fonts/site/X/*.*
No doubt this discussion will raise further questions that can be edited in to this issue. (If you have edit rights on the repo, please sign off on the edit.)
The text was updated successfully, but these errors were encountered: