1

I have a module that uses update function in the module.install file.

When debugging these changes during development, I call the function from hook_init().

function mymodule_init() {
  require_once __DIR__ . '/mymodule.install';
  mymodule_update_7016();

Everything is just peachy. The update code is run, which makes changes to a the CiviCRM settings for a Drupal webform. When I load the webform edit page I can see the changes have been made.

Now I think I'm done with this, and I can just use drush updb to call my upgrader. I do so. My updater runs without errors.

However, when I check the page, there are no changes reflected in the webform. The exact same code is run from two different places, and in one case the results are saved; in the other, nothing happens.

I have tested making changes to the node title (which is unrelated to webform_civicrm) and it works in both cases so the problem seems to be related to webform_civicrm.

Why would the behaviour be different in an upgrading function compared to when run as part of the request lifecycle in hook_init()? I've added drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); to my code to see if it made any difference, but it didn't.

1
  • How it's called shouldn't matter. It's the code contained in your update hook where the issue likely resides.
    – Jaypan
    Apr 23, 2018 at 14:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.