function patterns_io_remove_pattern in Patterns 7.2
Same name and namespace in other branches
- 7 includes/io/io.inc \patterns_io_remove_pattern()
Removes a pattern both from the file system and the database.
Parameters
mixed $pattern_orig A pattern object, an array representing: the pattern object, a numeric id or alphanumeric name of the pattern as it is in the database
bool $verbose (optional) If TRUE notify the users a failure.: Default FALSE.
Return value
Boolean TRUE, if removal from the file system and the database is successful
1 call to patterns_io_remove_pattern()
- patterns_remove_pattern_submit in ./
patterns.module - Form submission handler for patterns_remove_pattern().
File
- includes/
io/ io.inc, line 505 - Functions related to input/output operations.
Code
function patterns_io_remove_pattern($pattern_orig, $verbose = TRUE) {
// Retrieve
$pattern = _patterns_db_get_pattern($pattern_orig);
if (!$pattern) {
if ($verbose) {
drupal_set_message(t('Impossible to retrieve specified pattern: %pattern.', array(
'%pattern' => $pattern_orig,
)), 'error');
}
return FALSE;
}
if (!patterns_io_remove_pattern_from_fs($pattern->file, $verbose)) {
return FALSE;
}
$result = patterns_db_remove_pattern($pattern->pid);
if ($result) {
if ($verbose) {
drupal_set_message(t('Pattern %pattern was removed succesfully.', array(
'%pattern' => $pattern_orig,
)));
}
}
return $result;
}