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.
Similar in nature to http://drupal.org/node/704024...
When I try and revert some features, I get the following:
Parse error: syntax error, unexpected ')' in /home/tom/workspace/concern6/sites/concern.net/modules/contrib/features/features.export.inc(591) : eval()'d code on line 5
Call Stack:
0.0005 195952 1. {main}() /home/tom/bin/drush/drush.php:0
0.0090 1971904 2. drush_main() /home/tom/bin/drush/drush.php:41
0.4638 6114904 3. drush_dispatch() /home/tom/bin/drush/drush.php:91
0.4640 6118456 4. call_user_func_array() /home/tom/bin/drush/includes/drush.inc:51
0.4640 6119232 5. drush_command() /home/tom/bin/drush/includes/drush.inc:0
0.4641 6120792 6. call_user_func_array() /home/tom/bin/drush/includes/command.inc:378
0.4641 6121152 7. drush_invoke() /home/tom/bin/drush/includes/command.inc:0
0.4650 6146368 8. call_user_func_array() /home/tom/bin/drush/includes/command.inc:327
0.4650 6147168 9. drush_core_updatedb_batch_process() /home/tom/bin/drush/includes/command.inc:0
0.4662 6364000 10. _update_batch_command() /home/tom/bin/drush/commands/core/core.drush.inc:541
3.1867 80934792 11. drush_batch_command() /home/tom/bin/drush/commands/core/drupal/update_6.inc:472
3.1875 81002880 12. _drush_batch_command() /home/tom/bin/drush/includes/batch.inc:68
3.1880 81125488 13. _drush_batch_worker() /home/tom/bin/drush/commands/core/drupal/batch_6.inc:69
3.9494 82041376 14. call_user_func_array() /home/tom/bin/drush/commands/core/drupal/batch_6.inc:103
3.9494 82041744 15. _update_do_one() /home/tom/bin/drush/commands/core/drupal/batch_6.inc:0
3.9494 82044424 16. concern_net_update_6101() /home/tom/bin/drush/commands/core/drupal/update_6.inc:454
25.0294 141234408 17. update_api_features_revert() /home/tom/workspace/concern6/sites/concern.net/modules/custom/concern_net/concern_net.install:82
76.7220 203624792 18. features_detect_overrides() /home/tom/workspace/concern6/sites/concern.net/modules/contrib/update_api/contrib/features.inc:75
76.9152 208321288 19. features_get_component_states() /home/tom/workspace/concern6/sites/concern.net/modules/contrib/features/features.export.inc:279
76.9381 208345432 20. features_get_signature() /home/tom/workspace/concern6/sites/concern.net/modules/contrib/features/features.export.inc:649
76.9381 208345960 21. features_get_normal() /home/tom/workspace/concern6/sites/concern.net/modules/contrib/features/features.export.inc:527
Sticking var_dump($code);
in features.export.inc at line 591, I can see that this is probably the cause of the problem:
$args = func_get_args();
$module = array_shift($args);
$api = array_shift($args);
if ($module == "" && $api == "") {
return array("version" => );
}
I'm not sure where that is coming from though... I can't see that code in my feature anywhere.
Comment | File | Size | Author |
---|---|---|---|
#4 | ctools-export-get-schema-static-cache-710068.patch | 596 bytes | neochief |
#2 | 710068-ctools-features-revert-schema-cache.patch | 490 bytes | mrfelton |
Comments
Comment #1
mrfelton CreditAttribution: mrfelton commentedIn my feature, What I see is:
Comment #2
mrfelton CreditAttribution: mrfelton commentedOk, think I got it.
Basically I'm using
hook_update_n()
to install some features and revert them to their default state (The functionality of these features already exists on the site, but I'm 'featurising' them), and in the process of doing so, I'm making some changes to the features. So, I need to install and then revert the features. My hook_hopate looks a little like this (some of these cache clears can probably be removed - they were added as part of debugging this problem).Now, the problem seems to be that
ctools_component_features_revert()
calls_ctools_features_get_info()
, which isn't including details of the strongarm feature (that provides variable exports). And essentially the reason is thatfeatures_get_info()
in turn callsctools_export_get_schemas()
, which usesdrupal_get_schema()
to get details of schemas. However this information is cached, anddrupal_flush_all_caches()
doesn't clear that cache. The only way I can find to clear the schema cache is to alterctools_export_get_schemas()
so thatdrupal_get_schema(NULL, TRUE)
is called with the second parameter as true. This ensures that when features asks ctools for a list schemas that support exports, the schema cache is refreshed and the new schema alterations made by the strongarm module are picked up, and so updated details of the schema for the variable table (modified by strongarm) are included in the result, which ensures that the erroneous code that is executed in eval():comes out looking like:
Which fixes the error and ensures that the feature can revert properly! :)
So, the fix that I employed was actually in ctools, not features (patch attached). But, maybe you can find a way to invalidate the schema cache from within features instead?
Comment #3
yhahn CreditAttribution: yhahn commentedI think your patch to CTools export.inc is the right solution but it needs work. Using
drupal_get_schema(NULL, TRUE)
on every call toctools_export_get_schemas()
is far too aggressive. You should usectools_static()
instead and add a CTools export cache clearing function similar toctools_export_load_object_reset()
.Comment #4
neochief CreditAttribution: neochief commentedI just came to the same issue in my installation profile, installed from Drush. If you install several features and one of them gets installed before Strongarm (who modifies the schema), you'll loose all of the features with variables exports until you manually revert features on site. This however breaks all the automation.
Comment #5
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted and pushed.