diff options
author | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-11 15:50:56 +0000 |
---|---|---|
committer | Angie Byron <webchick@24967.no-reply.drupal.org> | 2009-08-11 15:50:56 +0000 |
commit | 84afe0d9275834a716edd826e8224e40cafa3746 (patch) | |
tree | 120beeede2cb7ad5d220927ba1aae56e44a98ad7 /modules/taxonomy/taxonomy.module | |
parent | 9c0e6e92426a061f78e6dfe685c7c37c7f72bc62 (diff) | |
download | brdo-84afe0d9275834a716edd826e8224e40cafa3746.tar.gz brdo-84afe0d9275834a716edd826e8224e40cafa3746.tar.bz2 |
#545306 by alexanderpas: De-op hook_node_type().
Diffstat (limited to 'modules/taxonomy/taxonomy.module')
-rw-r--r-- | modules/taxonomy/taxonomy.module | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index ba349e623..f78a409b6 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -929,10 +929,17 @@ function taxonomy_node_save($node, $terms) { } /** - * Implement hook_node_type(). + * Implement hook_node_type_insert(). */ -function taxonomy_node_type($op, $info) { - if ($op == 'update' && !empty($info->old_type) && $info->type != $info->old_type) { +function taxonomy_node_type_insert($info) { + drupal_static_reset('taxonomy_term_count_nodes'); +} + +/** + * Implement hook_node_type_update(). + */ +function taxonomy_node_type_update($info) { + if (!empty($info->old_type) && $info->type != $info->old_type) { db_update('taxonomy_vocabulary_node_type') ->fields(array( 'type' => $info->type, @@ -940,11 +947,17 @@ function taxonomy_node_type($op, $info) { ->condition('type', $info->old_type) ->execute(); } - elseif ($op == 'delete') { - db_delete('taxonomy_vocabulary_node_type') - ->condition('type', $info->type) - ->execute(); - } + drupal_static_reset('taxonomy_term_count_nodes'); +} + +/** + * Implement hook_node_type_delete(). + */ +function taxonomy_node_type_delete($info) { + db_delete('taxonomy_vocabulary_node_type') + ->condition('type', $info->type) + ->execute(); + drupal_static_reset('taxonomy_term_count_nodes'); } |