Problem/Motivation

I have tested Slick together with the extensions Slick Views and Slick Extras under Drupal 9.3.2 and now I want to uninstall it. All sub modules except Slick itself can be uninstalled correctly via the Drupal web interface, only Slick itself cannot.

Steps to reproduce

When I try to uninstall Slick, I get the following error message:
Drupal\Component\Plugin\Exception\PluginNotFoundException: The "slick_filter" plugin does not exist. Valid plugin IDs for Drupal\filter\FilterPluginManager are: blazy_filter, editor_file_reference, filter_align, filter_autop, filter_caption, filter_html, filter_htmlcorrector, filter_html_escape, filter_html_image_secure, filter_null, filter_url, media_embed in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of core\lib\Drupal\Component\Plugin\Discovery\DiscoveryTrait.php).
Drupal\Core\Plugin\DefaultPluginManager->getDefinition('slick_filter') (Line: 70)
Drupal\filter\FilterPluginCollection->initializePlugin('slick_filter') (Line: 80)
Drupal\Component\Plugin\LazyPluginCollection->get('slick_filter') (Line: 26)
Drupal\filter\FilterPluginCollection->get('slick_filter') (Line: 92)
Drupal\filter\FilterPluginCollection->sortHelper('blazy_filter', 'slick_filter')
uasort(Array, Array) (Line: 90)
Drupal\Core\Plugin\DefaultLazyPluginCollection->sort() (Line: 84)
Drupal\filter\FilterPluginCollection->sort() (Line: 144)
Drupal\filter\Entity\FilterFormat->filters() (Line: 58)
Drupal\filter\FilterUninstallValidator->validate('blazy') (Line: 633)
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array) (Line: 99)
Drupal\Core\ProxyClass\Extension\ModuleInstaller->validateUninstall(Array) (Line: 148)
Drupal\system\Form\ModulesUninstallForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 531)
Drupal\Core\Form\FormBuilder->retrieveForm('system_modules_uninstall', Object) (Line: 278)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 73)
Drupal\Core\Controller\FormController->getContentResult(Object, Object)
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

When uninstalling using drush pmu slick, you do not get any error message but the website is corrupted as well. You cannot perform any uninstallations using Drupal web interface after that. The above error message always appears.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

uwe_mue created an issue. See original summary.

gausarts’s picture

Category: Bug report » Support request
Status: Active » Fixed
Issue tags: -fatal error

Similar to Slick Views uninstallation issues if you have hidden Master display still keep Slick references.

Check out other issues here in case you have it as well.

Solutions in your case:

  1. Re-install Slick via drush.
  2. Visit your Filter settings
  3. Disable Slick Filter at any filters. Save.
  4. Uninstall Slick.

Since it is configurable and solved easily via UI, it is not a bug.

I had similar hard time with Markdown, and the above fixed it.

It is indeed annoying, unless someone steps in to offer better solutions, please accept the limitations :)

uwe_mue’s picture

Sorry, which filters do you mean? There is no view that uses a slick format, nor is there any active slick filter in the Text Formats and Editors area. There are also no detectable references to slick in the Content Types or Media Types area.
Where else can I look?

gausarts’s picture

Hmm, likely gone from UI but not exported files

Are you sure you never enabled Slick Filter? Verify this correctly.

Nevertheless, try:
grep slick_filter at your config export.
Or re-export.

Be sure to drush cr 3 times if stubborn :)

gausarts’s picture

> There is no view that uses a slick format, nor is there any active slick filter in the Text Formats and Editors area. There are also no detectable references to slick in the Content Types or Media Types area.
So you can access the site again, assumed you re-installed as suggested. But forgot on which text format you ever enabled Slick.

Then try re-saving each text formats, and ensure Slick Filter is disabled. If not, the database still keeps it.

Once done, uninstall it for good.

Let me know.

uwe_mue’s picture

Thanks for the hints. That I had to reactivate Slick by means of drush en slick was already clear. Otherwise I would not have been able to perform the further tests. I had also done drush cr and recalling and saving all text formats several times. I have now additionally deleted the view cache under admin/structure/views/settings/advanced, then executed drush cr several times and then drush pmu slick. Now it worked.

uwe_mue’s picture

