You are here

function media_watermark_uninstall in Media watermark 7

Same name and namespace in other branches
  1. 8 media_watermark.install \media_watermark_uninstall()

Implements hook_uninstall().

File

./media_watermark.install, line 115
Media watermark module install file.

Code

function media_watermark_uninstall() {
  image_style_delete(image_style_load('media_watermark'));

  // Check for files in use by media_watermark.
  $result = db_query("SELECT fid FROM {file_usage} WHERE module = 'media_watermark'");
  foreach ($result as $record) {
    $file = file_load($record->fid);
    if ($file) {

      // Remove all usage for this file by my_module_name.
      file_usage_delete($file, 'media_watermark', NULL, NULL, 0);

      // Should only delete if file not in use by another module.
      file_delete($file);
    }
  }
}