[development] node_delete on module specific node

Henrique Recidive recidive at gmail.com
Wed Apr 29 03:40:53 UTC 2009


2009/4/29 Chris Johnson <cxjohnson at gmail.com>:
> Perhaps warning the user that they have N nodes of the content type
> supported by the module which is about to be uninstalled would be one
> idea?

That's exactly what core does when deleting a custom content type:

"Warning:</strong> there are currently @count %type posts on your
site. They may not be able to be displayed or edited correctly, once
you have removed this content type."

So I guess modules doing the same thing on uninstall is a good practice.

Henrique

>
> ..chris
>
> On Tue, Apr 28, 2009 at 9:44 PM, Matt <matt at aleph-null.tv> wrote:
>> We're not talking about *disabled* modules. We're talking about
>> *uninstalled* modules.
>>
>>>> So which kind of broken do we want?
>>>
>>> Neither.
>>>
>>> If you are really using Drupal's APIs properly, the amount of breakage is
>>> rather small.
>>
>> That's not "neither" -- if there is still breakage, it is (by
>> definition) broken.
>>
>> Quiz, like many other modules, has tight integration with views and
>> other modules. Once I start deleting things upon uninstallation, I
>> have all kinds of new issues to worry about. What do I do about that
>> view of quiz nodes? Do I start scanning the Views and attempting to
>> alter or delete those? (Earl, don't kill me. That was rhetorical.)
>>
>> There are many issues closely wrapped up here, but again, we're
>> talking about what should be deleted when the module is uninstalled
>> (Uninstalled -- not disabled. I'd be an idiot to delete content when a
>> module was merely disabled.)
>>
>> Matt
>>
>> On Tue, Apr 28, 2009 at 9:35 PM, Michael Prasuhn <mike at mikeyp.net> wrote:
>>>
>>> On Apr 28, 2009, at 7:07 PM, Matt wrote:
>>>>
>>>> I'm imagining irate users who try re-installing the module only to
>>>> discover that they have lost hundreds of quiz question nodes. On the
>>>> other hand, uninstalling the schema (which, for quiz, includes tables
>>>> for fields that augment the standard node fields) will cripple the
>>>> nodes anyway. If that is going to cause irritation, then we might as
>>>> well just delete the entire node.
>>>
>>> [snip]
>>>
>>>> And then, again, we have the case where we leave the nodes, but remove
>>>> the module-specific data that is stored in the module-specific tables.
>>>> That, too, leaves Drupal broken.
>>>>
>>>> So which kind of broken do we want?
>>>
>>> Neither.
>>>
>>> If you are really using Drupal's APIs properly, the amount of breakage is
>>> rather small.
>>>
>>> Here's a poll node I made:
>>> http://img.skitch.com/20090429-c13tjq8uijniq4twrxrxxxkdxd.png
>>>
>>> Here's the same poll node after turning off the poll module:
>>> http://img.skitch.com/20090429-kpkhegfackipiqbdjas26hqcud.png
>>>
>>> Not too bad. The only error I could find was from attempting to edit the
>>> poll.
>>>
>>> If you are disabling modules on your site and not smart enough to go and
>>> delete or unpublish the content created, I don't know if that's something we
>>> should watch for. It's not inconceivable that a user could disable or
>>> un-install a module unintentionally, so I think core has already adopted the
>>> best approach here.
>>>
>>> -Mike
>>>
>>> __________________
>>> Michael Prasuhn
>>> mike at mikeyp.net
>>> http://mikeyp.net
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>> --
>> http://technosophos.com
>> http://querypath.org
>>
>


More information about the development mailing list