Rejoiced too soon. Unfortunately, not a single text editor works now. Neither the Ck editor nor plain text. Exactly the same error message appears as above. I then restored a data backup to have the initial situation again. But also the attempt to activate the slick filters for all editor filters, to save, then to remove all slick filters, to save again, then to uninstall slick with drush pmu slick lead again and again to the same result as described above.

gausarts’s picture

Hm, works then not works.

I said this anywhere, I have to repeat it for just in case helpful in your case as well:

When CLI fails, try the good old browsers.

Be sure to follow my comments above including reexport if you did, and re-save.

If still stubborn something still holds it. If you can't find it at codebase with grep alike, it is likely in database.

Also be sure to remove it from composer.lock in case it is there. And put it manually till resolved.

As the last resort till anyone have time to step in to help, simply keep it installed, and don't do anything else. It won't bite you if you don't touch it anywhere :)

Let me know.

gausarts’s picture

> When CLI fails, try the good old browsers.
Uninstall via Drupal UI for now.

Status: Fixed » Closed (fixed)

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

crutch’s picture

One item I found is that "Slick media" option remains in Page Manager/Panels, even when "Slick media" format is deleted and a replacement is chosen.

wrd-oaitsd’s picture

I've run into this problem as well, on a whole bunch of sites where I've been replacing Slick with Splide. I've tried many things, including:

  • Uninstalling via drush
  • Uninstalling using the web UI
  • Exporting my text formats, deleting the "slick" dependency and the "slick_filter" settings, and reimporting them again
  • Multiple cache clears, both using Drush and using the web UI

Importing a format while Slick is installed doesn't seem to have an effect; the next time I try to export it, it shows the dependency again. Importing it with Slick uninstalled fails with an error indicating that another format depends on Slick but that it isn't installed. Clearing cache three times between each step has no effect.

The filter is not enabled in either text format:

  slick_filter:
    id: slick_filter
    provider: slick
    status: false
    weight: 4
    settings:
      optionset: default
      media_switch: ''

Example of an attempt to disable the module:

  1. Check both text formats to make sure Slick filter is disabled.
  2. Export both formats.
  3. Delete slick from the dependency list of both formats.
  4. Delete slick_filter settings array from both formats.
  5. Import both formats (this works, because Slick module is still enabled).
  6. drush cache:rebuild x3.
  7. Uninstall Slick using web UI -- error occurs, with log message described in OP. However, Slick module is uninstalled.
  8. drush cache:rebuild x3.
  9. Error continues to occur in various situations, such as revisiting the "Uninstall module" form.
  10. Export formats again -- slick dependency and its filter settings are once again listed in the config.
  11. Delete dependency and filter settings again.
  12. Attempt to import "basic" format -- error thrown indicating that "advanced" format depends on Slick module, which will not be installed.
gausarts’s picture

Before I released modules, the first things I did normally, not always, were (un)-install cycles, 20x+ at different phases to ensure I was not locked in.

Honestly, since released, never re-checked.

This made me think additional or late features like Slick Filter, etc., remember they were added years after releases, obviously got away from initial screening.

Noted, thanks:
Slick Filter
Page manager

I will see if I can find references for their hook_uninstall. I did try searching samples at the entire Drupal codebase via grep last time, no joy, yet.

As I said above, I had the same issues with Markdown, and succeeded via UI with the details mentioned above. But I understand, it might be another case with Slick.

Patches are welcome if anyone beat me to it.

Sorry for inconveniences.

Thanks.

crutch’s picture

StatusFileSize
new74.24 KB
new54.82 KB

Thanks for quick responses. Still working on this :)

I export full archive at /admin/config/development/configuration/full/export

Searched all for Slick.

First, was that I removed Slick from all filter formats, example: filter.format.MY_FORMAT.yml

------
dependencies:
module:
- blazy
- slick

...

slick_filter:
id: slick_filter
provider: slick
status: false
weight: 4
settings:
optionset: default
media_switch: ''

------

Then, Import/Single Item/Text Format, for each format. End up with this during uninstall. Where as before the text formats where listed above.

Slick uninstall 1

Backup data
Attempt uninstall, flush cache, visit any page = website encountered error
Restore

