diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/forum/forum.admin.inc | 2 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.admin.inc | 2 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 30 |
3 files changed, 16 insertions, 18 deletions
diff --git a/modules/forum/forum.admin.inc b/modules/forum/forum.admin.inc index c81e61256..49cb555ec 100644 --- a/modules/forum/forum.admin.inc +++ b/modules/forum/forum.admin.inc @@ -93,6 +93,8 @@ function forum_form_submit($form, &$form_state) { break; case SAVED_UPDATED: drupal_set_message(t('The @type %term has been updated.', array('%term' => $form_state['values']['name'], '@type' => $type))); + // Clear the page and block caches to avoid stale data. + cache_clear_all(); break; } $form_state['redirect'] = 'admin/structure/forum'; diff --git a/modules/taxonomy/taxonomy.admin.inc b/modules/taxonomy/taxonomy.admin.inc index 55ef4d6c9..7e6b43268 100644 --- a/modules/taxonomy/taxonomy.admin.inc +++ b/modules/taxonomy/taxonomy.admin.inc @@ -791,6 +791,8 @@ function taxonomy_form_term_submit($form, &$form_state) { case SAVED_UPDATED: drupal_set_message(t('Updated term %term.', array('%term' => $term->name))); watchdog('taxonomy', 'Updated term %term.', array('%term' => $term->name), WATCHDOG_NOTICE, l(t('edit'), 'taxonomy/term/' . $term->tid . '/edit')); + // Clear the page and block caches to avoid stale data. + cache_clear_all(); break; } diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 9f6e54dc2..73d15ab1a 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -461,10 +461,8 @@ function taxonomy_check_vocabulary_hierarchy($vocabulary, $changed_term) { * Status constant indicating if term was inserted or updated. */ function taxonomy_term_save($term) { - if ($term->name) { - // Prevent leading and trailing spaces in term names. - $term->name = trim($term->name); - } + // Prevent leading and trailing spaces in term names. + $term->name = trim($term->name); if (!isset($term->vocabulary_machine_name)) { $vocabulary = taxonomy_vocabulary_load($term->vid); $term->vocabulary_machine_name = $vocabulary->machine_name; @@ -498,28 +496,24 @@ function taxonomy_term_save($term) { } $query = db_insert('taxonomy_term_hierarchy') ->fields(array('tid', 'parent')); - if (is_array($term->parent)) { - foreach ($term->parent as $parent) { - if (is_array($parent)) { - foreach ($parent as $tid) { - $query->values(array( - 'tid' => $term->tid, - 'parent' => $tid - )); - } - } - else { + foreach ($term->parent as $parent) { + if (is_array($parent)) { + foreach ($parent as $tid) { $query->values(array( 'tid' => $term->tid, - 'parent' => $parent + 'parent' => $tid )); } } + else { + $query->values(array( + 'tid' => $term->tid, + 'parent' => $parent + )); + } } $query->execute(); } - - cache_clear_all(); taxonomy_terms_static_reset(); return $status; |