function block_revisions_delete_confirm_submit in Block Revisions 6
Same name and namespace in other branches
- 7 block_revisions.admin.inc \block_revisions_delete_confirm_submit()
File
- ./
block_revisions.admin.inc, line 44 - Admin functions and page callbacks for the Block Revisions module.
Code
function block_revisions_delete_confirm_submit($form, &$form_state) {
$revision = $form['#block_revision'];
$delta = $revision->bid;
$vid = $revision->vid;
db_query("DELETE FROM {boxes_revisions} WHERE bid = %d AND vid = %d", $delta, $vid);
$title = db_result(db_query("SELECT info FROM {boxes} WHERE bid = %d", $delta));
watchdog('content', "Deleted revision %revision for custom block '%title'.", array(
'%title' => $title,
'%revision' => $revision->vid,
));
drupal_set_message(t("Revision from %revision-date of custom block '%title' has been deleted.", array(
'%revision-date' => format_date($revision->timestamp),
'%title' => $title,
)));
if (db_result(db_query('SELECT COUNT(vid) FROM {boxes_revisions} WHERE bid = %d', $delta)) > 1) {
$form_state['redirect'] = "admin/build/block/configure/block/{$delta}/revisions";
}
else {
$form_state['redirect'] = "admin/build/block/configure/block/{$delta}";
}
}