-
Notifications
You must be signed in to change notification settings - Fork 260
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
chore(autoloading): Only use authoritative classmaps for production #8020
chore(autoloading): Only use authoritative classmaps for production #8020
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) {
Excellent catch. That explains the missing class despite my changes. |
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
9775576
to
887ef3e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again:
- Checked out the PR
- composer i
- created migration
- bumped info.xml
- started upgrade via webUI
- Migration runs through
- Profit!
How to test
composer i
vendor/composer/autoload_real.php
Main: you find a
$loader->setClassMapAuthoritative(true);
and switching between branches could potentially trigger missing classes if you don't runcomposer i
orcomposer dump-autoload
to 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.