Download & Extend

Features export for HS uses serial ID of taxonomy vocabularies instead of machine name

Project:Hierarchical Select
Version:7.x-3.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:reviewed & tested by the community

Issue Summary

Issues like #1266466: Features should not are caused by the fact that exporting HS settings through features results in a feature that requires the taxonomy vocabularies to have the same serial ID as they did on the original site. Consequently, most of these settings are unusable on the destination site because these vocabularies end up with different identifiers.

The export should leverage something like UUID, or use the machine name of the vocabulary instead.

Comments

#1

Status:active» needs review

The attached patch converts HS taxonomy over to using the machine name of vocabularies in config names, instead of the serial vocabulary ID. Since Features just rolls with whatever HS calls the configs, there was no change necessary to the features export code.

This might need additional work to add logic to update the profiles when vocabularies are renamed, but I'll leave that as an open exercise for now.

After applying this patch, you will need to run update.php to rename old configs to follow the new convention.

AttachmentSize
hierarchical_select-machine_name_for_features_export-1477292-1.patch 4.43 KB

#2

I found a few more places where the VID was being used instead of the machine name. In addition, I wanted to make sure that HS taxonomy reacts to changes in the vocabulary machine name or deletion of vocabularies.

The attached patch should address all of these concerns, as well as including all of the changes from #1. Use this one instead.

AttachmentSize
hierarchical_select-machine_name_for_features_export-1477292-2.patch 8.6 KB

#3

I received errors when trying to apply the patch.

hierarchical_select-machine_name_for_features_export-1477292-2.patch:34: trailing whitespace.
  require_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'hierarchical_select') .                                         '/includes/common.inc';
hierarchical_select-machine_name_for_features_export-1477292-2.patch:35: trailing whitespace.

hierarchical_select-machine_name_for_features_export-1477292-2.patch:99: trailing whitespace.
*
hierarchical_select-machine_name_for_features_export-1477292-2.patch:102: trailing whitespace.
*
hierarchical_select-machine_name_for_features_export-1477292-2.patch:108: trailing whitespace.

Checking patch includes/common.inc...
Checking patch modules/hs_taxonomy.install...
Checking patch modules/hs_taxonomy.module...
error: while searching for:
// Private functions.

/**
* Drupal core's taxonomy_term_count_nodes() is buggy. See
* http://drupal.org/node/144969#comment-843000.
*/

error: patch failed: modules/hs_taxonomy.module:892
error: modules/hs_taxonomy.module: patch does not apply

#4

I could apply the patch without errors. I have only tested a content type feature and it works fine. As config id the machine name of the taxonomy is now used. But this needs more testing to be sure there are no issues.

#5

Well the patch almost works. The only thing missing was the actual include of the common.inc in the hierarchical_select.features.inc around line 88. I made a small update to that patch and attached it for review.

AttachmentSize
hierarchical_select-machine_name_for_features_export_with_fix_for_install-1477292-5.patch 9.87 KB

#6

#5 works for me :). Thanks!!!

#7

Patch in #5 works for me. Thanks

#8

Status:needs review» reviewed & tested by the community

Patch in #5 is working for me as well.

#9

Thanks for the patch... this is a very useful addition, will this be committed?

#10

The patch in #5 allows exportability and features integration, but it's full of spacing and no newline errors - also odd HTML markup inside Doxygen comments. I re-rolled a patch (and attached interdiff to #5) to make this more commit-worthy.

Other places in the module have wonky coding standards issues, but at least this patch ensures no more of those are added by this issue!

AttachmentSize
hierarchical_select-machine-name-features-1477292-10.patch 10.11 KB
interdiff.txt 6.21 KB