On 8/24/06, Peter Wolanin <pwolanin@gmail.com> wrote:
First- a question. What is the use case for this? If I don't like the name of a node type (e.g. 'story'), I can just create an alternative. Trying to account for the possibility that the name of the type has changed (to me) makes the code look rather more convoluted than necessary and seems to introduce the potential for more bugs.
I was the one that pushed for (and developed) the ability to change the machine-readable name of a node type, and I feel very strongly that this feature should remain in core, and that it is a feature worth maintaining, despite it making the node type system somewhat more vulnerable to bugs. There are a number of important use cases for this feature. What happens when a user decides that they don't like the machine-readable name that they picked a few months ago, and that they want to change it? What happens when that user's site already has hundreds of nodes of that type? If the user is forced to delete the old node type and to create a new one, then all the old nodes become corrupted (and there's no way to avoid this, since the system would have no way of knowing that they need to be updated to the new type). Not to mention the fact that from a usability point of view, it is absolutely unacceptable to have to delete and then re-create a node type, simply in order to update the value of one field. You've pointed out the possibility that users may want to update the names of their node types at some point. It therefore follows that we should make this as easy for them as possible, which is what the current system does.
Allowing users to change the node type will potentially create problems- for example with organic groups, where the names of "group" types are saved in a variable and there is no hook to let the module know they have been changed.
For module-defined node types, (a) the default behaviour is to NOT allow the machine-readable name to be changed, and (b) if this behaviour is modified, and the machine-readable name is modifiable, the original name is always still available, because it's stored in the 'orig_type' field of the 'node_type' table. The 'orig_type' thing also applies to user-defined node types. So modules that need a constant, permanent key to reference, can rely on 'orig_type' instead of 'type'. That's what it's there for.
So, I propose that this be removed and alslo that a hook be created to allow modules to act when a node type is deleted.
-1 to this feature being removed, but +1 to creating a hook to allow modules to respond to changes to a node type. I have created an issue for this task: http://drupal.org/node/80257 I have also filed a bug for the 'permission names do not change when node type name changes' issue: http://drupal.org/node/80253
issue posting: http://drupal.org/node/77990
And I have responded to that issue. Cheers, Jaza.