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

Issue fork drupal-3565703

Command icon 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:

Comments

jitteri created an issue. See original summary.

cilefen’s picture

cilefen’s picture

Version: 11.3.x-dev » 11.x-dev
Issue summary: View changes
geekinformatic’s picture

Status: Active » Needs review
StatusFileSize
new1.78 KB

Please check i have created the patch for this issue.

cilefen’s picture

Status: Needs review » Needs work
Issue tags: +Needs merge request
jitteri’s picture

Thanks! The patch fixes the issue and I can upgrade from Drupal 11.2.8 as

composer update --with-all-dependencies
wget 'https://www.drupal.org/files/issues/2026-01-06/3565703-4.patch'
cd web
patch -p1 < ../3565703-4.patch
cd ..
drush updb

No more errors!

>  [notice] Update started: system_update_11202                                                                                                    
>  [notice] Update completed: system_update_11202                                                                                                  
>  [notice] Update started: system_update_11300                                                                                                    
>  [notice] Update completed: system_update_11300                                                                                                  
>  [notice] Update started: block_content_post_update_remove_block_content_listing_empty                                                           
>  [notice] Update completed: block_content_post_update_remove_block_content_listing_empty                                                         
>  [notice] Update started: block_content_post_update_remove_block_content_status_info_keys                                                        
>  [notice] Update completed: block_content_post_update_remove_block_content_status_info_keys                                                      
>  [notice] Update started: ckeditor5_post_update_list_type                                                                                        
>  [notice] Update completed: ckeditor5_post_update_list_type                                                                                      
>  [notice] Update started: ckeditor5_post_update_list_type_again                                                                                  
>  [notice] Update completed: ckeditor5_post_update_list_type_again                                                                                
>  [notice] Update started: node_post_update_add_rebuild_permission_to_roles                                                                       
>  [notice] Update completed: node_post_update_add_rebuild_permission_to_roles                                                                     
>  [notice] Update started: node_post_update_create_promote_base_field_overrides                                                                   
>  [notice] Update completed: node_post_update_create_promote_base_field_overrides                                                                 
>  [notice] Update started: system_post_update_delete_rss_config                                                                                   
>  [notice] Update completed: system_post_update_delete_rss_config                                                                                 
>  [notice] Update started: update_post_update_fix_update_emails                                                                                   
>  [notice] Update completed: update_post_update_fix_update_emails                                                                                 
 [success] Finished performing updates.                                                                                                            

geekinformatic’s picture

Status: Needs work » Needs review
smustgrave’s picture

Status: Needs review » Needs work

Think 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!

geekinformatic’s picture

Status: Needs work » Needs review
StatusFileSize
new1.6 KB

Thanks 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.

smustgrave’s picture

Status: Needs review » Needs work

Sorry 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 :)

acbramley’s picture

Issue tags: -Needs merge request

I've manually tested this and we don't need to change or remove the classes in the update function, we simply need the moduleExists check.

geekinformatic’s picture

Hello @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.

acbramley’s picture

@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 :)

acbramley’s picture

Priority: Normal » Major
Status: Needs work » Needs review

I 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.

acbramley’s picture

Title: Class "Drupal\views\ViewsConfigUpdater" does not exist » block_content post update fails if views module is disabled
acbramley’s picture

Issue summary: View changes
smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

LGTM!

  • catch committed c16154f0 on 11.3.x
    fix: #3565703 block_content post update fails if views module is...

  • catch committed 4f08750a on 11.x
    fix: #3565703 block_content post update fails if views module is...

catch’s picture

Version: 11.x-dev » 11.3.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 11.x and cherry-picked to 11.3.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.