Issue #1022416 by bfroehle, turboflash: Fixed Wrong use of db_transaction() in block module.

8.0.x
webchick 2011-06-08 22:34:15 -07:00
parent 002cf94d32
commit 352fdec02d
1 changed files with 62 additions and 50 deletions

View File

@ -170,8 +170,8 @@ function block_admin_display_form($form, &$form_state, $blocks, $theme, $block_r
* @see block_admin_display_form()
*/
function block_admin_display_form_submit($form, &$form_state) {
$txn = db_transaction();
$transaction = db_transaction();
try {
foreach ($form_state['values']['blocks'] as $block) {
$block['status'] = (int) ($block['region'] != BLOCK_REGION_NONE);
$block['region'] = $block['status'] ? $block['region'] : '';
@ -186,6 +186,12 @@ function block_admin_display_form_submit($form, &$form_state) {
->condition('theme', $block['theme'])
->execute();
}
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception('block', $e);
throw $e;
}
drupal_set_message(t('The block settings have been updated.'));
cache_clear_all();
}
@ -460,8 +466,8 @@ function block_admin_configure_validate($form, &$form_state) {
*/
function block_admin_configure_submit($form, &$form_state) {
if (!form_get_errors()) {
$txn = db_transaction();
$transaction = db_transaction();
try {
db_update('block')
->fields(array(
'visibility' => (int) $form_state['values']['visibility'],
@ -500,6 +506,12 @@ function block_admin_configure_submit($form, &$form_state) {
}
module_invoke($form_state['values']['module'], 'block_save', $form_state['values']['delta'], $form_state['values']);
}
catch (Exception $e) {
$transaction->rollback();
watchdog_exception('block', $e);
throw $e;
}
drupal_set_message(t('The block configuration has been saved.'));
cache_clear_all();
$form_state['redirect'] = 'admin/structure/block';