Problem/Motivation

There are modules that WxT has added as dependencies in info files but when these were added, there was no update hook to install the module. The result is that after a site gets updated, it could have modules that are dependencies that are not installed.

Dependencies of wxt: jquery_ui_resizable

Dependencies of wxt_ext_editor: ckeditor_abbreviation, ckeditor_details, footnotes, toc_api, toc_filter, wxt_ext_media_image_responsive

Proposed resolution

Add an update hook to install these modules.

Remaining tasks

Implement.

User interface changes

None.

API changes

None.

Data model changes

None.

Issue fork wxt-3554857

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

liam morland created an issue. See original summary.

web247’s picture

Assigned: Unassigned » web247
web247’s picture

StatusFileSize
new976 bytes

I added a small patch that implements an update hook to install the dependencies, please review.

web247’s picture

Assigned: web247 » Unassigned
Status: Active » Needs review
smulvih2’s picture

Status: Needs review » Needs work

@web247 this should be an install hook for the wxt_ext_editor module, then you can remove the check for the wxt_ext_editor module. Also not sure if we should check if the individual modules are already installed or not before trying to install them, please let me know after testing this. Thanks!

web247’s picture

Thanks @smulvih2 , I addressed your feedback and created another patch for that, tested and I verified that the modules were installed. Kindly review.

web247’s picture

Status: Needs work » Needs review

liam morland’s picture

I made a merge request with the patches in #3 and #6.

smulvih2’s picture

Status: Needs review » Needs work

I don't think we need this logic in a hook_install() since the .info file will take care of that when installing the module. I think the issue is only when upgrading and wxt_ext_editor is already enabled, so this should be done in a hook_update() in wxt_ext_editor. Since jquery_ui_resizable is a dependency of wxt itself, this one module could be installed via a hook_update() in the wxt_core module. This way if a site is not using wxt_ext_editor, only the one module will be installed.

Also, the two arrays and switch statement could probably be replaced with something like this (not tested):

$modules = [
  'ckeditor_abbreviation',
  'ckeditor_details',
  'footnotes',
  'toc_api',
  'toc_filter',
  'wxt_ext_media_image_responsive',
];

// Only install what's missing.
$missing = array_values(array_filter($modules, fn($m) => !$module_handler->moduleExists($m)));
if ($missing) {
  $module_installer->install($missing);
}
web247’s picture

StatusFileSize
new1.9 KB

I added a new patch which addresses the last suggestions above (couldn't push the changes to the MR for some reason), tested it as well on a WxT 6.1.4 instance.

web247’s picture

Status: Needs work » Needs review
liam morland’s picture

@web247 did you click on "Get push access"? You will need to do that before you can push.

web247’s picture

I did and I still have the same error:

git push wxt-3554857 3554857-enable-modules-that
remote: 
remote: ========================================================================
remote: 
remote: You are not allowed to push code to this project.
remote: 
remote: ========================================================================
remote: 
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I'll submit patches for now (sorry).

smulvih2’s picture

@web247 thanks for updating the patch, changes look good! Will merge this in for the next 6.1.x release.

smulvih2’s picture

StatusFileSize
new1.9 KB

Small fix to patch #11, changed $module_handler->moduleExists($m) with $moduleHandler->moduleExists($m) to prevent error on drush updb.

smulvih2’s picture

Status: Needs review » Fixed

This has been merged with 6.1.x and will be available in 6.1.5.

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.