summaryrefslogtreecommitdiff
path: root/modules/taxonomy
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-01-11 23:25:05 -0500
committerwebchick <webchick@24967.no-reply.drupal.org>2012-01-11 23:25:05 -0500
commit6f58aa16f0066d59c9e16a855ab1886d72f8d472 (patch)
tree2dcaaa07078853902992aa8a8c4e066f44dfd540 /modules/taxonomy
parent60dcf9501d74d916e8e06c2e8682322186bbad05 (diff)
downloadbrdo-6f58aa16f0066d59c9e16a855ab1886d72f8d472.tar.gz
brdo-6f58aa16f0066d59c9e16a855ab1886d72f8d472.tar.bz2
Issue #1391384 by yched, oriol_e9g: Fixed Wrong static clear on taxonomy_vocabulary_save().
Diffstat (limited to 'modules/taxonomy')
-rw-r--r--modules/taxonomy/taxonomy.module3
-rw-r--r--modules/taxonomy/taxonomy.test6
2 files changed, 8 insertions, 1 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index fb443ed49..7c11bccaf 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -428,6 +428,7 @@ function taxonomy_vocabulary_save($vocabulary) {
if (!empty($vocabulary->vid) && !empty($vocabulary->name)) {
$status = drupal_write_record('taxonomy_vocabulary', $vocabulary, 'vid');
+ taxonomy_vocabulary_static_reset(array($vocabulary->vid));
if ($vocabulary->old_machine_name != $vocabulary->machine_name) {
field_attach_rename_bundle('taxonomy_term', $vocabulary->old_machine_name, $vocabulary->machine_name);
}
@@ -436,6 +437,7 @@ function taxonomy_vocabulary_save($vocabulary) {
}
elseif (empty($vocabulary->vid)) {
$status = drupal_write_record('taxonomy_vocabulary', $vocabulary);
+ taxonomy_vocabulary_static_reset();
field_attach_create_bundle('taxonomy_term', $vocabulary->machine_name);
module_invoke_all('taxonomy_vocabulary_insert', $vocabulary);
module_invoke_all('entity_insert', $vocabulary, 'taxonomy_vocabulary');
@@ -443,7 +445,6 @@ function taxonomy_vocabulary_save($vocabulary) {
unset($vocabulary->original);
cache_clear_all();
- taxonomy_vocabulary_static_reset(array($vocabulary->vid));
return $status;
}
diff --git a/modules/taxonomy/taxonomy.test b/modules/taxonomy/taxonomy.test
index eb1324337..0a5bdf340 100644
--- a/modules/taxonomy/taxonomy.test
+++ b/modules/taxonomy/taxonomy.test
@@ -1290,10 +1290,16 @@ class TaxonomyTermFieldTestCase extends TaxonomyWebTestCase {
);
field_update_field($this->field);
// Change the machine name.
+ $old_name = $this->vocabulary->machine_name;
$new_name = drupal_strtolower($this->randomName());
$this->vocabulary->machine_name = $new_name;
taxonomy_vocabulary_save($this->vocabulary);
+ // Check that entity bundles are properly updated.
+ $info = entity_get_info('taxonomy_term');
+ $this->assertFalse(isset($info['bundles'][$old_name]), t('The old bundle name does not appear in entity_get_info().'));
+ $this->assertTrue(isset($info['bundles'][$new_name]), t('The new bundle name appears in entity_get_info().'));
+
// Check that the field instance is still attached to the vocabulary.
$field = field_info_field($this->field_name);
$allowed_values = $field['settings']['allowed_values'];