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

Deploy hook not found when module name contains _deploy #5216

Closed
pfrenssen opened this issue Aug 30, 2022 · 0 comments · Fixed by #5217
Closed

Deploy hook not found when module name contains _deploy #5216

pfrenssen opened this issue Aug 30, 2022 · 0 comments · Fixed by #5217

Comments

@pfrenssen
Copy link
Member

pfrenssen commented Aug 30, 2022

Describe the bug
This was originally reported in #5112 by @idiazroncero.

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.

To Reproduce

  • Create a module named myproject_deploy.
  • Create a myproject_deploy.deploy.php file which has a deploy function named myproject_deploy_deploy_my_update().
  • Run drush deploy

Expected behavior
Deploy hook is executed normally.

Actual behavior

 [warning] Deploy hook function myproject_deploy_deploy_my_update not found in file myproject.deploy.php
 [error]  Deploy hook failed: myproject_deploy_deploy_my_update
 [error]  Update aborted by: myproject_deploy_deploy_my_update
weitzman pushed a commit that referenced this issue Sep 3, 2022
…e. (#5217)

* Test execution of deploy hooks inside a module with _deploy in the name.

Test for #5216

* Support deploy hooks in modules with _deploy in the name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant