Problem/Motivation
On a site with both the sitemap and book modules installed, the update hook sitemap_update_8202() (added in #3454907: Drupal 11 compatibility fixes for sitemap) throws an error when you run it:
[error] Call to undefined method Drupal\Core\Extension\ModuleHandler::install()
Steps to reproduce
- Install Drupal and sitemap-8.x-2.0-beta6
- Upgrade sitemap to sitemap-8.x-2.0-beta7
- Run update hooks
Proposed resolution
diff --git a/sitemap.install b/sitemap.install
index 0ddbccc..c52952a 100644
--- a/sitemap.install
+++ b/sitemap.install
@@ -156,7 +156,7 @@ function sitemap_update_8201(&$sandbox) {
*/
function sitemap_update_8202(&$sandbox) {
if (\Drupal::moduleHandler()->moduleExists('book')) {
- \Drupal::moduleHandler()->install(['sitemap_book']);
+ \Drupal::service('module_installer')->install(['sitemap_book']);
}
}
Remaining tasks
Write a patchCommitHotfix release
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork sitemap-3466530
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
Comment #3
mparker17Patch created; waiting for tests to finish.
Comment #4
mparker17Tests pass. Merging. When merged, I'll create and push a tag; then create a new release. In the meantime; I'll write some release notes.
Comment #6
mparker17Merged; making the hotfix release now.
Thanks for your patience, everyone!
Comment #7
mparker17Hotfix in 8.x-2.0-beta8.
Comment #8
mparker17I can unassign myself now.