Repository navigation
Register Magento 2 themes when a release changes the theme set - #4263
Open
michielgerritsen wants to merge 1 commit into
Open
michielgerritsen wants to merge 1 commit into
michielgerritsen wants to merge 1 commit into
Conversation
Theme registration is part of Magento's data upgrade, which the recipe only runs when setup:db:status asks for it. A release that changes nothing but the set of themes leaves the theme table pointing at a directory that is gone, and every page fails with "Required parameter 'theme_dir' was not passed". Fingerprint the theme.xml files of the release, compare that with what the last deploy registered, and run setup:db-data:upgrade when it differs.
This branch has not been deployed
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.
Theme registration is part of Magento's data upgrade, which the recipe only runs when
setup:db:statusasks for it. A release that changes nothing but the set of themes, Hyvä 1.5 dropping its reset theme for example, therefore leaves thethemetable pointing at a directory that no longer exists, and every page fails withRequired parameter 'theme_dir' was not passed. This fingerprints thetheme.xmlfiles in the release, compares that with what the last deploy registered, and runssetup:db-data:upgradewhen it differs, which is the cheapest command that triggersMagento_Theme's recurring data script: 1.7s on a mid-size shop, measured against a deliberately brokenthemetable.theme_registration_neededfeedsupgrade_needed, so maintenance mode brackets it exactly like a db upgrade, and a db or full upgrade stands the check down because it registers themes anyway.One thing to watch out for: a vendor bumping a theme
<title>counts as a change, so it costs one no-op data upgrade inside maintenance. Erring that way seemed better than missing a re-parented theme.Two notes on the test. It uses one import with a host per scenario because
recipe/magento2.phpdeclares a top-level function, so importing it twice in one process is already fatal, and its fixture requiresrecipe/common.phpexplicitly because therequire_oncein the recipe skips it when another spec loaded it earlier in the same process. Happy to split either of those off if you would rather see them fixed separately.