Skip to content
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

Module name error on deploy:hook when module name contains _deploy #5112

Closed
wants to merge 1 commit into from

Conversation

idiazroncero
Copy link

Hello;

I noticed a rather specific error when the module's name contains the substring _deploy on its name.

Take mymodule_deploy as an example, with a mymodule_deploy_deploy_myfunction deploy hook and a mymodule_deploy.deploy.php file.

Running drush deploy:hook will fail with the following error:

[warning] Deploy hook function mymodule_deploy_deploy_myfunction not found in file mymodule.deploy.php

This is because list($module, $name) = explode('_deploy_', $function, 2); will set $module to just mymodule and not mymodule_deploy and, thus, the $filename will be wrong.

This is an uncommon but not rare scenario. In fact, it happened to me because I had a separate custom module dedicated to deploy hooks that had the deploy substring on the name.

The attached patch tries to solve this by first locating the deploy name and then substracting it from the function name in order to get the real module name.

@pfrenssen pfrenssen changed the base branch from 10.x to 11.x August 30, 2022 14:43
@pfrenssen pfrenssen changed the base branch from 11.x to 10.x August 30, 2022 14:43
@pfrenssen
Copy link
Member

Thanks for the report!

Sorry this was not responded to earlier, but possibly since there was no corresponding issue and the test was failing this fell through the cracks.

In the meantime this has gone stale and doesn't apply to 11.x.

Created issue: #5216 and a new PR at #5217.

Closing this since it is superseded by #5217.

@pfrenssen pfrenssen closed this Aug 30, 2022
@idiazroncero
Copy link
Author

Sorry, i thought a PR created automatically a related issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants