Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I was upgrading webfomr 3.x to 4.x version,
While running update.php, I came across a situation where update stops at webform_update_7425().
It happens because, site didn't have views module installed while webform 4.x assume it is installed in hooks
webform_update_7425() and webform_update_7427().
Even though webform.info has dependencies[] = views , it would be great, if webform module have check to see if views is enabled or not if not, do enable it.
It can be added under webform_requirements().
if (!module_exists('views')) {
$result = module_enable(array('views'));
if (empty($result)) {
throw new DrupalUpdateException(implode(', ', $modules) . ' or dependencies could not be enabled');
}
}
Comment | File | Size | Author |
---|---|---|---|
#7 | webform-update_no_views-2560339-7.patch | 2.67 KB | DanChadwick |
webform_4.x_upgrade_finish_page.png | 86.88 KB | dineshw |
Comments
Comment #2
DanChadwick CreditAttribution: DanChadwick commentedWould be a nice enhancement for those who don't read the documentation before updating.
Comment #3
dineshw CreditAttribution: dineshw as a volunteer commented@Dan: should I create a patch for same? Would like to help on this.
Comment #4
DanChadwick CreditAttribution: DanChadwick commentedAbsolutely!
Comment #5
DanChadwick CreditAttribution: DanChadwick commentedAny progress on your patch? I think the requirements should return an error, rather than raise an exception. It appears that update.php checks the requirements first.
Comment #6
DanChadwick CreditAttribution: DanChadwick commentedThis is trickier than it appears. There are two significant differences between updating with drush and with update.php:
See this issue in the github drush queue: https://github.com/drush-ops/drush/issues/1427
The consequence is that adding a hook_requirements() can prevent the update from running if executed via the update.php, but it does not prevent the issue with drush. Throwing an exception won't help because the requirements are never checked.
I believe the best course of action is to add the requirement to hook_requirements() and to throw the exception in the hook_update_N functions that require views.
Comment #7
DanChadwick CreditAttribution: DanChadwick commentedCommitted to 7.x-4.x. No corresponding issue for D8 exists because the update path for D7 to D8 will be different and view is in D8 core.
Comment #9
dineshw CreditAttribution: dineshw as a volunteer commented@DanChadwick Perfect :)