chore(autoloading): Only use authoritative classmaps for production#8020
Merged
miaulalala merged 1 commit intomainfrom Feb 17, 2023
Merged
Conversation
miaulalala
requested changes
Feb 14, 2023
Contributor
miaulalala
left a comment
There was a problem hiding this comment.
I tried testing this with the following steps:
- Check out main
- Run composer i
- check out this branch
- create new empty migration via occ and bump info.xml
- run the upgrade from the web ui
Unfortunately the lookup didn't work with the typical error that happens when the composer autoloader wasn't dumped:
st3iny
approved these changes
Feb 16, 2023
Member
st3iny
left a comment
There was a problem hiding this comment.
Tested and works.
@miaulalala The existing autoloader has the authoritative state ingrained and thus it has to be generated once more after this PR. The setting from composer.json is only read on dumping the autoloader (or installing dependencies).
vendor/composer/autoload_real.php
41 │ }
42 │
43 │ $loader->setClassMapAuthoritative(true);
44 │ $loader->register(true);
45 │
46 │ if ($useStaticLoader) {
Member
Author
|
Excellent catch. That explains the missing class despite my changes. |
Signed-off-by: Christoph Wurst <[email protected]>
9775576 to
887ef3e
Compare
miaulalala
approved these changes
Feb 17, 2023
Contributor
miaulalala
left a comment
There was a problem hiding this comment.
Tested again:
- Checked out the PR
- composer i
- created migration
- bumped info.xml
- started upgrade via webUI
- Migration runs through
- Profit!
4 tasks
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.

How to test
composer ivendor/composer/autoload_real.phpMain: you find a
$loader->setClassMapAuthoritative(true);and switching between branches could potentially trigger missing classes if you don't runcomposer iorcomposer dump-autoloadto update the class mapHere: class map is still optimized on dev but tries to look up missing classes. On production we use the authoritative classmaps nevertheless.