You are here

function _helper_purge_inactive_deleted_fields in Helper 7

2 calls to _helper_purge_inactive_deleted_fields()
helper_cron in ./helper.module
Implements hook_cron().
helper_modules_uninstalled in ./helper.module
Implements hook_modules_uninstalled().

File

./helper.field.inc, line 38
Field integration for the Helper module.

Code

function _helper_purge_inactive_deleted_fields() {
  $instances = field_read_instances(array(
    'deleted' => 1,
  ), array(
    'include_deleted' => 1,
    'include_inactive' => 1,
  ));
  foreach ($instances as $instance) {
    watchdog('helper', 'Purging inactive and deleted field instance @field_name:@entity_type:@bundle.', array(
      '@field_name' => $instance['field_name'],
      '@entity_type' => $instance['entity_type'],
      '@bundle' => $instance['bundle'],
    ));
    FieldHelper::deleteInstance($instance);
  }
  $fields = field_read_fields(array(
    'deleted' => 1,
  ), array(
    'include_deleted' => 1,
    'include_inactive' => 1,
  ));
  foreach ($fields as $field) {
    watchdog('helper', 'Purging inactive and deleted field @field_name.', array(
      '@field_name' => $field['field_name'],
    ));
    FieldHelper::deleteField($field);
  }
}