Repository navigation
Remove the core fonts a new install wouldn't have on the upgrade to 6.19 - #1998
Merged
Merged
Conversation
Contributor
|
Coverage report for commit: 56936aa Summary - Lines: 92.90% | Methods: 87.66% | Branches: 81.85%
🤖 Jest coverage report |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
|
Coverage report for commit: 56936aa Summary - Lines: 89.17% | Methods: 95.58%
🤖 PHPUnit coverage report |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
gravitypdf-bot
force-pushed
the
feature/core-font-upgrade-prune
branch
from
November 2, 2026 06:47
a28fb49 to
3e03eb0
Compare
gravitypdf-bot
force-pushed
the
feature/core-font-upgrade-prune
branch
from
November 2, 2026 06:50
3e03eb0 to
21789c6
Compare
gravitypdf-bot
force-pushed
the
feature/core-font-upgrade-prune
branch
from
November 3, 2026 09:28
21789c6 to
9c38e63
Compare
This was referenced Nov 3, 2026
Merged
jakejackson1
force-pushed
the
feature/core-font-upgrade-prune
branch
from
November 3, 2026 23:23
9c38e63 to
6610982
Compare
gravitypdf-bot
force-pushed
the
feature/core-font-upgrade-prune
branch
from
November 4, 2026 01:40
6610982 to
bfaf443
Compare
gravitypdf-bot
force-pushed
the
feature/core-font-upgrade-prune
branch
2 times, most recently
from
November 5, 2026 03:19
38baf0d to
ce1d9b5
Compare
Sites that ran the old Core Font installer carry all 82 files (~91 MB) in the uploads fonts folder. Now that missing core fonts are downloaded on use, the upgrade deletes everything outside the required set: the default font (after the upgrade saves DejaVu Sans Condensed for sites that never chose one), the site's language fonts, required sources' files and the fonts the active forms' PDFs select. Model_Font_Downloader::prune() walks the manifest rather than the folder, so it only ever touches manifest names. Its keep list defaults to the downloader's own Model_Required_Fonts, the set sync() downloads, so the two can't drift. It skips kept files before any stat, checks size before hashing, and deletes a file (font or licence) only when its git blob SHA-1 matches, so kept, user-modified and non-core files are never hashed or removed. A manifest that fails to load deletes nothing. A font that downloads are turned off for (the gfpdf_auto_install_fonts filter, per file, or GPDF_AUTO_INSTALL_FONTS) stays, since the site couldn't get it back; those are logged, and a summary of the files and bytes removed is always logged. Deletion goes through wp_delete_file_from_directory(), and a failed delete is logged. The step runs from Controller_Upgrade_Routines on upgrades from before 6.19.0, never on new installs, resolving the downloader through GPDFAPI::get_mvc_class() as adopt_font_source_records() does. The fonts folder is network-wide, so a Multisite runs it once: add_site_option( Model_Font_Downloader::PRUNED ) claims it, keeping the selections of whichever site's request upgrades; other sites' fonts come back on their next render. The bundled fonts/ folder is never touched. Uninstall deletes the gfpdf_core_font_pruned flag. A Font Manager record whose file is a byte-identical core font loses that file unless a PDF selects it; mPDF asks for the file by name and the on-demand finder downloads it again, which a test covers. The tests' fonts-folder path helper moves into CopiesFontFixtures::font_path(). Also updates mpdf/mpdf to the GravityPDF/mpdf gravitypdf-v6 tip (0c6322c: dehinted bundled fonts, #850/#854, and the internal link border fix, #852), and the core font manifest to mpdf-core-fonts v1.1.1, whose 47 dehinted fonts have new sizes and hashes. The four DejaVu test fixtures are replaced with their v1.1.1 files to keep matching it. Sites upgrading from 6.18 hold the installer's v1.0.0 files, so the core source gains a legacy_manifest, fonts/core-fonts-v1.0.0.php: a frozen copy of the v1.0.0 listing, read only by the 6.19 upgrade. prune() checks files against it through Model_Font_Sources::get_legacy_manifest( 'core' ), and adopt_records() accepts its hashes alongside the current manifest's, so a 6.18 Font Manager record of installer-downloaded files is still adopted. A v1.0.0 DejaVu Serif Condensed fixture (the blob already in history) covers both end to end. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gravitypdf-bot
force-pushed
the
feature/core-font-upgrade-prune
branch
from
November 5, 2026 03:32
ce1d9b5 to
56936aa
Compare
This was referenced Nov 5, 2026
Merged
This was referenced Nov 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Sites that ran the old Core Font installer carry all 82 core font files (about 91 MB) in their fonts folder. Missing core fonts now download when needed, so on the upgrade to 6.19 this PR deletes the core fonts a new install wouldn't have. Anything still needed downloads again the next time a PDF uses it.
fonts/folder are left alone.gfpdf_auto_install_fontsorGPDF_AUTO_INSTALL_FONTS, is kept, since the site couldn't get it back.gfpdf_core_font_prunednetwork option.mpdf/mpdfto thegravitypdf-v6tip (dehinted bundled fonts, Strip TrueType hinting from the bundled fonts whose licences allow it mpdf#850 and Strip TrueType hinting from Khmer OS, Ayar and MPH 2B Damase (v6) mpdf#854, and the link border fix, Write the border entry inside internal link dictionaries (v6) mpdf#852), and the core font manifest tompdf-core-fontsv1.1.1 (47 dehinted fonts with new hashes). The four DejaVu test fixtures now use the v1.1.1 files.legacy_manifest,fonts/core-fonts-v1.0.0.php, which the prune checks against and record adoption also accepts, so 6.18 Font Manager records of installer files are still adopted.Try it
wp-content/uploads/PDF_EXTENDED_TEMPLATES/fonts/has all 82 files.define( 'GPDF_AUTO_INSTALL_FONTS', false );inwp-config.php. Nothing is deleted.Test plan
developmentand the/simplifypass; CI covers the final commit.definewarning).More info
Model_Font_Downloader::prune( ?array $keep = null )walks the core source's legacy manifest (Model_Font_Sources::get_legacy_manifest( 'core' ), mpdf-core-fonts v1.0.0), not the folder, so it only ever touches manifest names. The keep list defaults to the downloader's ownModel_Required_Fonts::get_required_font_files(), the same setsync()downloads, and is only built once the manifest has loaded. Per file, it checks in this order: kept, on disk, same size, downloads on, then the git blob SHA-1. It deletes throughwp_delete_file_from_directory()against the fonts folder, and returns the files it removed.Controller_Upgrade_Routines::remove_unneeded_core_fonts()runs in the existing< 6.19.0block, aftersave_unset_default_font( 'dejavusanscondensed' ), so the default it saves is kept.( true )argument isn't needed.add_site_option( Model_Font_Downloader::PRUNED )claims the prune before it runs, so a second site's upgrade skips it. The selections are those of the site whose request runs the upgrade, with noswitch_to_blog(). Other sites' fonts download again the next time they render a PDF that needs them.GPDFAPI::get_mvc_class()with aninstanceofguard, asadopt_font_source_records()does; its constructor is unchanged.legacy_manifest: a source key beside the existinglegacyhash map.get_known_files()folds it in, soadopt_records( 'core' )matches v1.0.0 and v1.1.1 copies. The file is frozen;fonts/README.mdrecords the command that wrote it, and it goes when the 6.19 upgrade routine does.Tests: the fonts-folder path helper the downloader and upgrade tests each had moves into
CopiesFontFixtures::font_path().Accepted: fonts used only by inactive or trashed forms, and a Font Manager record whose file is a byte-identical core font that no PDF selects, are removed. Both download again when used.
Snapshots: none changed.