You are here

function asset_delete in Asset 5.2

Delete an asset.

Related topics

1 call to asset_delete()
asset_delete_confirm_submit in ./asset.module
Execute asset deletion

File

./asset.module, line 730
Main module.

Code

function asset_delete($aid) {
  $asset = asset_load($aid);
  if (asset_access('delete', $asset)) {
    db_query('DELETE FROM {asset} WHERE aid = %d', $asset->aid);
    db_query('DELETE FROM {asset_node} WHERE aid = %d', $asset->aid);
    db_query('DELETE FROM {asset_role} WHERE aid = %d', $asset->aid);

    // Get the asset-specific bits.
    asset_type_invoke($asset, 'delete');

    // Clear the cache so an anonymous poster can see the asset being deleted.
    cache_clear_all();
    drupal_set_message(t('%title has been deleted.', array(
      '%title' => $asset->title,
    )));
    watchdog('asset', t('@type: deleted %title.', array(
      '@type' => t($asset->type),
      '%title' => $asset->title,
    )));
  }
}