Cleans up after Field API bulk deletion operations.
Field API provides functions for deleting data attached to individual entities as well as deleting entire fields or field storages in a single operation.
When a single entity is deleted, the Entity storage performs the following operations:
Similar operations are performed on deletion of a single entity revision.
When a bundle, field or field storage is deleted, it is not practical to perform those operations immediately on every affected entity in a single page request; there could be thousands or millions of them. Instead, the appropriate field data items, fields, and/or field storages are marked as deleted so that subsequent load or query operations will not return them. Later, a separate process cleans up, or "purges", the marked-as-deleted data by going through the three-step process described above and, finally, removing deleted field storage and field records.
Purging field data is made somewhat tricky by the fact that, while $entity->delete() has a complete entity to pass to the various deletion steps, the Field API purge process only has the field data it has previously stored. It cannot reconstruct complete original entities to pass to the deletion operations. It is even possible that the original entity to which some Field API data was attached has been itself deleted before the field purge operation takes place.
Field API resolves this problem by using stub entities during purge operations, containing only the information from the original entity that Field API knows about: entity type, ID, revision ID, and bundle. It also contains the field data for whichever field is currently being purged.
See Field API for information about the other parts of the Field API.
Name | Location | Description |
---|---|---|
field_purge_batch | core/modules/field/field.purge.inc | Purges a batch of deleted Field API data, field storages, or fields. |
field_purge_field | core/modules/field/field.purge.inc | Purges a field record from the database. |
field_purge_field_storage | core/modules/field/field.purge.inc | Purges a field record from the database. |
hook_field_purge_field | core/modules/field/field.api.php | Acts when a field is being purged. |
hook_field_purge_field_storage | core/modules/field/field.api.php | Acts when a field storage definition is being purged. |
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!modules!field!field.purge.inc/group/field_purge/8.1.x