1 redirect.module | redirect_delete_multiple(array $rids) |
Delete multiple URL redirects.
Parameters
$rids: An array of redirect IDs to delete.
Return value
int: The constant SAVED_DELETED on success.
Throws
Exception A generic exception if the redirects could not be deleted.
Related topics
File
- core/
modules/ redirect/ redirect.module, line 840
Code
function redirect_delete_multiple(array $rids) {
$transaction = db_transaction();
$redirects = redirect_load_multiple($rids);
try {
// Let modules react to the individual redirects being deleted.
foreach ($redirects as $rid => $redirect) {
module_invoke_all('redirect_delete', $redirect);
}
db_delete('redirect')
->condition('rid', $rids, 'IN')
->execute();
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception('redirect', $e);
throw $e;
}
redirect_load_multiple(array(), array(), TRUE);
return SAVED_DELETED;
}