next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Unable to uninstall module from Drupal

Open martdavidson opened this issue 3 years ago • 5 comments

When trying to uninstall this module, I'm unable to. The reason given is:

The following reason prevents Next.js from being uninstalled:
Next.js is configured to use a preview url generator plugin provided by this module. [Update settings](http:///admin/config/services/next/settings).

When I visit settings, I am unable to clear the plugin field:

image

There are no entities selected and no sites created. Any advice?

martdavidson avatar Oct 28 '22 14:10 martdavidson

Hmm I think this might be a bug. We added a safety measure to prevent uninstalling a module with an active URL generator. Looks like we need to check if there's only one generator available.

Do you have access to the code?

We can use a temporary workaround to uninstall the module.

  1. Open the file web/modules/contrib/next/src/NextUninstallValidator.php
  2. Find the validate function.
  3. Update it to return `FALSE.
  4. Try uninstalling again.
  /**
   * {@inheritdoc}
   */
  public function validate($module) {
    return FALSE;
  }

shadcn avatar Oct 28 '22 15:10 shadcn

Hey - I ended up not needing to uninstall. I was trying to debug something unrelated by reinstalling a few things. So for my own use case, I'm good to go.

Up to you if you'd like to tackle or close this, I'll leave it open - thanks for the quick response, and really enjoying the plugin so far!

martdavidson avatar Oct 28 '22 16:10 martdavidson

Ran into this today. Will just disable the uninstall validator :)

chrishappy avatar Jun 10 '23 03:06 chrishappy

Ran into this problem as well.

In my case, I changed the next.settings.yml file, deleting the entry for the prview url generator:

langcode: es
site_previewer: iframe
site_previewer_configuration:
  width: 100%
  sync_route: false
  sync_route_skip_routes: ''
  preview_url_generator: simple_oauth <---- REMOVE THIS
preview_url_generator_configuration:
  secret_expiration: 30
debug: false

Then drush cim and uninstall worked. But, of course, this should work without this workaround.

idiazroncero avatar Oct 27 '23 11:10 idiazroncero