You are here

function _textimage_preset_flush in Textimage 6.2

Same name and namespace in other branches
  1. 5.2 textimage_admin.inc \_textimage_preset_flush()
  2. 5 textimage.module \_textimage_preset_flush()
  3. 7.2 textimage.admin.inc \_textimage_preset_flush()

flush cached media for a preset.

Parameters

pid: a preset id.

4 calls to _textimage_preset_flush()
textimage_preset_edit_submit in ./textimage_admin.inc
textimage_preset_flush_confirm_submit in ./textimage_admin.inc
_textimage_preset_delete in ./textimage_admin.inc
_textimage_preset_update in ./textimage_admin.inc
update a preset

File

./textimage_admin.inc, line 692

Code

function _textimage_preset_flush($pid) {
  if ($pid !== 0) {
    drupal_set_message(t('Flushed Preset Images (ID: @pid)', array(
      '@pid' => $pid,
    )));
  }
  $preset = _textimage_preset_load($pid);
  $presetdir = realpath(file_directory_path() . '/textimage/' . $pid);
  if (is_dir($presetdir)) {
    _textimage_recursive_delete($presetdir);
    @unlink($presetdir);
  }
  db_query("DELETE FROM {textimage_image} where pid = %d", $pid);
}