-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Fix non-working regenerate flag #39140
base: 2.4-develop
Are you sure you want to change the base?
Conversation
The functionality around the regenerate flag (file `var/.regenerate`) seems broken for some time already. The flag is meant to wipe out generated code (from the `generated/` folder). However, this does not much. To test for this: ```bash touch var/.regenerate mkdir -p generated/code/ touch generated/code/test ``` Expected behaviour: A lock file `var/.regenerate.lock` is generated, the generated code (and specifically, the dummy file `generated/code/test`) is removed and the lock is removed as well, simply by reloading the Magento application (a refresh on the frontend, a call upon `bin/magento`, or something similar) while in the Developer Mode. Actual behaviour: The `var/.regenerate` just sits there, doing nothing. Likewise, the dummy file `generated/code/test` is still there. The reason for this is quite simple: Within the main class `\Magento\Framework\Code\GeneratedFiles`, the flag is defined via a constant https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/Code/GeneratedFiles.php#L24 with a value `/var/.regenerate` (an absolute path) and not `var/.regenerate` (a relative path). Because of this, the write call `isExists()` fails validation https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/Code/GeneratedFiles.php#L123 and therefore the flag is never picked up upon. Changing the constant value to `var/.regenerate` makes sure (on my side) that the generated files are cleaned up properly.
Hi @jissereitsma. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
@magento create issue |
@magento run all tests |
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.
Hello @jissereitsma,
Thanks for the report and collaboration!
The changes seems good to me, but there are some static tests failures. Please fix them.
Thanks
3d6e783
to
31aa73c
Compare
@magento run all tests |
It seems that the review changes mentioned in comment, has been taken care hence moving it back to review. |
Hello @jissereitsma , Thanks for your contribution! As per this comment, the issue is not reproducible. I also tried but was unable to reproduce it. Could you please recheck or provide more details? Thanks again. |
Description (*)
The functionality around the regenerate flag (file
var/.regenerate
) seems broken for some time already. The flag is meant to wipe out generated code (from thegenerated/
folder). However, this does not much.Manual testing scenarios (*)
To test for this:
Expected behaviour: A lock file
var/.regenerate.lock
is generated, the generated code (and specifically, the dummy filegenerated/code/test
) is removed and the lock is removed as well, simply by reloading the Magento application (a refresh on the frontend, a call uponbin/magento
, or something similar) while in the Developer Mode.Actual behaviour: The
var/.regenerate
just sits there, doing nothing. Likewise, the dummy filegenerated/code/test
is still there.The reason for this is quite simple: Within the main class
\Magento\Framework\Code\GeneratedFiles
, the flag is defined via a constant https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/Code/GeneratedFiles.php#L24 with a value/var/.regenerate
(an absolute path) and notvar/.regenerate
(a relative path). Because of this, the write callisExists()
fails validation https://github.com/magento/magento2/blob/2.4-develop/lib/internal/Magento/Framework/Code/GeneratedFiles.php#L123 and therefore the flag is never picked up upon.Changing the constant value to
var/.regenerate
makes sure (on my side) that the generated files are cleaned up properly.Contribution checklist (*)
Resolved issues: