Hi,

when i call features_revert() function with no params, i'm attending to revert all components of my feature:

  • "The classics" : filter, content, user, fieldgroup, dependencies, imagecache, ...
  • "The others" : fe_taxonomy_vocabulary, workflow, ...

But, only certains components is reverted in this 2 categories (classics and others)
The problem is due to a miss in _features_restore() when features_get_component_states() is calling when parameter $items are empty:

if (empty($items)) {
  $states = features_get_component_states();
  foreach ($states as $module_name => $components) {
  ...

the 2nd params ($rebuild_only) of features_get_component_states() function is TRUE by default so here this parameter depends of the value $op (rebuild or revert)

Here is a patch that should fix the issue.

CommentFileSizeAuthor
feature_revert_no_params.patch776 bytesatouchard

Comments

atouchard’s picture

What do you think to pass these parameters for a better rebuild ?

hefox’s picture

Category: bug » feature

This doesn't quite seem like a bug, rather assumption on how function works (perhaps documentation needed).

I'm personally very hesitant to change how the function works at to such an extreme as others are likely using it as it currently works.

atouchard’s picture

Yes you are right, this change is radical and side effects are important.
But, you don't have the same behaviour with equivalent in drush (features_command_revert()). In this function, you don't have the issue because the function iterates for each module (perhaps the developper of this code have seen this problem).
So if you revert with features_revert() with no parameters or you type drush fra, you don't have the same result.

atouchard’s picture

Ok, documentation is a good point to explain how features_revert() behave with extensions like feature_extra, strongarm, ...
Empty value means to revert only original components of "Features".
Perhaps, add a shortcut to features_revert() 's argument to revert all features and extensions. The code will be inspired by features_command_revert_all() in features.export.inc.
Also, there is no side effects ...

hefox’s picture

Version: 6.x-1.0-rc3 » 7.x-1.x-dev
Status: Needs review » Needs work

If this is done, it should be done in d7 first and then decided whether it should be backported.

becw’s picture

Perhaps the first step is documentation? #1651330: features_revert() missing docblock (patch)