Hello,
I'm a new bie, I've observed that when i enable forum/poll module and create a forum( and then a topic)/poll and then disable the forum/poll module. The nodes which are related to those modules are not being disabled automatically. This is creating problems when those nodes of the types are displayed and we try to edit them. One such problem occurs when we edit the node type the appropriate form is not being displayed, rather a error message is being displayed saying "there is no forum_node_form() function".
Please check this bug and if possible do delete the node types corressponding to the modules that are being disabled.
Comment | File | Size | Author |
---|---|---|---|
#75 | 400450-75-screenshot-before.png | 90.65 KB | cossovich |
#75 | 400450-75-screenshot-after.png | 43.12 KB | cossovich |
#75 | 400450-75-tests.patch | 1.13 KB | cossovich |
#75 | 400450-75-node.patch | 2.24 KB | cossovich |
#71 | 400450-69-node-71.patch | 2.24 KB | mjonesdinero |
Comments
Comment #1
VM CreditAttribution: VM commentednodes aren't deleted when a module is disabled. The data is only deleted when you use the uninstall tab at the top of administer -> modules.
This is done on purpose and is not a bug as far as I can tell, as there are times when disabling a module is necessary, ie. upgrades and you wouldn't want sites to lose their data. If you don't want the data there any longer you must uninstall the module not simply disable it.
Comment #2
sai571 CreditAttribution: sai571 commentedHello again,
I've checked forum.install file for hook_unistall implementation for the forum module.
You can see that forum module drops only the "FORUM" table, but it doesn't delete the rows it had created in "NODE" table, which may be displayed even after the forum is disabled and unintsalled (say through search).
Comment #3
sai571 CreditAttribution: sai571 commentedComment #4
Dave ReidNeeds to be fixed in 7 (CVS HEAD) first, then backport if necessary.
Comment #5
karschsp CreditAttribution: karschsp commentedtagging for the novice queue. shouldn't be too hard to add something to forum.install to clean up nodes of type 'forum'
Comment #6
Dave ReidThing is, we do not delete existing content. If you disable the blog module, your blog content still shows up. Forum should work the same. Maybe our expectations should change? The first thing that needs to happen is get rid of the nasty error at node/x/edit of a node of a disabled content type.
Comment #7
karschsp CreditAttribution: karschsp commentedsorry, misread the thread. Hmmm...I guess the question is, what's the expected behavior? Should you be able to edit content that's of a type that's no longer enabled? Should it catch the fact that forum no longer is enabled and present a friendlier message like:
"This node was created using xyz module, which is no longer available. Please visit the modules section to enable xyz."
Would that work? Is that even feasible?
Comment #8
Dave ReidI've been playing around with this a little bit. We basically have two options:
A. The text at admin/build/modules/uninstall says: "The uninstall process removes all data related to a module." That already includes the content types, but we should also make sure all content associated with that type is also removed. This might lead to unwanted data loss scenarios: user didn't realize that the blog entry content type was related to the blog.module. Poof! All blog content gone!
B. Add a condition to node_page_edit() that checks if the form ID type_node_form doesn't exist. Intercept, throw up a drupal_set_message, and stop the form from being rendered.
Option B seems the most logical, so I created a quick patch to see how it would look compared to the current error message.
Heh...my Amazon search for "Night Watch" from chx's tweet has been saved for all. :)
Comment #9
sai571 CreditAttribution: sai571 commentedThank you for your support.
Yes Option B, as stated by Dave Reid would be more graceful and less lossy when the module is only disabled. But when the module is "Uninstalled" all the data that's related to the module should be deleted ( i mean the nodes corressponding to the module in the 'node' table).
Why can't we fix it in drupal 6.x rather than going for drupal 7.x??
Comment #10
ainigma32 CreditAttribution: ainigma32 commentedThat's because this is a new feature and new features are always implemented in HEAD (i.e. 7.x) and then back ported to earlier versions.
Changing the category to feature request to reflect that.
- Arie
Comment #11
mr.baileysQuick review:
return drupal_get_page($page);
innode_page_edit
in a place where$page
might be undefined (if the if access-branch is not used).Comment #12
catchI don't think we should delete nodes when we uninstall the forum module - nodes belong to the node module, only their type and some metadata belongs to the forum module.
Screenshot looks good, no patch review brain left tonight so just subscribing for now.
Comment #13
cburschkaFor a more readable logical structure, I would suggest reversing the condition so the normal case comes first, and the exception case comes second. First check if the type exists, then if it does return the form - and otherwise return the error page.
---
This fixes the undefined function error on the edit page - but nodes can still be displayed. Should we leave it at this, or hide these orphaned nodes from view completely?
Comment #14
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedHere's a patch with Arancaytar's suggestion of reversing the condition.
I think that nodes that are created should remain. Nodes belong to the Node module, as catch says.
Comment #15
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedbot?
Comment #16
catchI think we should reverse the sentence structure to say that the content can't be edited first, then explain why and how to fix it. Having said that, I tried to rewrite it and it's a bit tricky - got this far:
This content cannot be edited because the content type @type has been disabled or removed.
Comment #17
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedYeah, I like catch's wording better. Here's a patch.
Comment #19
Bojhan CreditAttribution: Bojhan commentedReally Mr.Bot?
Comment #21
Bojhan CreditAttribution: Bojhan commentedStupid bot, it is giving me green! I do not get this.
Comment #22
andypostSome bots was broken
Comment #23
arianek CreditAttribution: arianek commentedpatch applied cleanly. reuploading for test bot - this is a nice looking fix, though i can't really critique the code itself.
Comment #24
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedThis patch applies okay to the latest Drupal 7, but it produces a WSOD when going to the edit screen. I'm going to work on this today.
It would be really nice if it were possible to, if the content type is deleted, allow the user to migrate the node to another content type that still exists. Not sure what's involved with that, though.
Comment #25
Bojhan CreditAttribution: Bojhan commentedA lot, a lot is involved with that.
Comment #26
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedOkay, this one should work.
I'll ignore the content type migration for the time being.
Comment #28
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedBad bot?
Comment #29
joshmillerWhat if we set all forum nodes after uninstallation to "unpublished" ?
Comment #30
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedThe nodes (in general) do function fine as is, even without a defined content type. It's just when you try to edit them that the confusing error message appears. This patch is just supposed to make it a little more friendly.
Comment #32
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedWhat's up, bot? Let's try it again.
Comment #34
Shawn DeArmond CreditAttribution: Shawn DeArmond commentedOkay, here's a re-rolled patch, but it's still not perfect. An error message appears when the node is displayed in teaser mode on the home page.
Here's what it says:
Comment #35
bleen CreditAttribution: bleen commentedI'm not seeing the error message that Shawn mentioned in #34 ... perhaps that error has been fixed somewhere else in the last few months. Anywho, this patch is very similar to #34 but it also includes tests...
Comment #36
markdorisonLogic looks good. Test passed successfully.
Comment #37
markdorisonComment #38
bleen CreditAttribution: bleen commentedooops ... forgot an assertion message for the test. No functional differences between this patch and #35 though
Comment #39
rurri CreditAttribution: rurri commentedI tested both this code change, and the testing script.
I was able to duplicate this issue before applying patch.
After applying test-script patch, testing also failed.
After applying fix patch, the error message now displays, and the test-script runs with a pass.
Comment #40
michaelfavia CreditAttribution: michaelfavia commentedRelated but not duplicate issue regarding comments: #775878: Comment form body field disappears when content type deleted.
Comment #41
michaelfavia CreditAttribution: michaelfavia commentedI think i set a new drupal time record for a cross post! 46minutes! Drupalcon inet was so bad i just posted when i got back. Sorry about that.
Comment #42
David_Rothstein CreditAttribution: David_Rothstein commentedHm, I guess a Drupal error message is better than a PHP error message, but it's still not amazing :)
Seems like this patch should go in, but also see #232327: Deleting node type leaves orphan nodes for discussion of the underlying problem.
Comment #43
klausiThis solution is ugly and not really satisfying, but better than nothing. Patch still applies.
Comment #44
mikeytown2 CreditAttribution: mikeytown2 commentedPatch at #38 makes sense. +1 from me.
The "ideal way" would probably require a default node handler so the old data can be displayed & a new permission for viewing "deleted node types". Most likely a new issue.
Comment #45
tizzo CreditAttribution: tizzo commentedA few patches related to this have just been added on the related issue #232327: Deleting node type leaves orphan nodes
Comment #46
sumitk CreditAttribution: sumitk commentedhttp://drupal.org/node/232327#comment-3357070 is fixing most of it by showing an error message on node/%/edit and node/%/revisions pages.
What about node view page? I am having issues with #890092: Comment form appering only with a title field if content type of that node is deleted comment form see this
Comment #47
sun1) We usually call this variable $build, not $page.
2) It doesn't look like we need a variable (name) at all here. Just return an empty string (or array).
1) Stray leading space.
2) The link text should actually be part of the message to provide sufficient context for translators.
Exceeds 80 chars.
If I'm not mistaken, you don't need to login $this->admin_user to create the content type.
Could use {$node->nid} for safety.
Powered by Dreditor.
Comment #48
Aham CreditAttribution: Aham commentedRewrote patch based on the suggestions made by sun. Let me know if this works. My first contribution to Drupal Core! Yay!
Comment #49
sunComment #50
philosurfer CreditAttribution: philosurfer commentedFirst off patch #48 works :-) it solved the problem of providing a graceful error when editing a node.
But, during a community and contribute meetup between LA Drupal and OC Drupal user groups last evening we had a couple questions/suggestions for this patch.
We would love to hear the communities input on these items before we break ground on any patch work.
Comment #51
xjmThanks for your work on the patch! This seems like it would be a good change.
In addition to the feedback in #50, this patch would need to go into 8.x first. (Whether or not it could be backported to 7.x is a topic for discussion; see http://drupal.org/node/767608 and http://groups.drupal.org/node/211298). Edit: That also means changing the test to use something other than poll. :)
Also, two minor points about the code style:
Trailing whitespace here.
This comment wraps a bit too early; we should go as close to 80 chars as possible without going over.
Regarding #50 -- great feedback! #1 and #2 would depend on #89181: Use queue API for node and comment, user, node multiple deletes, so we'd probably want to open a separate followup issue for that. #3 might be a good idea as well; in both the case of that and the original patch here, it'd be helpful to have before/after screenshots for a usability review.
Comment #52
andypostunused variable, suppose a message could be displayd in $build to be customizable with contrib
Comment #53
cosmicdreams CreditAttribution: cosmicdreams commentedrerolled, I think I got the fixes called out in #51 and #52, also I nearly removed the
from node_form since it doesn't seem to be used in that function.
Comment #54
cosmicdreams CreditAttribution: cosmicdreams commentedset to review so testbot can check it.
Comment #56
zserno CreditAttribution: zserno commented#53: 400450-53-node.patch queued for re-testing.
Comment #57
andypostSeems good to go
Comment #58
xjmNow this comment is wrapping too late... :)
I'm also a little hesitant about relying on poll for the test, in light of #61285: Remove poll module from core and #1266336: Modernize Poll module, but considering those haven't seen activity in months, I think there's no reason to worry about it for this patch.
Edit: Before/after screenshots would be helpful here, as would a test-only patch exposing the test failure.
Comment #59
xjmcosmicdreams is going to look back at this one later tonight.
Comment #60
xjmOh, I just noticed this. This is not the correct way to translate a link in another string. See: http://drupal.org/node/322774
Comment #61
andypostI still think that better to use content $build to display the message to make it easy to customize this page from contrib
Comment #62
ryan.gibson CreditAttribution: ryan.gibson commentedHere is a straight-up reroll of the patch because node.test moved since this patch was submitted. I'll get to xjm's comments now and make those fixes.
Comment #63
ryan.gibson CreditAttribution: ryan.gibson commentedHere is the patch based on comments from xjm.
Comment #64
ryan.gibson CreditAttribution: ryan.gibson commentedComment #66
mjonesdinero CreditAttribution: mjonesdinero commented#63: 400450-63-node.patch queued for re-testing.
Comment #68
marcingy CreditAttribution: marcingy commentedThis line is missing a ; at the end.
Comment #69
mjonesdinero CreditAttribution: mjonesdinero commentedHi updated what did ryanissamson work on.this is my 2nd contribution in drupal if this will not fail..hopefully
Comment #71
mjonesdinero CreditAttribution: mjonesdinero commentedsorry about the last update i forgot again the format, this also happen on my first contribution in drupal
Comment #72
mjonesdinero CreditAttribution: mjonesdinero commentedComment #73
bleen CreditAttribution: bleen commented@mjonesdinero you shouldn't set an issue to RTBC if you are the one submitting the patch.
Comment #74
mjonesdinero CreditAttribution: mjonesdinero commentedsorry about that bleen18, im new in contributing patch, sorry again about that
Comment #75
cossovich CreditAttribution: cossovich commentedI've taken the patch from #71 and separated out the test to expose the test coverage. Also added screenshots as suggested by @xjm at #58.
Before:
After:
Comment #76
tim.plunkettThis looks good to me!
Comment #77
catchI'm pretty sure we don't allow people to re-enable content types from the content type administration page, they only get disabled when modules providing them are and re-enabled if the module is re-enabled, so the link might not help people at all?
Comment #78
tim.plunkettGood point. Though pointing them nowhere might be just as frustrating.
Comment #79
catchWe could point them to #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed :p
Comment #80
mtiftI agree. From what I can tell, it seems like this issue should be closed and marked as a duplicate of #1199946: Disabled modules are broken beyond repair so the "disable" functionality needs to be removed.
Comment #81
klonosComment #82
olav CreditAttribution: olav commentedClosed (duplicate) as suggested by mtift in #80.
Comment #83
olav CreditAttribution: olav commented