- 🇩🇪Germany eigentor
Since the patch from #25 is very old and does not apply anymore, here an updated patch for Features 7.x-2.15
When I'm reverting features via drush, it doesn't detect any overrides, despite the rules are shown as Overridden in UI at /admin/config/workflow/rules and I'm able to revert them correctly, but not at /admin/structure/features/my_rules.
The problem is with _features_sanitize()
function which sanitizing too much of code (e.g. weights).
$ drush -y fr my_rules
Current state already matches defaults, aborting.
So:
- /admin/structure/features/my_rules or drush -> Default
- /admin/config/workflow/rules -> Overridden
---
1. Checked this code:
<?php
module_load_include('inc', 'features', 'features.export');
$feature = feature_load('my_rules');
$overrides = features_detect_overrides($feature);
and $feature is listed correctly, but $overrides is empty. Tested by drush scr test.php
.
2. Further more printing states saying the rules_config is as FEATURES_DEFAULT (0), tested code:
$module_name = 'my_rules';
$states = features_get_component_states(array($module_name), FALSE);
3. I've checked the signatures (normal, default and cache), it gives the same MD5:
$module_name = 'my_rules';
$normal = features_get_signature('normal', $module_name, 'rules_config');
$default = features_get_signature('default', $module_name, 'rules_config');
$codecache = features_get_signature('cache', $module_name, 'rules_config', $reset);
var_dump($normal, $default, $codecache);
Tested by:
$ drush scr test.php
string(32) "2b5951031ccd9a8ff49f6f1eab5d567b"
string(32) "2b5951031ccd9a8ff49f6f1eab5d567b"
string(32) "2b5951031ccd9a8ff49f6f1eab5d567b"
When I've tested manually the default and normal objects, they're only differ when not sanitized, code:
module_load_include('inc', 'features', 'features.export');
$module_name = 'my_rules';
$def_objects = (array)features_get_default('rules_config', $module_name, TRUE);
$norm_objects = (array)features_get_normal('rules_config', $module_name);
// _features_sanitize($def_objects); // Does not work when sanitized (no difference).
// _features_sanitize($norm_objects); // Does not work when sanitized (no difference).
file_put_contents(__DIR__ . '/defaults.txt', features_var_export($def_objects));
file_put_contents(__DIR__ . '/normal.txt', features_var_export($norm_objects));
When enabled _features_sanitize()
, the code removes a lot of code (trimming 1.5M into 200K).
Using above code I've generated 4 files (defaults.nosan.txt, defaults.san.txt, normal.nosan.txt, normal.san.txt) depending on whether file was sanitized or not.
Sanitized code returned no differences (diff -u defaults.san.txt normal.san.txt
).
I've disabled sanitization, and I've found the following differences:
--- defaults.nosan.txt 2016-04-07 16:46:13.000000000 +0100
+++ normal.nosan.txt 2016-04-07 16:46:22.000000000 +0100
@@ -32,7 +32,7 @@
"form" : [ "form" ],
"form_state" : [ "form_state" ],
"element" : "radios:field_yes_or_no:und",
- "value" : "999",
+ "value" : "986",
"regex" : 0
}
}
@@ -209,7 +209,7 @@
{ "rules_forms_element_value" : {
"form" : [ "form" ],
"form_state" : [ "form_state" ],
- "element" : "radios:field_payment_type:und:0:value",
+ "element" : "radios:field_payment_type:und",
"value" : "2",
"regex" : 0
}
@@ -1946,7 +1946,7 @@
"form" : [ "form" ],
"form_state" : [ "form_state" ],
"element" : "radios:field_yes_or_no:und",
- "value" : "999",
+ "value" : "986",
"regex" : 0
}
},
@@ -5941,12 +5929,6 @@
},
{ "rules_forms_set_access" : {
"form" : [ "form" ],
- "element" : "foo_stepper:groups:group_additional_evidence",
- "access" : "1"
- }
- },
- { "rules_forms_set_access" : {
- "form" : [ "form" ],
"element" : "foo_stepper:groups:group_eligibility_assessment_org",
"access" : "1"
}
@@ -6057,12 +6039,6 @@
},
{ "rules_forms_set_access" : {
"form" : [ "form" ],
- "element" : "foo_stepper:groups:group_additional_evidence",
- "access" : "1"
- }
- },
- { "rules_forms_set_access" : {
- "form" : [ "form" ],
"element" : "foo_stepper:groups:group_eligibility_assessment_org",
"access" : "1"
}
...
// and a lot of more
So basically this rule:
'my_rules_apply_skip_permit_dates' => { "my_rules_apply_skip_permit_dates" : {
"LABEL" : "Apply for skip permit - dates",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "my_entityform_rules", "rules_forms" ],
"ON" : { "rules_forms_apply_skip_permit_entityform_edit_form_form_built" : [] },
"IF" : [
{ "my_entityform_element_compare_duration_value" : {
"form" : [ "form" ],
"form_state" : [ "form_state" ],
"element" : "date_combo:field_date1:und:0",
"element_2" : "date_combo:field_date_calendar:und:0",
"use_today" : "0",
"type" : "d",
"op" : "lt",
"value" : "0"
}
}
],
"DO" : []
}
},
becomes:
'my_rules_apply_skip_permit_dates' => array(
'dependencies' => array(
0 => 'my_entityform_rules',
1 => 'rules_forms',
),
'label' => 'Apply for skip permit - dates',
'name' => 'my_rules_apply_skip_permit_dates',
'owner' => 'rules',
),
So there is a lot of information missing from the object, such as weight, condition, etc.
Postponed
2.0
Features module integration
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Since the patch from #25 is very old and does not apply anymore, here an updated patch for Features 7.x-2.15