Skip to main content
deleted 150 characters in body
Source Link
Steven
  • 1.2k
  • 6
  • 18

A module with an install file gets run at install, for an example if you install/enable a module with one hook_install and three hook_update_ all of those will be ran, and the database will be set toonly the last hook_update_ so if you where to add a new hook_update_hook_install you could run update.php which would run that hook functionwill be ran.

The best way to do what you want to do is create a module like you want, with a empty hook_install then just keep adding hook_update_ functions as you need to do more stuff, then when you are done run update.php to run all the hooks.

It may also be a good idea to separate the types of stuff you want to do into groups (like create new items, and add them to the database, then another hook could be delete x and y, and another could be rename a and b) and add them as hook_update_ so for example if you need to run something more then once for an example or maybe down the road, you could just call update.php and run that specific hook_update_ function (if you for example wanted to run delete x and y more then once, you can).

A module with an install file gets run at install, for an example if you install/enable a module with one hook_install and three hook_update_ all of those will be ran, and the database will be set to the last hook_update_ so if you where to add a new hook_update_ you could run update.php which would run that hook function.

The best way to do what you want to do is create a module like you want, with a empty hook_install then just keep adding hook_update_ functions as you need to do more stuff, then when you are done run update.php to run all the hooks.

It may also be a good idea to separate the types of stuff you want to do into groups (like create new items, and add them to the database, then another hook could be delete x and y, and another could be rename a and b) and add them as hook_update_ so for example if you need to run something more then once for an example or maybe down the road, you could just call update.php and run that specific hook_update_ function (if you for example wanted to run delete x and y more then once, you can).

A module with an install file gets run at install, for an example if you install/enable a module with one hook_install and three hook_update_ only the hook_install will be ran.

The best way to do what you want to do is create a module like you want, with a empty hook_install then just keep adding hook_update_ functions as you need to do more stuff, then when you are done run update.php to run all the hooks.

It may also be a good idea to separate the types of stuff you want to do into groups (like create new items, and add them to the database, then another hook could be delete x and y, and another could be rename a and b) and add them as hook_update_ so for example if you need to run something more then once for an example or maybe down the road, you could just call update.php and run that specific hook_update_ function (if you for example wanted to run delete x and y more then once, you can).

Source Link
Steven
  • 1.2k
  • 6
  • 18

A module with an install file gets run at install, for an example if you install/enable a module with one hook_install and three hook_update_ all of those will be ran, and the database will be set to the last hook_update_ so if you where to add a new hook_update_ you could run update.php which would run that hook function.

The best way to do what you want to do is create a module like you want, with a empty hook_install then just keep adding hook_update_ functions as you need to do more stuff, then when you are done run update.php to run all the hooks.

It may also be a good idea to separate the types of stuff you want to do into groups (like create new items, and add them to the database, then another hook could be delete x and y, and another could be rename a and b) and add them as hook_update_ so for example if you need to run something more then once for an example or maybe down the road, you could just call update.php and run that specific hook_update_ function (if you for example wanted to run delete x and y more then once, you can).