Problem/Motivation
When upgrading a minimal Drupal installation from 11.2.8 to 11.3.1, without Views enabled, drush updb fails with the error message: Class "Drupal\views\ViewsConfigUpdater" does not exist
> [notice] Update started: block_content_post_update_remove_block_content_listing_empty
> [error] Class "Drupal\views\ViewsConfigUpdater" does not exist.
> [error] Update failed: block_content_post_update_remove_block_content_listing_empty
[error] Update aborted by: block_content_post_update_remove_block_content_listing_empty
[error] Finished performing updates.
Steps to reproduce
Run this update without Views enabled.
Proposed resolution
Check views is enabled before running update
Remaining tasks
Review
User interface changes
N/A
Introduced terminology
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
N/A
| Comment | File | Size | Author |
|---|
Issue fork drupal-3565703
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3565703-class-drupalviewsviewsconfigupdater-does
changes, plain diff MR !14241
Comments
Comment #2
cilefen commentedThanks for this report. I commented to mention this on #3095893: Remove duplicate "add block" link from block content type view's "Results not found" message.
Comment #3
cilefen commentedComment #4
geekinformatic commentedPlease check i have created the patch for this issue.
Comment #5
cilefen commentedComment #6
jitteri commentedThanks! The patch fixes the issue and I can upgrade from Drupal 11.2.8 as
No more errors!
Comment #8
geekinformatic commentedComment #9
smustgrave commentedThink all the MR needs is the early return. If views is disabled rest won’t run. Should keep the rest as is for consistency.
Thanks!
Comment #10
geekinformatic commentedThanks for the review.
The issue was caused by referencing ViewsConfigUpdater when the Views module is not enabled. I’ve updated the patch to add an early return when Views is disabled and kept the remaining logic unchanged for consistency.
Additionally, the Views classes are no longer preloaded; they are only referenced after the module existence check to avoid fatal on minimal installs.
Please review the updated patch.
Comment #11
smustgrave commentedSorry meant line 43-48 believe should be the only changes needed. FYI don’t need to upload a patch all reviews happen in the MR :)
Comment #12
acbramley commentedI've manually tested this and we don't need to change or remove the classes in the update function, we simply need the
moduleExistscheck.Comment #13
geekinformatic commentedHello @acbramley @smustgrave,
Thanks for the clarification.
I just want to better understand the reasoning here — why do we still need to load these classes when the view is disabled and the logic is guarded by the moduleExists check?
Understanding this will help me in future development work as well.
Comment #14
acbramley commented@geekinformatic the MR is failing linting because you have removed the use statements.
"Namespaced classes/interfaces/traits should be referenced with use statements"
We aren't loading the classes, just making it easier to get this fix through :)
Comment #15
acbramley commentedI think this would class as a Major if not Critical since it breaks upgrade paths for sites without views. With that in mind I'm pushing the fix so we can get this in ASAP.
Comment #16
acbramley commentedComment #17
acbramley commentedComment #18
smustgrave commentedLGTM!
Comment #22
catchCommitted/pushed to 11.x and cherry-picked to 11.3.x, thanks!