Read my hosting service review
Dreamhost
Drupal Ace presides over his domain, proudly ensconced in his Dreamhost eyrie. Won't you join me?
Promo code deals!
Just enter a code when you register for an account. Take your pick:
DA87: Up to $87 off of your account! No strings!
BIGAPPETITE: Get +50% storage and bandwidth, free!
Pair.com
The high-reliabilty host. Save money with monthy specials!
Re: How to change a node's type?
I just had a first look at this module. It seems that its only task is to change the type. And because the module is doing that not directly by modifying the database but using ordinary drupal functions the cache will be updated probably.
As far as I can see the module (implicitly) does:
update node set type='NEWTYPE' where nid=NODEID;
(where NEWTYPE is one of the values in table node_type column type: select type from node_type; )
And the node should also be moved from table content_type_ to content_type_
Now some thoughts about what can be done to extend the nodetype module
When you have an node (NID) of type 'image', there is always one image attached to it.
Name and path of this image is stored in table 'files'. When you have versioning activated (VID) a query to pick up the image will look like:
select f.fid, n.nid, filename, filepath from node n, file_revisions r, files f where n.vid=r.vid and r.fid=f.fid and n.nid=NID;
You can see that the image module has created several additional derivative images with names (column filename) as
thumbnail
preview
If you want to change the node type from 'image' to 'story' all the derivative images (all filenames but '_original') can be purged.
The '_original' image can be attached to the story if there is e.g. a CCK field of type image. To check this try
select type_name, widget_type from node_field_instance where type_name='story' and widget_type='image';
Column type_name will show (all) CCK field name of type 'image' attached to node of type 'story'. It looks like
'field_attach_image'
where attach_image is the name for the field used when the CCK field was set up.
Prepending this type_name with 'content_' yields to
'content_field_attach_image'
which is the name of the table to put the image in:
insert into content_field_attach_image values (VID, delta?, NID, FID, '', '');
I hope this helps somebody
Regards
Schildi