![]() This is intended to introduce a change between different versions of Drupal or contributed modules. I thought I would take a look at the different ways that it's possible to apply updates to a Drupal site, and some strategies and best practices of running each one. This can be used to create batch processes in your update hooks in order to allow lots of information to be processed at once. It can even be used to deploy content changes like adding menu items or taxonomy terms or even adding content to new fields.Īll update hooks have access to a $sandbox parameter. ![]() This allows complex changes to be deployed in a clean and predictable manner. Update hooks can also be used to introduce changes to sites by managing configuration and content. Without this step the module would likely crash as it attempts to inject data into tables or fields that don't exist. This means that as well as updating the schema information you also need to provide steps in the update hooks to update existing installs. Once you release the module you must ensure that everyone who already has the module installed can still use it after the schema has changed. All of these hooks are run once and once only and the key idea is that they take Drupal (or a module) from one version to another by adding database changes or configuration updates as the module gets updated.įor example, if you have a module that has a database table then it will be stored as schema information within your module. The hook_deploy_NAME() hook, bundled with Drush 10, can also be used as an update hook in the same way.Įach of these update hooks has a number of different best practices when considering their use. The hook_update_N() hook is just one of the options available in running updates as the update pipeline also includes hook_post_update_NAME(). I have written lots of detail about using update hooks to manage updates in Drupal and they have all been about the hook_update_N() hook.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |