Repository navigation
Closed
Labels
Needs DecisionNeeds a decision to be actionable or relevant[Feature] Font Library[Priority] HighUsed to indicate top priority items that need quick attention[Status] In ProgressTracking issues with work in progress
Description
In #53965 the decision was made to use the wp-content/fonts directory for uploaded fonts rather than wp-content/uploads/fonts.
Following this discussion in Slack about the Font Library, this decision should be reassessed. There are pros and cons for using wp-content/fonts versus using a fonts directory within the uploads directory, some of which are technical.
Notes
wp-content/uploads/fontsis referred to in this issue but technically this means thefontssubdirectory within the configured uploads directory.- This is separate to the discussion about treating uploaded fonts as attachments. Files can be uploaded to the uploads directory without having to be associated with an attachment.
- The
fontsdirectory could be namedwp-fontsor something else to minimise the chance of a conflict with a directory used by an existing font management plugin, that's not a concern for this issue. - The "pros" of using
wp-content/fontsseem to be more philosophical, whereas the "cons" seem to be more technical.
Arguments in favour of wp-content/fonts
- We should keep uploads for things you insert into posts.
- If we end up adding folders to media library and someone adds a "fonts" folder for some reason.
- The upload folder being
wp-content/fontswas an explicit design decision to treat the font library as a distinct resource, not coupled with media as a representation.
Arguments in favour of wp-content/uploads/fonts
- Directories outside of
wp-content/uploadsmay not be writable, either as a security measure or due to offloading uploaded media to a CDN- This is potentially a blocker
- A discussion on this topic has been started in the #hosting channel in Slack
- This has been raised previously
- The decision to store fonts outside the uploads folder is problematic for immutable file systems and set ups in which user uploads are offloaded. It's not simply a case of making the directory writable, plugins will need to be updated, servers reconfigured.
- This could affect high impact hosts such as WordPress VIP, any site using security hardening plugins, or any site using
DISALLOW_FILE_MODS
- Font files are uploaded by users, therefore it makes sense to place the uploaded files within the uploads directory
- Personal data export files are placed within the uploads directory. Even though there is no specific discussion on that decision in the core Trac ticket for that feature, it's likely this was done for the technical reasons above.
Please comment with any further arguments in favour or against either location.
Metadata
Metadata
Assignees
Labels
Needs DecisionNeeds a decision to be actionable or relevant[Feature] Font Library[Priority] HighUsed to indicate top priority items that need quick attention[Status] In ProgressTracking issues with work in progress
Type
Projects
- StatusShow more project fields✅ Done
Activity
priethor commentedon Feb 27, 2024
I believe the fonts location should be outside uploads for the above reasons, which outweigh the cons. Furthermore, I would argue that users don't upload the fonts; they are downloaded from external directories just like themes and plugins.
Since the primary reasons for using the
uploadsfolder seem to be practical reasons to ensure compatibility, why not use it only as a fallback or allow a setting to configure it?hellofromtonya commentedon Feb 27, 2024
For historical context, during 6.4's merge consideration, this concern was raised. But the discussion didn't continue forward and IMO was unresolved.
Why? The primary focus was on the REST API's architecture as it was the biggest blocker and highest priority at that time. I suspect it consumed the focus and times, leaving less for deeper reviews and follow-ups.
costdev commentedon Feb 27, 2024
I agree. I think from an organisational perspective,
wp-contents/fontsis the correct choice. IMO, we should be looking at what's needed to make that work, and the lead time needed on all fronts to make sure it's usable at release.uploads,plugins,mu-plugins,themes,upgradeandupgrade-temp-backupare directories located inwp-content. Deployment setups will largely only haveuploadsas a writable directory there. I understand why this would lead us to putting afontssubdirectory inuploadsinstead to avoid technical implications, though I think that would be us leaning into what's easier and immediately workable, though it's also a permanent decision for BC. To me, it feels more like we need to work on a solid communication strategy and affording appropriate timeframes to facilitate this change, than on the implementation.If we were introducing the
wp-content/uploadsdirectory, and all of the same technical implications existed, how would we go about introducing this new writable directory, communicating this to hosts, developers and users, with enough time for identifying issues and for everyone to do what needs done to make it work?hellofromtonya commentedon Feb 27, 2024
I'm not sure I understand @priethor. Can you share more?
Media (images, videos, audio, PDFs, etc.) can also be first downloaded from somewhere (a camera, recording device, external media providers, etc.). It's the same for fonts as a user can upload a font file that they have stored on their computer.
swissspidy commentedon Feb 27, 2024
Initial response from asking in the #hosting channel:
Both Pantheon and WordPress.com VIP change the default location to
wp-content/uploads/fontsbecause the current location doesn't work for them. See https://github.com/pantheon-systems/pantheon-mu-plugin/blob/main/inc/fonts.php and Automattic/vip-go-mu-plugins#5265.If they have to add workarounds to make the feature work for them, that's an indicator that the default location is maybe not the best.
costdev commentedon Feb 27, 2024
I agree that it's perhaps an indicator, though I'd like to know about the roadblocks to them and others making the new
wp-content/fontsdirectory writable instead of filtering towp-content/uploads/fonts. I think it's important that we document the reason(s) why one possible path is chosen over another.johnbillion commentedon Feb 27, 2024
This is because the uploads directory is mounted on a completely separate filesystem to facilitate horizontal scaling, replication, CDN etc. It's not just about making other directories writable.
Most WordPress hosts that provide scalable architecture work in the same way, and it's nothing new. Some docs here for Altis Cloud as an example: https://docs.altis-dxp.com/cloud/s3-storage/.
andreilupu commentedon Feb 27, 2024
I think that any uploadable should go to
wp-content/uploads/because this is the premise that we all followed by either plugin/themes developers, hosts, etc.Introducing uploaded files outside of
wp-content/uploads/will introduce a new level of complexity. I can only imagine how many troubles this will bring towp-content/uploads/as a separate volume.wp-content/uploads/differently.40 remaining items
justlevine commentedon Mar 6, 2024
This talk about
DISALLOW_FILE_MODShas me wondering... If we are discussing from the philosophical-side-of-things, what actually is the default assumption of behavior forfontswhenDISALLOW_FILE_MODSis enabled?Whatever that assumption is, we can adapt the behavior if necessary (as @azaozz noted earlier), but there's something to be said for having our code checks and directory tree follow the same logical structure.
(alternatively, allowing fonts to be autodiscoverable if they're added directly to the
fontsfolder would also seem to clear all this up. I'm sure that's been discussed in a previous ticket, but I cant seem to find it).jazzsequence commentedon Mar 6, 2024
@justlevine
You mean like this one? 😁 #59102
azaozz commentedon Mar 6, 2024
Hmm, doesn't seem to be the case? Several of the "other" files and/or dirs in
/wp-contentthat WP may use were introduced before that. Also, imho the commit message puts it quite nicely:In any case, as far as I see it this is more of a "future proof" architecture decision, coincidence or not.
johnbillion commentedon Mar 7, 2024
Josepha has published a post on make/core about the location of the fonts directory (and synced pattern overrides).
peterwilsoncc commentedon Mar 7, 2024
I've closed this issue as unplanned. As a reminder, discussion can continue on a closed issue and participants will continue to be notified.
#59699 has been opened for considering the architectural decisions that are required for the fallback.
peterwilsoncc commentedon Mar 21, 2024
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.
justlevine commentedon Mar 22, 2024
Wasn't Josepha's decision for 6.5 based on the ability to make this compromise?
peterwilsoncc commentedon Mar 26, 2024
Reopening per https://make.wordpress.org/core/2024/03/25/wordpress-6-5-release-delayed-1-week/ and for the backport of https://core.trac.wordpress.org/changeset/57878 to Gutenberg.
creativecoder commentedon Apr 2, 2024
I created a PR to bring WP changes from https://core.trac.wordpress.org/changeset/57878 to Gutenberg: #60354