4

I have this really big feature where all CT, fields, views etc are exported. As far as I understand it makes sense to make it into smaller features, more context specific, like features_views, features_fields, features_CT etc.

The big feature is already enabled in production, is it safe to disable it and enable the other 3? Which approach should I follow?

  • 4
    My own experience suggests it not a good idea to split features along "providing module slices", such as "views", "fields" etc. It makes it much more likely that two developers will cause conflicts. Rather break them as they were intended. "Image gallery", "Blog", etc. Just my 2 cents. – Letharion Nov 7 '14 at 10:27
  • Well the question is different. Is it feasible to make the split without breaking the db? However, your input is very interesting! Well what about if you have 10 different CT and custom fields attached to them. Would you suggest to split it 10 different features according to context? – Potney Switters Nov 7 '14 at 10:37
  • 2
    I know it's different, hence the comment instead of answer. :) I guess in the end you have to decide what fits your own situation the best. For the sake of productivity, I think it's important to consider what allows you to minimize the amount of conflicts between developers. Related to your actual question, I believe it's perfectly safe, but I would never try it out live without 1) testing it locally first, 2) git (or other vcs), 3) fresh db-backups. As in theory, you could screw up everything if the feature is really big. – Letharion Nov 7 '14 at 10:44
2

Direct Answer

If you take the appropriate precautions, and test locally first, it should be safe to break up the feature.

Background

If you want to split the big feature up, you need to make ensure that disabling the features does not affect the configuration of your site. Then you can disable the feature and use features to carve up the config differently and export as smaller component features.

I understand your point that one big feature is not that useful, as the individual components are not then transferable via features to other sites (or from dev to production), which is one of the uses of features.

I agree with letharion that it makes much more sense to divide your features along the lines of functionality (eg blog, gallery) rather than along modular lines (eg views, fields) otherwise all of your features will be interconnected anyway, in that disabling one will break dependent functionailty on the site. For example if I export a content type in one feature, and a view using that content type in another, then I would have to declare that the views feature is dependent on the content type feature. Functional features are also easier to document sensibly in version control.

Method

I have taken solution from my own previous comment on d.o

You can use the Features Tools module to disable a module while leaving functionality in place. You can then re-export your config as smaller features.

  • First BACKUP YOUR DATABASE
  • backup your feature (files) if you would like to use it again.
  • Install Features Tools, go to the 'recreate' page for a feature, uncheck all of the features components
  • Now click on the 'Safe autocreate' button to recreate and replace the feature with an empty version.

You can now disable the module without affecting your site configuration. These instructions are for D7, if you are using D6 there is an extra step.

See ftools project for more complete documentation.

http://drupal.org/project/ftools

PS - unchecking all the boxes in the features ui is much quicker if you install a browser plugin like check all first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.