Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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:
- ...
- Feature A (doesn't contain variable export)
- Strongarm
- Feature B (contains variable export)
- ...
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.
Comment | File | Size | Author |
---|---|---|---|
#18 | features_1493274_ctools_include_test.patch | 1.99 KB | hefox |
#9 | features_1493274_clear_ctools_cache.patch | 1.99 KB | hefox |
#1 | features-ctools-strongarm-static-cache-1493274.patch | 1.18 KB | neochief |
Comments
Comment #1
neochief CreditAttribution: neochief commentedHere'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.
Comment #2
neochief CreditAttribution: neochief commentedBtw, 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.
Comment #3
hefox CreditAttribution: hefox commentedHm, 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).
Comment #4
neochief CreditAttribution: neochief commentedctools_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.
Comment #5
hefox CreditAttribution: hefox commentedBut drupal_static('ctools_export_get_schemas', NULL, TRUE); is not a features cache though, right?
Comment #6
neochief CreditAttribution: neochief commentedNo, 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().
Comment #7
hefox CreditAttribution: hefox commentedDouble 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.
Comment #8
neochief CreditAttribution: neochief commentedI'm not really sure what you suggest. Could you please explain your point deeper and I'll try update the patch?
Comment #9
hefox CreditAttribution: hefox commentedSomething like this
Comment #10
neochief CreditAttribution: neochief commentedOh, I see now. Your version looks much better.
Comment #11
neochief CreditAttribution: neochief commentedWoohoo, #710068: Unclearable static cache in ctools_export_get_schemas() is committed.
Comment #12
mpotter CreditAttribution: mpotter commentedWith the ctools patch, does that have any impact on the features patch in #9 or is that still good to go?
Comment #13
hefox CreditAttribution: hefox commentedLooking 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.
Comment #14
neochief CreditAttribution: neochief commentedYes, #9 is good to go.
Comment #15
mpotter CreditAttribution: mpotter commentedCommitted in fdbd18f
Comment #16
hefox CreditAttribution: hefox commentedI'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
Comment #17
JvE CreditAttribution: JvE commentedFYI: this patch caused #1537838: Upgrading to 7.x-1.0-rc2 (from rc1) breaks taxonomy creation.
Comment #18
hefox CreditAttribution: hefox commentedBit late, but a test to test this issue.
Comment #19
neochief CreditAttribution: neochief commentedCool, looks good.
Comment #20
JvE CreditAttribution: JvE commentedFor 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?
Comment #21
hefox CreditAttribution: hefox commentedNeed 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).
Comment #22
JvE CreditAttribution: JvE commentedThanks 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.
Comment #23
mpotter CreditAttribution: mpotter commentedHad 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.