This problem is actual only if you install a site in non-interactive mode (e.g. through drush site-install).

It is possible that the order of modules installation would be following:

  1. ...
  2. Feature A (doesn't contain variable export)
  3. Strongarm
  4. Feature B (contains variable export)
  5. ...

When A is enabled, features_include() is called, which then runs ctools_features_declare_functions() which gets static cached. But since Strongarm is not even enabled by that time, and since next calls can't reset static cache in that function, none of the B's variables are imported after installation. This prevents automation of site creation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

neochief’s picture

Here's the patch to solve it. It's incomplete without #710068: Unclearable static cache in ctools_export_get_schemas(), but doesn't brake Features, so there's no reason to wait.

neochief’s picture

Btw, this doesn't happen during manual installation, as modules are installed one at a time in it. Modules are enabled in batch mode, which means that it's full page reload from time to time, so the chance of this problem is lower.

hefox’s picture

Hm, quickly reading, the patch clears a static cache on every include of that file now? It'd be better to hook in when the cache needs to be cleared, ie. on enable of module (there's the hook modules enable call now).

neochief’s picture

ctools_features_declare_functions() is called only in features_include(), which has it's own static cache, so it won't work more times than it worked before.

hefox’s picture

But drupal_static('ctools_export_get_schemas', NULL, TRUE); is not a features cache though, right?

neochief’s picture

No, it's the cache of ctools function ctools_export_get_schemas(), which doesn't even have the way to clean the cache until #710068: Unclearable static cache in ctools_export_get_schemas().

hefox’s picture

Double negatives; the answer would be "Yes, it's not a features cache." That's my point; you're clearing the cache of ctools function not on the event that triggered the need for clear.

neochief’s picture

I'm not really sure what you suggest. Could you please explain your point deeper and I'll try update the patch?

hefox’s picture

Something like this

neochief’s picture

Oh, I see now. Your version looks much better.

neochief’s picture

Status: Needs review » Reviewed & tested by the community
mpotter’s picture

With the ctools patch, does that have any impact on the features patch in #9 or is that still good to go?

hefox’s picture

Looking at it quickly, it'll make this patch work. The patch changes static $whatever to drupal_static so that drupal_static in this patch will work.

Unrelated, I have a cat on my back.

neochief’s picture

Yes, #9 is good to go.

mpotter’s picture

Status: Reviewed & tested by the community » Fixed

Committed in fdbd18f

hefox’s picture

Version: 7.x-1.x-dev » 6.x-1.x-dev
Status: Fixed » Patch (to be ported)

I'm realllly not sure if this is needed for 6.x, and will be an interesting backport if it is, but might as well see

JvE’s picture

hefox’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Patch (to be ported) » Needs review
FileSize
1.99 KB

Bit late, but a test to test this issue.

neochief’s picture

Status: Needs review » Reviewed & tested by the community

Cool, looks good.

JvE’s picture

Status: Reviewed & tested by the community » Needs review

For me the test in #18 fails on the current 7.x-1.x-dev
The functions strongarm_features_api() and views_features_api() cannot be found.
Are these introduced by some other patch that hasn't made it to dev yet?

hefox’s picture

Status: Needs review » Reviewed & tested by the community

Need to use a release of ctools that has a fix for #710068: Unclearable static cache in ctools_export_get_schemas() included (same thing happened to me).

JvE’s picture

Thanks hefox, it's been a bit of a dependency juggle lately with Features,Ctools and Entity. I'm glad there's people like you around to help move things forward.

mpotter’s picture

Status: Reviewed & tested by the community » Fixed

Had to update the patch a bit to get it to apply to the latest dev, but seems to work great, so committed and pushed a30a8e8.

Status: Fixed » Closed (fixed)

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