From a virgin D7 install:

  • installing profile2
  • disabling profile2
  • uninstalling profile2 completely
  • re-installing profile2

leads to the following error:

FieldException: Attempt to create an instance of field profile_fullname on bundle main that already has an instance of that field. in field_create_instance() (line 673 of /var/www/drupal-7/modules/field/field.crud.inc).

This is because hook_uninstall doesn't clear up any of the instances created by hook_install, so the re-install tries to create a duplicate instance on the main profile bundle. Obviously this field is a proof of concept at the moment but currently it's hard to comfortably test and re-test profile2 because this error means you can't really trust your own db without completely wiping it in between re-installs.

Please find attached a patch to clean up in hook_uninstall. I think the system still needs to purge somehow after removing the instances. Would appreciate any advice on that (see comment in patch.)

Comments

matt2000’s picture