diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 6f6c04b..634890c 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -1618,10 +1618,6 @@ function comment_delete_multiple($cids) { if ($comments) { $transaction = db_transaction(); try { - // Delete the comments. - db_delete('comment') - ->condition('cid', array_keys($comments), 'IN') - ->execute(); foreach ($comments as $comment) { field_attach_delete('comment', $comment); module_invoke_all('comment_delete', $comment); @@ -1632,6 +1628,10 @@ function comment_delete_multiple($cids) { comment_delete_multiple($child_cids); _comment_update_node_statistics($comment->nid); } + // Delete the comments. + db_delete('comment') + ->condition('cid', array_keys($comments), 'IN') + ->execute(); } catch (Exception $e) { $transaction->rollback(); diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 7ad28e9..47fdacb 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -474,14 +474,15 @@ function taxonomy_vocabulary_delete($vid) { foreach ($result as $tid) { taxonomy_term_delete($tid); } - db_delete('taxonomy_vocabulary') - ->condition('vid', $vid) - ->execute(); field_attach_delete_bundle('taxonomy_term', $vocabulary->machine_name); module_invoke_all('taxonomy_vocabulary_delete', $vocabulary); module_invoke_all('entity_delete', $vocabulary, 'taxonomy_vocabulary'); + db_delete('taxonomy_vocabulary') + ->condition('vid', $vid) + ->execute(); + // Load all Taxonomy module fields and delete those which use only this // vocabulary. $taxonomy_fields = field_read_fields(array('module' => 'taxonomy')); @@ -717,16 +718,15 @@ function taxonomy_term_delete($tid) { } if ($term = taxonomy_term_load($tid)) { + field_attach_delete('taxonomy_term', $term); + module_invoke_all('taxonomy_term_delete', $term); + module_invoke_all('entity_delete', $term, 'taxonomy_term'); db_delete('taxonomy_term_data') ->condition('tid', $tid) ->execute(); db_delete('taxonomy_term_hierarchy') ->condition('tid', $tid) ->execute(); - - field_attach_delete('taxonomy_term', $term); - module_invoke_all('taxonomy_term_delete', $term); - module_invoke_all('entity_delete', $term, 'taxonomy_term'); taxonomy_terms_static_reset(); } }