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

Filter the font directory to work with the VIP Filesystem #5265

Merged
merged 6 commits into from
Mar 15, 2024

Conversation

noahtallen
Copy link
Contributor

@noahtallen noahtallen commented Feb 21, 2024

Description

WordPress 6.5 introduces the Font Library, which allows customers to upload custom fonts and use them with global styles.

We need to use the new font_dir filter to ensure this will work in the VIP FS, since the default font dir is not writable on our platform.

This ultimately changes the font dir and URL to:

Normal/root site:

  • vip://wp-content/uploads/fonts
  • https://$site_url/wp-content/uploads/fonts

Network site:

  • vip://wp-content/uploads/sites/$network_site_id/fonts
  • https://$site_url/$network_site_path/wp-content/uploads/sites/$network_site_id/fonts

Changelog Description

Use a custom font directory for the new Font Library

WordPress 6.5 introduces the Font Library, which allows you to upload and manage your own font files from the site editor. We have used the new font_dir filter to set the font upload directory to wp-content/uploads/fonts to get this feature working with the VIP Filesystem.

Pre-review checklist

Please make sure the items below have been covered before requesting a review:

  • This change works and has been tested locally (or has an appropriate fallback).
  • This change works and has been tested on a Go sandbox.
  • This change has relevant unit tests (if applicable).
  • This change uses a rollout method to ease with deployment (if applicable - especially for large scale actions that require writes).
  • This change has relevant documentation additions / updates (if applicable).
  • I've created a changelog description that aligns with the provided examples.

Pre-deploy checklist

  • VIP staff: Ensure any alerts added/updated conform to internal standards (see internal documentation).

Steps to Test

  1. Sandbox a VIP site and copy these changes to mu-plugins on that site.
  2. From the site editor, choose the global styles sidebar, and then typography.
  3. Click the settings icon.
  4. Upload a font that you don't have installed on your computer.
  5. Use the font for, say, site headings in global styles.
  6. Reload the editor, and the new font should display there.
  7. View the frontend of the site and the new font should display there.

This recording shows the process:

Screen.Recording.2024-02-21.at.1.56.18.PM.mov

Copy link

codecov bot commented Feb 27, 2024

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes are missing coverage. Please review.

Project coverage is 28.95%. Comparing base (be19483) to head (6bc5fa2).

Files Patch % Lines
files/class-vip-filesystem.php 22.22% 7 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #5265      +/-   ##
=============================================
- Coverage      29.02%   28.95%   -0.08%     
- Complexity      4822     4823       +1     
=============================================
  Files            283      283              
  Lines          20937    20934       -3     
=============================================
- Hits            6077     6061      -16     
- Misses         14860    14873      +13     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@noahtallen
Copy link
Contributor Author

I think codecov might not realize the test ultimately executes the code via a filter :)

@noahtallen noahtallen changed the title Filter the font directory to work with the VIP fs Filter the font directory to work with the VIP Filesystem Feb 28, 2024
@noahtallen noahtallen self-assigned this Feb 29, 2024
return;
}

$font_dir = \wp_get_font_dir();
Copy link
Contributor Author

@noahtallen noahtallen Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to follow this PR: WordPress/wordpress-develop#6211

In case the function is renamed/changed. (Or test it by doing the filter instead.)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to follow this PR: WordPress/wordpress-develop#6211

In case the function is renamed/changed. (Or test it by doing the filter instead.)

I'll try to remember to come back and let you know.

I've been doing some expreiments on my local build and don't intend to change the name of the function or the filter but will confirm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@noahtallen noahtallen force-pushed the change-font-dir-for-wp-6.5 branch 2 times, most recently from 3e1a4e7 to 8e0ebde Compare March 15, 2024 21:24
Copy link

