Repository navigation
fix(styles): list built-in styles from theme config.xml files - #145
Merged
Merged
Conversation
Editor builds now ship only data/bundle.json.zst, so reading the plain bundle.json returned no built-in styles. Read each bundled theme's config.xml instead and drop the unused bundle.json walker.
Contributor
Test in WordPress PlaygroundTest the plugin with the code from this branch:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #145 +/- ##
============================================
- Coverage 96.40% 96.39% -0.02%
+ Complexity 827 815 -12
============================================
Files 36 36
Lines 4228 4213 -15
============================================
- Hits 4076 4061 -15
Misses 152 152
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
…-compressed-bundle
…-compressed-bundle
…-compressed-bundle # Conflicts: # languages/exelearning-ca.po # languages/exelearning-ca_valencia.po # languages/exelearning-de_DE.po # languages/exelearning-eo.po # languages/exelearning-es_ES.po # languages/exelearning-eu.po # languages/exelearning-gl_ES.po # languages/exelearning-it_IT.po # languages/exelearning-pt_PT.po # languages/exelearning-ro_RO.po # languages/exelearning.pot
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.
Thanks to @ismagago for reporting this.
Fixes exelearning/exelearning#2461 for the WordPress plugin.
Problem
ExeLearning_Styles_Service::list_builtin_themes()read the theme list fromdist/static/data/bundle.json. Current editor builds ship only the zstd-compresseddata/bundle.json.zst, which PHP cannot decode without the rarely installed zstd extension. The v4.0.5 ZIP has no plainbundle.json, so the settings screen showed no built-in styles and administrators could not hide any. The tests did not catch this because the fixture wrote a plainbundle.json.Fix
list_builtin_themes()now reads eachdist/static/files/perm/themes/base/<dir>/config.xml. It reuses the existing hardenedExeLearning_Style_Package::parse_config_xml()and uses the directory name as the theme id. Themes with a missing, empty or corruptconfig.xmlare skipped.bundle.jsonwalker (extract_themes_from_bundle()in both classes) had no other callers, so it has been removed along with its tests.ExeLearning_Bundle_Fixturenow builds the same layout as a release: aconfig.xmlper theme and onlybundle.json.zst.Verification
StylesServiceBuiltinsTestfailed onmain(4 failures, all empty lists) and passes with the fix.BlockTranslationsTest/I18nTestalso fail onmainlocally, because the compiled translation files are missing and are unrelated to this change.vendor/bin/phpcsis clean on the changed files.