Then, remove image style and view mode so end up with this during uninstall

Slick uninstall 2

slick.optionset.default.yml and slick.settings.yml still exist

Backup data
Attempt uninstall, flush cache, visit any page = website encountered error
Restore

gausarts’s picture

Category: Support request » Bug report
Status: Closed (fixed) » Active

I just had a chance to uninstall a Slick. And indeed the new Slick Filter is the culprit.

Till we provide a patch, you can copy below code into any theme function like preprocess_page, etc. for immediate remedy.
Reload page. Wait till finish. And delete the lines:

  // @todo use blazy_filter_cleanup('slick'); at Blazy 3+ instead.
  // Or remove when core filter takes care of its own plugins removal.
  $config_factory = \Drupal::configFactory();
  $config_storage = \Drupal::service('config.storage');

  $module = 'slick';
  $filter = "filters.{$module}_filter";

  // Removes unclean slick_filter references, see #3257390.
  foreach ($config_storage->listAll('filter.format') as $config_name) {
    $config = $config_factory->getEditable($config_name);
    $plugin = $config->get($filter);

    if ($plugin) {
      $dependencies = $config->get('dependencies');
      $modules = array_diff($dependencies['module'], [$module]);

      $config
        ->clear($filter)
        ->set('dependencies.module', $modules)
        ->save(TRUE);
    }
  }

  // Just to be safe and sure, reset filter_formats cache, etc.
  if (function_exists('drupal_static_reset')) {
    drupal_static_reset('filter_formats');
  }

  \Drupal::entityTypeManager()->getStorage('filter_format')->resetCache();

  // Clear plugin manager caches.
  \Drupal::getContainer()->get('plugin.cache_clearer')->clearCachedDefinitions();

It appears Blazy has no issues when being uninstalled with its Blazy Filter. Not sure about Splide.

The error pages affected after uninstall:

  • /admin/modules/uninstall
  • /admin/config/content/formats

You can still access the rest of admin and front pages, including Performance (clearing cache) pages.

UPDATED with cleanest version.

gausarts’s picture

Status: Active » Needs review
StatusFileSize
new2.09 KB

Attached should clean out the unclean slick and slick_filter references.

  • gausarts committed aeb97ad on 8.x-2.x
    Issue #3257390 by gausarts, crutch, uwe_mue, wrd-oaitsd: It is not...
gausarts’s picture

Status: Needs review » Fixed

Unlike of core filter.module, Slick is not aware of Page Manager.
IMHO it is not a module business for something it is not aware of in the first place.

Technically, the blocker of uninstallation was removed with this patch, the rest (Page Manager, etc.) should not be blocked anymore.

If however such assumption were proven wrong, feel free to re-open.
Be sure to provide the similar helpful error messages to avoid blind guesses.

We got a new hot fix to release this weekend.
Committed. Thank you all for contribution.

wrd-oaitsd’s picture

I am indeed able to uninstall the module after applying the patch. Thank you!

crutch’s picture

Just able to get back to this today. Thanks for updates! Composer is complaining for me with patch

- Installing drupal/slick (2.5.0): Extracting archive
- Applying patches for drupal/slick
https://www.drupal.org/files/issues/2022-02-11/3257390-clean-uninstall-1... (3257390: It is not possible to uninstall slick)
Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2022-02-11/3257390-clean-uninstall-1...

gausarts’s picture

Hm, not sure about the failing patch, can be many reasons. Most obvious is different code base from the expected patch.

Comment at #19 said OK.

Try requiring DEV, or revert to the previous branches, including Blazy, till the next hot fix release.

Let me know.

crutch’s picture

Thank you for quick replies :) Since patch is committed to 2.x-dev I used that version and can confirm uninstall now works. Again thank you for your help with this!

Type system
Date Thursday, February 17, 2022 - 09:30
User admin
Location http://localhost/*/web/admin/modules/uninstall/confirm
Referrer http://localhost/*/web/admin/modules/uninstall/confirm
Message slick module uninstalled.
Severity Info
Hostname 127.0.0.1

gausarts’s picture

Ok, no worries, glad you did it :)

Thanks for confirming.
That will surely help convince others on the same boat :)

Status: Fixed » Closed (fixed)

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