I experienced some weirdness where all Profile2 fields disappeared when disabling and reenabling a features module and I assumed it was an issue with Profile2 like this:

#1316874: Profile2 exported via Features yields broken profiles, disappearing fields

After a lot of digging around, I found that the .info file had "features_exclude" instead of "features" in the .info file for the missing fields. The developer who recreated the features module did not exclude these fields.

I talked to another developer (on a different project) and they found a similar issue where "features_exclude" items ended up magically appearing in their features modules' .info files. She thought it might be due to generating the features module directly into the code directory rather than downloading the module code and then installing (she appeared to have better luck with the latter method).

I did not see any issue in the issue queue that refers to "features_exclude", so maybe this is a new issue... I think it is a bug of some sort but it is not clear how to reproduce. Perhaps there is some auto-dependency issue?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Elijah Lynn’s picture

Priority: Major » Normal

I think this was just introduced with 7.x-2.0-beta2 (release notes). I am not entirely sure what features_exclude[] is for yet but it is discussed in this issue http://drupal.org/node/1064472#comment-7196064

Kristen Pol’s picture

Thanks! At least he is saying it is totally okay to "remove" those "features_exclude" items (though actually, I had to change them from "features_exclude" to "features"). If I could go back before beta2, I would but I don't think that would work because it looks like the API changed.

Elijah Lynn’s picture

The features_exclude items are a bit confusing. I think we can propose a better name for them. It is also confusing since you only get them when you export via the GUI.

hefox’s picture

Priority: Normal » Major

I just got this also.

features_excludes are suppose to be items you've deliberately excluded from having in the feature.. so.. odd that it adds the items you want XD

RunePhilosof’s picture

Could it be that you haven't deleted the featurename.features.field.inc file from your feature?
See http://www.phase2technology.com/blog/new-field-bases-and-instances-in-fe...

I think features should detect and warn users when they have both base/instance and deprecated field export in a feature.

hefox’s picture

My case happened while making a completely new feature

DamienMcKenna’s picture

@RunePhilosof: see #1959076: Features does not remove the several known deprecated files, but as hefox says it isn't relevant to this issue.

DamienMcKenna’s picture

This has also been bugging me with text filters - I'll build a feature via the GUI that has all of the pieces I want, then later update via Drush only to have it move some of the filters into features_exclude.

Elijah Lynn’s picture

Not sure if this should have been part of this issue but I submitted a separate issue & patch for renaming features_exclude to features_ui_autodetect_exclude here -> #1990290: Rename features_exclude to features_ui_autodetect_exclude (less confusing)

DamienMcKenna’s picture

Priority: Normal » Major

Closed a duplicate: #1993824: features_exclude being generated in info file when not required?

The issue there was that errant lines were being added to the info file, e.g.:

features_exclude[field][node-blog-body] = node-blog-body
features_exclude[field][node-blog-field_blog_image] = node-blog-field_blog_image
features_exclude[field][node-blog-field_categories] = node-blog-field_categories
features_exclude[field][node-blog-title_field] = node-blog-title_field
features_exclude[field][node-blog-field_author] = node-blog-field_author
features_exclude[field][node-blog-field_comment_count] = node-blog-field_comment_count
features_exclude[field][node-blog-field_publish_date] = node-blog-field_publish_date
hefox’s picture

The field ones are likely coming from a contrib module that hasn't been updated for the field change. I noticed that got added to mine after adding a new component. Can't remember which contrib module it was.

However, seen this outside of 'field'

DamienMcKenna’s picture

@hefox: One of the modules that used to do automatically add fields was field_group, but I'm running the patch from #1966624: Feature 7.x-2.0-beta2 defines fields in a new way and still seeing the problem.

hefox’s picture

That shouldn't be causing this, since

if (!empty($export['features']['field'])) {

would only run if $export[features][field] was already set

(I think I saw them starting to be added when a field_group was added, but looked and saw that ^)

hefox’s picture

Status: Active » Needs review
FileSize
1023 bytes

... not contrib :<

function node_features_export($data, &$export, $module_name = '') {
      ..
      $fields = field_info_instances('node', $type);
      foreach ($fields as $name => $field) {
        $pipe['field'][] = "node-{$field['bundle']}-{$field['field_name']}";
        $pipe['field_instance'][] = "node-{$field['bundle']}-{$field['field_name']}";

I don't see any reason it still should be suggested by node anymore. Not sure why we're not automatically switching those using fields to field and field bases (perhaps due to multi uses of the field and only updating one?).

Anyhow posting this here, but think this is only a symptom (though a issue on it's own). If anyone debugs a more features_exclude specific problem and comes up with a patch, I'll open a new issue for this.

n_potter’s picture

Thanks for directing me to this thread, I have read the links provided; my understanding is then that this version of Features has split the field settings into Base and Instance. The problem I am having is that the instance settings (weighting, visibility, etc) that are in code are being overriden by the presence of features_exclude lines which get automatically shoved into the .info file when I recreate/regenerate the feature.

The modules I'm having a problem with are old features (generated over a year ago) with added custom code. Perhaps it would be prudent to rebuild the feature from scratch in 2.0 and re-introduce the custom module code & clean up?

Apologies if I missed something in the thread, but have we a solution for how to stop this behaviour, or is this a bug?

mpotter’s picture

Status: Needs review » Fixed

Patch in #14 worked with the different test cases I tried it on. It removes the features_exclude[fields] stuff without affecting features_exclude[fields_base]. So I committed this to 42c003e.

This fixes the original issue, so if there is still any trouble with missing fields, please open a new issue to track it.

hefox’s picture

Note that some people may be experiencing this #2000238: Convert 'field' to 'field_instance' on features-update (fu) bug

hefox’s picture

Kristen Pol’s picture

Status: Fixed » Needs work

Fyi, I tried #14 and we are still seeing the features_exclude items. I'm going to try some of the patches on the related issues.

hefox’s picture

Status: Needs work » Fixed

Based on mpotter's fixed message, please leave this closed and look over existing issues/open a new one with more information for additional bugs. This is one of the "several things can produce the same bug" things

Kristen Pol’s picture

Ah... okay ;) I created the issue so thought it would be okay to reopen it. I don't have any other information on why these features_exclude comes up so this is the only issue that is relevant to me at the moment. I looked at the other issues and tried the patched but no luck. I'll just hope it gets fixed somewhere and gets into dev at some point... since we are aware of the issue, we just remove the features_excludes as needed.

hefox’s picture

I may have not noticed you created this issue XD

Kristen Pol’s picture

FileSize
5.06 KB

No worries! I had to look up XD ;)

xd-16635.jpg

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.