function path_redirect_delete in Path redirect 5
Same name and namespace in other branches
- 6 path_redirect.module \path_redirect_delete()
Delete the specified path redirect. This will delete as specifically as possible, in order: by $rid, by ($from, $to), by $from, or by $to. Multiple redirects may be deleted if the $to parameter matches more than one entry.
This function is part of an API available for external code to use.
Parameters
$from: Source path of redirect to delete.
$to: Destination path or URL of redirect to delete.
$rid: Unique ID of redirect to delete.
Return value
The result of the deletion query.
2 calls to path_redirect_delete()
File
- ./
path_redirect.module, line 395
Code
function path_redirect_delete($from = NULL, $to = NULL, $rid = NULL) {
if (!empty($rid)) {
$result = db_query("DELETE FROM {path_redirect} WHERE rid = %d", $rid);
}
else {
if (!empty($from)) {
if (!empty($to)) {
$result = db_query("DELETE FROM {path_redirect} WHERE path = '%s' AND redirect = '%s'", $from, $to);
}
else {
$result = db_query("DELETE FROM {path_redirect} WHERE path = '%s'", $from);
}
}
else {
if (!empty($to)) {
$result = db_query("DELETE FROM {path_redirect} WHERE redirect = '%s'", $to);
}
}
}
return $result;
}