You are here

function patterns_io_remove_pattern_from_fs in Patterns 7.2

Same name and namespace in other branches
  1. 7 includes/io/io.inc \patterns_io_remove_pattern_from_fs()
2 calls to patterns_io_remove_pattern_from_fs()
patterns_io_remove_pattern in includes/io/io.inc
Removes a pattern both from the file system and the database.
_patterns_io_save_pattern in includes/io/io.inc
Lower level primitive for patterns_io_save_pattern. Includes an optional argument to force the UUUID

File

includes/io/io.inc, line 532
Functions related to input/output operations.

Code

function patterns_io_remove_pattern_from_fs($path, $verbose = TRUE) {

  // Check permissions
  if (!is_writable($path)) {
    if ($verbose) {
      drupal_set_message(t('Do not have permission to delete file %pattern. Aborting.', array(
        '%pattern' => $path,
      )), 'error');
    }
    return FALSE;
  }

  // Delete from FS
  $result = unlink($path);
  if (!$result) {
    if ($verbose) {
      drupal_set_message(t('An error occurred while deleting  %pattern.', array(
        '%pattern' => $path,
      )), 'error');
    }
    return FALSE;
  }
  return TRUE;
}