Problem/Motivation
When the Forum module enabled, and the forum vocabulary deleted, and I visit the Uninstall page under Extend, Drupal crashes.
Steps to reproduce
Steps to reproduce:
- Enable forum module
- Remove forums vocabulary (admin/structure/taxonomy/manage/forums/delete)
- Visit module uninstall page (admin/modules/uninstall)
Logged error:
Recoverable fatal error: Argument 1 passed to Drupal\forum\ForumUninstallValidator::hasTermsForVocabulary() must implement interface Drupal\taxonomy\VocabularyInterface, null given, called in /Webserver/drupal-8.1.5/core/modules/forum/src/ForumUninstallValidator.php on line 72 and defined in /Webserver/drupal-8.1.5/core/modules/forum/src/ForumUninstallValidator.php on line 114
Proposed resolution
The error points to line 72 in ForumUninstallValidator.php, so that would be the starting point for resolving the issue.
Remaining tasks
Write a test
Patch
Review
Commit
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
cilefen commentedComment #3
joebotTo reproduce, install the core forum module and then load admin/modules/uninstall.
Comment #4
joebotComment #5
alonaoneill commentedComment #6
shreyal999 commentedVerified with 8.7, this looks working correctly. Issue not replicated.
Comment #7
yogeshmpawarSetting back to Needs Review & Triggering bots.
Comment #8
borisson_This probably needs tests?
Comment #9
johnwebdev commentedThe issue targets and old version (no longer supported) and I cannot reproduce on 8.7.5. If this issue still exists; please update with steps to reproduce for a supported version of Drupal.
I'm thinking Closed (outdated)?
Comment #10
rensingh99 commentedI have tested this issue with 8.9x and I have not got the problem. When I visit the uninstall page.
Comment #11
chi commentedAdded steps to reproduce.
Comment #12
chi commentedComment #13
rensingh99 commentedHi,
There is no option to delete the forum vocabulary in admin UI. Since it's dependent on the forum module.
You can delete this vocabulary when you will directly enter the URL "admin/structure/taxonomy/manage/forums/delete" in the address bar.
Then you will get the above error after deleting vocabulary on the uninstall page.
There are no default options to delete that vocabulary due to dependency in the forum module.
The patch is working great. I didn't get the error on the uninstall page if forum vocabulary is deleted.
But I am not sure that we should delete the vocabulary in this way.
Thanks,
Ren
Comment #14
chi commentedIf user removes the vocabulary the forum functionality will be broken in many ways. I think a patch should prevent removal of forum vocabulary.
Note that vocabulary can also be removed through configuration system (
drush cim,drush cdel, etc).Comment #15
rensingh99 commentedSo, in this case, we should change the title and description of this issue.
Comment #16
ccaajj commentedHi all, I just had this problem in 8.8.4 and this seems like the proper place to recap what happened. If not, apologies! and please tell me where I should go :)
I went to uninstall the Forum module on the Uninstall module page.The checked checkbox in the left column was disabled. In the right column where the module description and other options can be seen by flipping the disclosure triangle, there were two bullet items saying essentially that all forum module content nodes had to be deleted and all forum vocabulary terms had to be deleted before the module could be disabled. So from the Manage Content and Manage Vocabs admin pages respectively, I deleted as asked.
Going back to the Uninstall page to finish the job, I got the error above. The Forum content type is still present and editable, and all the Forum permissions, links and fields all are still present, though /admin/forum gives a 404.
My experience aside, though I hope it will help in troubleshooting, any ideas on how this can be fixed? Drush pmu failed with the same error and composer remove didn't work because Forum is in core. Any advice appreciated!!
Thanks in advance,
-Chris
Comment #17
ccaajj commentedHi again, I did find an answer for how to get the Uninstall page working again, which let me uninstall Forum after all
https://drupal.stackexchange.com/questions/259483/cant-uninstall-drupal-...
Basically, just create a replacement vocab named Forums and that lets the Uninstall page load as per usual.
-C
Comment #19
jmaguniaThe workaround solution in #17 worked for me. It let me uninstall forums. Thanks
Comment #24
quietone commentedI tested this on Drupal 9.5.x and was able to reproduce the problem. Note that the delete option was not available when editing the forum vocabulary. One has to use the admin/structure/taxonomy/manage/forums/delete.
Perhaps this scenario can be added to \Drupal\Tests\forum\Functional\ForumUninstallTest?
Comment #25
quietone commentedI meant to update the IS.
Comment #26
mohit_aghera commentedAdding test cases.
Comment #28
Munavijayalakshmi commentedComment #29
Munavijayalakshmi commentedIn 9.5.x branch #26 patch applied successfully and clear the error after applying patch.
Comment #30
borisson_one tiny nitpick/question
why are we installing dblog? I don't see where we use it further?
Comment #31
mohit_aghera commentedYup, looks like I forgot to remove that. 👍
Updating the patch.
Comment #32
borisson_thanks, back to rtbc
Comment #34
catchI think it's a good idea to add a custom validator to prevent deletion of the forum vocabulary, but since there are sites already in this state, fixing this makes sense too.
Committed/pushed to 10.1.x and cherry-picked back to 9.5.x, thanks!
Comment #36
quietone commentedI've added the follow up, removing tag. #3315045: It is possible to delete the Forum vocabulary while Forum is installed .