Skip to content

Create x.install file instead of module when using generate:update - #2997

Merged
jmolivas merged 1 commit into
hechoendrupal:masterfrom
colinappnovation:master
Dec 17, 2016
Merged

jmolivas merged 1 commit into
hechoendrupal:masterfrom
colinappnovation:master

Conversation

@colinappnovation

Copy link
Copy Markdown
Contributor

Problem/Motivation

Noticed today that when using drupal generate:update with no module or install file present; a module file is created rather than *.install.

Solution

Modification to generate() function within UpdateGenerator.php to create *.install file as apposed to *.module file. As hook_update_N() should be placed in *.install file by best practice.

@enzolutions

Copy link
Copy Markdown
Contributor

@colinappnovation why .install instead of .module, could you point any documentation that suggest this change, please.

@colinappnovation

Copy link
Copy Markdown
Contributor Author

@enzolutions https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Extension!module.api.php/function/hook_update_N/8.2.x

"For each change in a module that requires one or more actions to be performed when updating a site, add a new implementation of hook_update_N() to your mymodule.install file (assuming mymodule is the machine name of your module). Implementations of hook_update_N() are named (module name)update(number)."

@timmillwood

Copy link
Copy Markdown

+1 to this hook_update_N() functions should always go in the .install file.

@jmolivas
jmolivas merged commit fb26c80 into hechoendrupal:master Dec 17, 2016
@jmolivas

Copy link
Copy Markdown
Member

@colinappnovation Thanks for your contribution, your PR was merged. This will be included on the next release.

@timmillwood thanks for your participation on this PR.

@jmolivas jmolivas added this to the 1.0.0-rc12 milestone Dec 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants