You are here

function patterns_io_remove_pattern_from_fs in Patterns 7

Same name and namespace in other branches
  1. 7.2 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
Saves a pattern string or array into the database AND in the file system.

File

includes/io/io.inc, line 497
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;
}