You are here

function fe_paths_usage_add in File Entity Paths 7.2

Add or update a fe_paths usage record to the database.

Parameters

null $fid:

$entity_type:

$entity_id:

$id:

1 call to fe_paths_usage_add()
fe_paths_file_process in ./fe_paths.module
Actually pre processes the files. Set a $file->fe_paths_processed flag on the file entity, then add to process queue. The file will be processed on drupal_register_shutdown.

File

./fe_paths.module, line 605
Contains functions for the File Entity Paths module.

Code

function fe_paths_usage_add($fid = NULL, $entity_type, $entity_id, $id) {
  $data = array(
    'fid' => $fid,
    'entity_type' => $entity_type,
    'entity_id' => $entity_id,
    'id' => $id,
  );
  if (!fe_paths_usage($fid)) {
    drupal_write_record('fe_paths_usage', $data);
  }
  else {
    db_update('fe_paths_usage')
      ->fields(array(
      'entity_type' => $entity_type,
      'entity_id' => $entity_id,
      'id' => $id,
    ))
      ->condition('fid', $fid)
      ->execute();
  }
}