Problem/Motivation
field_purge_batch() tries to purge fields that have no instances. field_read_instances() does not return instances attached to unknown entity types unless include_inactive
is set in the $include_additional
parameter. If you delete field instances in the disable hook of a module that provides an entity type, those instances will not be automatically purged. However, the fields will be purged automatically. Every time you uninstall the module, it will leave instances that have no corresponding fields in the field_config_instances
table. These orphaned instances can only be deleted manually.
Proposed resolution
Pass include_inactive
in the $include_additional
parameter before attempting to purge fields.
Remaining tasks
- Review patch.
- Commit patch.
Comment | File | Size | Author |
---|---|---|---|
#9 | drupal-field_purge_batch-2337139-8.patch | 1.17 KB | Darren Oh |
Comments
Comment #1
Darren OhComment #2
Darren OhComment #3
Darren OhComment #5
Darren OhFixed typo.
Comment #6
Darren OhComment #7
Darren OhChanged wrong line.
Comment #9
Darren OhComment #10
Darren OhComment #11
Taran2LDuplicate of #1340390: "Deleted" but "inactive" fields and instances cannot be removed during cron cleanup (e.g. for uninstalled entities).
Comment #12
Darren OhThis is not a duplicate. The other patch would still allow fields with inactive instances to be deleted before the instances have been deleted.
Comment #13
mcdruidAren't the patches effectively exactly the same?
Comment #14
Darren OhNo, this patch fixes field deletion and the other patch fixes instance deletion.