? 115315.profile_autocomplete.patch ? 223820-core-book-empty-log.patch ? 261258-node-save-required-fields-3.patch ? 299136-book-test-extended.patch ? anon_user_0.patch ? file_test_cleanup_0.patch ? filterTips_0.patch ? filter_administration.patch ? help.test.patch ? node-type-namespace-206138-15.patch ? recentPollTest.3.patch ? should_learn_how_to_use_git_or_something.patch ? static_tree.patch ? static_tree.patch.1 ? taxonomy-reset-vocabulary-cache-296910-1.patch ? taxonomy-synonym-cache_0.patch.txt ? taxonomy_hierarchy.patch ? taxonomy_isset_plus_test.patch ? taxonomy_isset_plus_test.patch.1 ? taxonomy_objects.patch ? taxonomy_term_load.patch ? term_hooks.patch ? term_hooks_0.patch ? term_hooks_0.patch.1 ? term_object_again.patch ? trackerfix.patch ? upload_test_0.patch ? vocabulary_static_reset.patch ? modules/simpletest/tests/file_test.info ? modules/simpletest/tests/file_test.module ? modules/simpletest/tests/taxonomytest.info ? modules/simpletest/tests/taxonomytest.install ? modules/simpletest/tests/taxonomytest.module ? modules/simpletest/tests/taxonomytest.test ? modules/taxonomy/.taxonomy.module.swp ? modules/taxonomy/taxonomy_vocabulary_load.patch ? sites/default/files ? sites/default/settings.php Index: modules/forum/forum.module =================================================================== RCS file: /cvs/drupal/drupal/modules/forum/forum.module,v retrieving revision 1.464 diff -u -p -r1.464 forum.module --- modules/forum/forum.module 19 Sep 2008 20:25:02 -0000 1.464 +++ modules/forum/forum.module 27 Sep 2008 00:03:31 -0000 @@ -224,7 +224,7 @@ function forum_nodeapi(&$node, $op, $tea foreach ($node->taxonomy as $term) { if (db_result(db_query('SELECT COUNT(*) FROM {term_data} WHERE tid = %d AND vid = %d', $term, $vocabulary))) { if (in_array($term, $containers)) { - $term = taxonomy_term_load($term); + $term = taxonomy_get_term_data($term); form_set_error('taxonomy', t('The item %forum is only a container for forums. Please select one of the forums below it.', array('%forum' => $term->name))); } } @@ -565,8 +565,6 @@ function forum_get_topics($tid, $sortby, } } - $term = taxonomy_term_load($tid); - $sql = db_rewrite_sql("SELECT n.nid, r.tid, n.title, n.type, n.sticky, u.name, u.uid, n.created AS timestamp, n.comment AS comment_mode, l.last_comment_timestamp, IF(l.last_comment_uid != 0, cu.name, l.last_comment_name) AS last_comment_name, l.last_comment_uid, l.comment_count AS num_comments, f.tid AS forum_tid FROM {node_comment_statistics} l INNER JOIN {node} n ON n.nid = l.nid INNER JOIN {users} cu ON l.last_comment_uid = cu.uid INNER JOIN {term_node} r ON n.vid = r.vid INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {forum} f ON n.vid = f.vid WHERE n.status = 1 AND r.tid = %d"); $sql .= tablesort_sql($forum_topic_list_header, 'n.sticky DESC,'); $sql .= ', n.created DESC'; // Always add a secondary sort order so that the news forum topics are on top. Index: modules/taxonomy/taxonomy.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v retrieving revision 1.29 diff -u -p -r1.29 taxonomy.admin.inc --- modules/taxonomy/taxonomy.admin.inc 19 Sep 2008 20:25:03 -0000 1.29 +++ modules/taxonomy/taxonomy.admin.inc 27 Sep 2008 00:03:32 -0000 @@ -747,7 +747,8 @@ function taxonomy_form_term_submit($form return; } - switch (taxonomy_save_term($form_state['values'])) { + $status = taxonomy_save_term($form_state['values']); + switch ($status) { case SAVED_NEW: drupal_set_message(t('Created new term %term.', array('%term' => $form_state['values']['name']))); watchdog('taxonomy', 'Created new term %term.', array('%term' => $form_state['values']['name']), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $form_state['values']['tid'] . '/edit')); Index: modules/taxonomy/taxonomy.module =================================================================== RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v retrieving revision 1.429 diff -u -p -r1.429 taxonomy.module --- modules/taxonomy/taxonomy.module 24 Sep 2008 18:42:00 -0000 1.429 +++ modules/taxonomy/taxonomy.module 27 Sep 2008 00:03:33 -0000 @@ -320,18 +320,20 @@ function taxonomy_save_term(&$form_value 'weight' => 0 ); + $term = (object) $form_values; + if (!empty($form_values['tid']) && $form_values['name']) { - drupal_write_record('term_data', $form_values, 'tid'); - $hook = 'update'; - $status = SAVED_UPDATED; + $status = drupal_write_record('term_data', $form_values, 'tid'); + module_invoke_all('taxonomy_term_save', $term); } else if (!empty($form_values['tid'])) { return taxonomy_del_term($form_values['tid']); } else { - drupal_write_record('term_data', $form_values); - $hook = 'insert'; - $status = SAVED_NEW; + $status = drupal_write_record('term_data', $form_values); + $term->tid = $form_values['tid']; + //$term = taxonomy_term_load($form_values['tid'], TRUE); + module_invoke_all('taxonomy_term_save', $term); } db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $form_values['tid'], $form_values['tid']); @@ -372,10 +374,6 @@ function taxonomy_save_term(&$form_value } } - if (isset($hook)) { - module_invoke_all('taxonomy', $hook, 'term', $form_values); - } - cache_clear_all(); return $status; @@ -405,16 +403,15 @@ function taxonomy_del_term($tid) { } } - $term = (array) taxonomy_term_load($tid); + $term = taxonomy_term_load($tid); db_query('DELETE FROM {term_data} WHERE tid = %d', $tid); db_query('DELETE FROM {term_hierarchy} WHERE tid = %d', $tid); db_query('DELETE FROM {term_relation} WHERE tid1 = %d OR tid2 = %d', $tid, $tid); db_query('DELETE FROM {term_synonym} WHERE tid = %d', $tid); db_query('DELETE FROM {term_node} WHERE tid = %d', $tid); - - module_invoke_all('taxonomy', 'delete', 'term', $term); } + module_invoke_all('taxonomy_term_delete', $term); $tids = $orphans; } @@ -1048,7 +1045,24 @@ function taxonomy_term_load($tid, $reset } static $terms = array(); if (!isset($terms[$tid]) || $reset) { - $terms[$tid] = db_fetch_object(db_query('SELECT * FROM {term_data} WHERE tid = %d', $tid)); + $terms[$tid] = taxonomy_get_term_data($tid, $reset); + module_invoke_all('taxonomy_term_load', $terms[$tid]); + } + return $terms[$tid]; +} + +/** + * Return a term object from the term_data table. + * @param $tid + * A term's ID + * @return Object + * A term object. Results are statically cached. + */ +function taxonomy_get_term_data($tid, $reset = FALSE) { + static $terms = array(); + + if (!isset($terms[$tid]) || $reset) { + $terms[$tid] = db_query('SELECT * FROM {term_data} WHERE tid = :tid', array(':tid' => $tid))->fetchObject(); } return $terms[$tid]; } @@ -1118,7 +1132,7 @@ function taxonomy_select_nodes($tids = a $depth = NULL; } foreach ($tids as $index => $tid) { - $term = taxonomy_term_load($tid); + $term = taxonomy_get_term_data($tid); $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth); $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree)); }