You are here

function _auditfiles_referenced_not_used_batch_display_get_operations in Audit Files 7.3

Same name and namespace in other branches
  1. 7.4 auditfiles.referencednotused.inc \_auditfiles_referenced_not_used_batch_display_get_operations()

Configures the operations for the batch process.

Return value

array The operations to execute.

1 call to _auditfiles_referenced_not_used_batch_display_get_operations()
_auditfiles_referenced_not_used_batch_display_create_batch in ./auditfiles.referencednotused.inc
Prepares the definition for the page display batch.

File

./auditfiles.referencednotused.inc, line 253
Generates report showing files referenced by content, but not in file_usage.

Code

function _auditfiles_referenced_not_used_batch_display_get_operations() {

  // Get and save the field data, so this is only done once for the entire batch
  // process.
  $file_fields = array();

  // Get a list of all fields on the site.
  $fields = field_info_fields();
  foreach ($fields as $field_name => $field) {

    // @todo
    // Consider adding a setting to allow the administrator the ability for
    // spcifying the field types.
    if (!empty($field['type']) && ($field['type'] == 'file' || $field['type'] == 'image')) {

      // Get the database table name for the field.
      $table = key($field['storage']['details']['sql'][FIELD_LOAD_CURRENT]);
      $field['table'] = $table;

      // Get the column name in the database table for the field.
      $column = $field['storage']['details']['sql'][FIELD_LOAD_CURRENT][$table]['fid'];
      $field['column'] = $column;

      // Save the data for use in the operation.
      $file_fields[$field_name] = $field;
    }
  }
  $operations = array();
  $operations[] = array(
    '_auditfiles_referenced_not_used_batch_display_get_files',
    array(
      $file_fields,
    ),
  );
  $operations[] = array(
    '_auditfiles_referenced_not_used_batch_display_process_files',
    array(),
  );
  return $operations;
}