sonarcloud bot commented Mar 15, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@noahtallen noahtallen merged commit a0b1c87 into develop Mar 15, 2024
38 of 39 checks passed
@noahtallen noahtallen deleted the change-font-dir-for-wp-6.5 branch March 15, 2024 23:25
sjinks added a commit that referenced this pull request Mar 26, 2024
* Jetpack: Make 13.2 default (#5326)

* Prevent saving unnecessary Jetpack post_by_email_address* DB options (#5311)

* chore(deps): Bump actions/checkout from 4.1.1 to 4.1.2 (#5329)

Bumps [actions/checkout](https://github.com/actions/checkout) from 4.1.1 to 4.1.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4.1.1...v4.1.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): Bump softprops/action-gh-release from 2.0.3 to 2.0.4 (#5330)

Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](softprops/action-gh-release@v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump webpack-dev-server in /search/search-dev-tools (#5328)

Bumps [webpack-dev-server](https://github.com/webpack/webpack-dev-server) from 5.0.2 to 5.0.3.
- [Release notes](https://github.com/webpack/webpack-dev-server/releases)
- [Changelog](https://github.com/webpack/webpack-dev-server/blob/master/CHANGELOG.md)
- [Commits](webpack/webpack-dev-server@v5.0.2...v5.0.3)

---
updated-dependencies:
- dependency-name: webpack-dev-server
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump @types/node in /__tests__/e2e (#5327)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.25 to 20.11.26.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update wp-parsely submodule to version 3.14.1 (#5334)

* chore(deps-dev): Bump @types/node in /__tests__/e2e (#5332)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.26 to 20.11.27.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump postcss-preset-env from 9.5.0 to 9.5.1 (#5333)

Bumps [postcss-preset-env](https://github.com/csstools/postcss-plugins/tree/HEAD/plugin-packs/postcss-preset-env) from 9.5.0 to 9.5.1.
- [Changelog](https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-preset-env/CHANGELOG.md)
- [Commits](https://github.com/csstools/postcss-plugins/commits/HEAD/plugin-packs/postcss-preset-env)

---
updated-dependencies:
- dependency-name: postcss-preset-env
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Removes extraneous text from command description. (#5335)

When describing the command with `wp help vipsupport`, an out-of-place text would appear after the command desciption: "Class command".

* chore(deps-dev): Bump sass in /search/search-dev-tools (#5336)

Bumps [sass](https://github.com/sass/dart-sass) from 1.71.1 to 1.72.0.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/main/CHANGELOG.md)
- [Commits](sass/dart-sass@1.71.1...1.72.0)

---
updated-dependencies:
- dependency-name: sass
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump follow-redirects from 1.15.5 to 1.15.6 (#5338)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.5 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.5...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump follow-redirects in /search/search-dev-tools (#5337)

Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.4 to 1.15.6.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](follow-redirects/follow-redirects@v1.15.4...v1.15.6)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update Akismet to 5.3.1 (#5321)

* chore(deps-dev): Bump @types/node in /__tests__/e2e (#5340)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.27 to 20.11.28.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* WP 6.5 Font Library: Filter the font directory to work with the VIP Filesystem (#5265)

Uses the `font_dir` filter to set the font library upload location to the default upload directory.

* chore(deps): Bump preact from 10.19.6 to 10.19.7 in /search/search-dev-tools (#5345)

* chore(deps): Bump preact in /search/search-dev-tools

Bumps [preact](https://github.com/preactjs/preact) from 10.19.6 to 10.19.7.
- [Release notes](https://github.com/preactjs/preact/releases)
- [Commits](preactjs/preact@10.19.6...10.19.7)

---
updated-dependencies:
- dependency-name: preact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* Regenerate the bundle

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: WordPress VIP Bot <no-reply@automattic.com>

* chore(deps-dev): Bump postcss-preset-env from 9.5.1 to 9.5.2 (#5344)

Bumps [postcss-preset-env](https://github.com/csstools/postcss-plugins/tree/HEAD/plugin-packs/postcss-preset-env) from 9.5.1 to 9.5.2.
- [Changelog](https://github.com/csstools/postcss-plugins/blob/main/plugin-packs/postcss-preset-env/CHANGELOG.md)
- [Commits](https://github.com/csstools/postcss-plugins/commits/HEAD/plugin-packs/postcss-preset-env)

---
updated-dependencies:
- dependency-name: postcss-preset-env
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update wp-parsely submodule to version 3.14.2 (#5346)

* chore(deps-dev): Bump @babel/plugin-syntax-decorators (#5355)

Bumps [@babel/plugin-syntax-decorators](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-decorators) from 7.24.0 to 7.24.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.1/packages/babel-plugin-syntax-decorators)

---
updated-dependencies:
- dependency-name: "@babel/plugin-syntax-decorators"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump @types/node in /__tests__/e2e (#5354)

Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 20.11.28 to 20.11.30.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump @babel/plugin-syntax-decorators in /__tests__/e2e (#5353)

Bumps [@babel/plugin-syntax-decorators](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-syntax-decorators) from 7.24.0 to 7.24.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.1/packages/babel-plugin-syntax-decorators)

---
updated-dependencies:
- dependency-name: "@babel/plugin-syntax-decorators"
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps-dev): Bump @babel/plugin-transform-class-properties (#5348)

Bumps [@babel/plugin-transform-class-properties](https://github.com/babel/babel/tree/HEAD/packages/babel-plugin-transform-class-properties) from 7.23.3 to 7.24.1.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.24.1/packages/babel-plugin-transform-class-properties)

---
updated-dependencies:
- dependency-name: "@babel/plugin-transform-class-properties"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Jetpack: Revert to 13.1 for WP 6.3 (#5361)

* Disable "Invite user to WordPress.com" checkbox temporarily (#5366)

Add Jetpack SSO workaround to allow user creation on VIP

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Rebecca Hum <rebecca.hum@automattic.com>
Co-authored-by: Tallulah <tallulah@automattic.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Henrique Mouta <henrique.mouta@automattic.com>
Co-authored-by: Bruno Basto <b.basto@gmail.com>
Co-authored-by: Brooke <brooke@automattic.com>
Co-authored-by: Noah Allen <noahtallen@gmail.com>
Co-authored-by: WordPress VIP Bot <no-reply@automattic.com>
Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
Co-authored-by: Luiz Tiago Oliveira <luiztiago@gmail.com>
Co-authored-by: Alec Geatches <alec.geatches@automattic.com>
noahtallen added a commit that referenced this pull request Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants