Go to admin/structure/types.

Edit any content type, and change its machine name.

Upon returning to admin/structure/types, the machine name appears not to have changed. Attempting to view any node of that type is likely to product error messages and a corrupted page.

Manually clearing all caches solves the problem. This should be done automatically and programmatically.

node_type_save() at http://api.drupal.org/api/drupal/modules!node!node.module/function/node_... does contain a call to node_type_cache_reset(). Either that function is broken or something else also needs to be reset.

function node_type_cache_reset() {
  cache_clear_all('node_types:', 'cache', TRUE);
  drupal_static_reset('_node_types_build');
}

Comments

GiorgosK’s picture

Title: Changing node content type machine name fails until manual cache reset » editing content types fails sometimes even after manual cache reset
Component: node system » field system

Similar problems with 7.16 but worse

changing/editing fields on the content types (even taxonomy fields) does not seem to take effect on the next page view, one needs clearing cache to see changes

also the severe problem is fields remain in database even after deletion

try this
create new field field_testtttt lets say of type text
then erase field_testtttt (after clear cache appears to be deleted)
try to create new field field_testtttt its not allowed because the field_test is still in the database

upon inspection of the database and search I find field_testtttt mentioned in
table cache, cache_field, cache_views, field_config
and the following two tables
field_data_field_testtttt
field_revision_field_testtttt

is this normal ? not deleting the database tables of the field ?

the clearing of the cache is definetelly a bug
and it happens with 7.15 7.16 and 7.16 current dev
from clean standard install

GiorgosK’s picture

Title: editing content types fails sometimes even after manual cache reset » Changing node content type machine name fails until manual cache reset
Component: field system » node system

after a long debugging process
I just realized that its the fault of php version
thus from mysql5.1.30 & php 5.2.8
I went to mysql 5.1.65-cll & php 5.3.18
and fields are edited/deleted correctly

thus reverting to old title (this I think its a support request because I could actually rename content type)

and opening a new bug report issue for what I found #1833458: editing/deleting content types fields fails with php 5.2.8 (core incomatible with php 5.2.8)

GiorgosK’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

@Danz
I think this is a support request or another module has crippled your installation

please try to reproduce the problem with clean standard install (I actually could not reproduce)

Dan Z’s picture

I'll try to reproduce. My site has definitely had module issues. They shouldn't factor into this matter, but it's worth a look.

Dan Z’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Closed (duplicate)

I tested this and I could only reproduce it on a module-created node type. When I created a node type myself, updating it worked just fine.

I eventually tracked it down to a subtle problem in Ubercart: #1833812: uc_product_node_info() doesn't track changes to {node_type} table. Its implementation of hook_node_info() stashes its return information in a static variable. Apparently, there are multiple calls to the implementation. If a node type changes between calls, it doesn't notice.

However, don't PHP static function variables get cleared over multiple page views? If so, this doesn't really explain why the form doesn't get updated without a full cache clear.

Anyway, it's weird, but putting the change into Ubercart solved the problem, so I'll close this as a duplicate of the module issue. Anyone who wants to investigate the weird cache issue can reopen.