Skip to content
This repository was archived by the owner on Aug 14, 2023. It is now read-only.

Commit 799d445

Browse files
committed
Merge branch 'hotfix/update-features'
2 parents 86a7050 + aa53bbd commit 799d445

File tree

10 files changed

+47
-34
lines changed

10 files changed

+47
-34
lines changed

sites/all/modules/contrib/features/features.admin.inc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ function features_export_build_form_submit($form, &$form_state) {
871871
$feature = $form['#feature'];
872872
$export = _features_export_build($feature, $form_state);
873873
$export = _features_export_generate($export, $form_state, $feature);
874-
$generate = ($form_state['values']['op'] == $form_state['values']['generate']);
874+
$generate = isset($form_state['values']['generate']) && ($form_state['values']['op'] == $form_state['values']['generate']);
875875
$module_name = $form_state['values']['module_name'];
876876

877877
if ($generate && !user_access('generate features')) {
@@ -1628,9 +1628,9 @@ function _features_get_features_list() {
16281628

16291629
$cache = cache_get('features:features_list');
16301630
if ($cache) {
1631-
$features = $cache->data;
1631+
$features = $cache->data;
16321632
}
1633-
1633+
16341634
if (empty($features)) {
16351635
// Clear & rebuild key caches
16361636
features_get_info(NULL, NULL, TRUE);

sites/all/modules/contrib/features/features.drush.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ function drush_features_export() {
519519
drush_die('Aborting.');
520520
}
521521
$export = _drush_features_generate_export($items, $module);
522-
_features_populate($items, $export[info], $export[name]);
522+
_features_populate($items, $export['info'], $export['name']);
523523
_drush_features_export($export['info'], $module, $directory);
524524
}
525525
}

sites/all/modules/contrib/features/features.export.inc

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ function features_export_render($export, $module_name, $reset = FALSE) {
315315
$code = array_filter($code);
316316
foreach ($code as $filename => $contents) {
317317
if ($filename != '_files') {
318-
$code[$filename] = "<?php\n/**\n * @file\n * {$module_name}.{$filename}.inc\n */\n\n". implode("\n\n", $contents) ."\n";
318+
$code[$filename] = "<?php\n\n/**\n * @file\n * {$module_name}.{$filename}.inc\n */\n\n". implode("\n\n", $contents) ."\n";
319319
}
320320
}
321321

@@ -332,8 +332,8 @@ function features_export_render($export, $module_name, $reset = FALSE) {
332332
$code['info'] = features_export_info($export);
333333

334334
// Used to create or manipulate the generated .module for features.inc.
335-
$modulefile_features_inc = "<?php\n/**\n * @file\n * Code for the {$export['name']} feature.\n */\n\ninclude_once '{$module_name}.features.inc';\n";
336-
$modulefile_blank = "<?php\n/**\n * @file\n * Drupal needs this blank file.\n */\n";
335+
$modulefile_features_inc = "<?php\n\n/**\n * @file\n * Code for the {$export['name']} feature.\n */\n\ninclude_once '{$module_name}.features.inc';\n";
336+
$modulefile_blank = "<?php\n\n/**\n * @file\n * Drupal needs this blank file.\n */\n";
337337

338338
// Prepare the module
339339
// If module exists, let it be and include it in the files
@@ -1088,13 +1088,6 @@ function _features_is_assoc($array) {
10881088
* returns a copy of the object or array with recursion removed
10891089
*/
10901090
function features_remove_recursion($o) {
1091-
static $replace;
1092-
if (!isset($replace)) {
1093-
$replace = create_function(
1094-
'$m',
1095-
'$r="\x00{$m[1]}ecursion_features";return \'s:\'.strlen($r.$m[2]).\':"\'.$r.$m[2].\'";\';'
1096-
);
1097-
}
10981091
if (is_array($o) || is_object($o)) {
10991092
$re = '#(r|R):([0-9]+);#';
11001093
$serialize = serialize($o);
@@ -1104,7 +1097,7 @@ function features_remove_recursion($o) {
11041097
$chunk = substr($serialize, $last, $pos - $last);
11051098
if (preg_match($re, $chunk)) {
11061099
$length = strlen($chunk);
1107-
$chunk = preg_replace_callback($re, $replace, $chunk);
1100+
$chunk = preg_replace_callback($re, '_features_remove_recursion', $chunk);
11081101
$serialize = substr($serialize, 0, $last) . $chunk . substr($serialize, $last + ($pos - $last));
11091102
$pos += strlen($chunk) - $length;
11101103
}
@@ -1114,13 +1107,21 @@ function features_remove_recursion($o) {
11141107
$last += 4 + $length;
11151108
$pos = $last;
11161109
}
1117-
$serialize = substr($serialize, 0, $last) . preg_replace_callback($re, $replace, substr($serialize, $last));
1110+
$serialize = substr($serialize, 0, $last) . preg_replace_callback($re, '_features_remove_recursion', substr($serialize, $last));
11181111
$o = unserialize($serialize);
11191112
}
11201113
}
11211114
return $o;
11221115
}
11231116

1117+
/**
1118+
* Callback function for preg_replace_callback() to remove recursion.
1119+
*/
1120+
function _features_remove_recursion($m) {
1121+
$r = "\x00{$m[1]}ecursion_features";
1122+
return 's:' . strlen($r . $m[2]) . ':"' . $r . $m[2] . '";';
1123+
}
1124+
11241125
/**
11251126
* Helper to removes a set of keys an object/array.
11261127
*

sites/all/modules/contrib/features/features.info

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ test_dependencies[] = views
1010

1111
configure = admin/structure/features/settings
1212

13-
; Information added by Drupal.org packaging script on 2016-04-18
14-
version = "7.x-2.10"
13+
; Information added by Drupal.org packaging script on 2018-11-01
14+
version = "7.x-2.11"
1515
core = "7.x"
1616
project = "features"
17-
datestamp = "1461011641"
18-
17+
datestamp = "1541050686"

sites/all/modules/contrib/features/features.module

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,6 +503,7 @@ function features_load_feature($name, $reset = FALSE) {
503503
$features[$name]->name = $name;
504504
$features[$name]->filename = drupal_get_path('module', $name) . '/' . $name . '.module';
505505
$features[$name]->type = 'module';
506+
$features[$name]->status = module_exists($name);
506507
$features[$name]->info = $info + $defaults;
507508
}
508509
}

sites/all/modules/contrib/features/includes/features.field.inc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function field_base_features_rebuild($module) {
274274
// Create or update field.
275275
if (isset($existing_fields[$field['field_name']])) {
276276
$existing_field = $existing_fields[$field['field_name']];
277-
$array_diff_result = drupal_array_diff_assoc_recursive($field + $existing_field, $existing_field);
277+
$array_diff_result = features_array_diff_assoc_recursive($field + $existing_field, $existing_field);
278278
if (!empty($array_diff_result)) {
279279
try {
280280
field_update_field($field);
@@ -319,7 +319,7 @@ function field_instance_features_rebuild($module) {
319319
// Create or update field instance.
320320
if (isset($existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']])) {
321321
$existing_instance = $existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']];
322-
if ($field_instance + $existing_instance !== $existing_instance) {
322+
if ($field_instance + $existing_instance != $existing_instance) {
323323
try {
324324
field_update_instance($field_instance);
325325
}
@@ -494,7 +494,7 @@ function field_features_rebuild($module) {
494494
$field_config = $field['field_config'];
495495
if (isset($existing_fields[$field_config['field_name']])) {
496496
$existing_field = $existing_fields[$field_config['field_name']];
497-
$array_diff_result = drupal_array_diff_assoc_recursive($field_config + $existing_field, $existing_field);
497+
$array_diff_result = features_array_diff_assoc_recursive($field_config + $existing_field, $existing_field);
498498
if (!empty($array_diff_result)) {
499499
try {
500500
field_update_field($field_config);
@@ -518,7 +518,7 @@ function field_features_rebuild($module) {
518518
$field_instance = $field['field_instance'];
519519
if (isset($existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']])) {
520520
$existing_instance = $existing_instances[$field_instance['entity_type']][$field_instance['bundle']][$field_instance['field_name']];
521-
if ($field_instance + $existing_instance !== $existing_instance) {
521+
if ($field_instance + $existing_instance != $existing_instance) {
522522
field_update_instance($field_instance);
523523
}
524524
}

sites/all/modules/contrib/features/includes/features.image.inc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,17 @@ function image_features_export_render($module_name, $data, $export = NULL) {
7373
*/
7474
function image_features_revert($module) {
7575
if ($default_styles = features_get_default('image', $module)) {
76-
foreach (array_keys($default_styles) as $default_style) {
77-
if ($style = image_style_load($default_style)) {
76+
foreach ($default_styles as $default_style_name => $default_style) {
77+
if ($style = image_style_load($default_style_name)) {
7878
if ($style['storage'] != IMAGE_STORAGE_DEFAULT) {
7979
image_default_style_revert($style);
8080
}
81+
else {
82+
// Verify that the loaded style still matches what's in code.
83+
if ($default_style['effects'] !== $style['effects']) {
84+
image_default_style_revert($style);
85+
}
86+
}
8187
}
8288
}
8389
}

sites/all/modules/contrib/features/includes/features.menu.inc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -420,8 +420,12 @@ function features_menu_link_load($identifier) {
420420
* Returns a lowercase clean string with only letters, numbers and dashes
421421
*/
422422
function features_clean_title($str) {
423-
return strtolower(preg_replace_callback('/(\s)|([^a-zA-Z\-0-9])/i', create_function(
424-
'$matches',
425-
'return $matches[1]?"-":"";'
426-
), $str));
423+
return strtolower(preg_replace_callback('/(\s)|([^a-zA-Z\-0-9])/i', '_features_clean_title', $str));
424+
}
425+
426+
/**
427+
* Callback function for preg_replace_callback() to clean a string.
428+
*/
429+
function _features_clean_title($matches) {
430+
return $matches[1] ? '-' : '';
427431
}

sites/all/modules/contrib/features/tests/features.test

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ class FeaturesUserTestCase extends DrupalWebTestCase {
1414
'name' => t('Component tests'),
1515
'description' => t('Run tests for components of Features.') ,
1616
'group' => t('Features'),
17+
'dependencies' => array('views', 'strongarm'),
1718
);
1819
}
1920

@@ -182,6 +183,7 @@ class FeaturesEnableTestCase extends DrupalWebTestCase {
182183
'name' => t('Features enable tests'),
183184
'description' => t('Run tests for enabling of features.') ,
184185
'group' => t('Features'),
186+
'dependencies' => array('views', 'strongarm'),
185187
);
186188
}
187189

@@ -231,6 +233,7 @@ class FeaturesCtoolsIntegrationTest extends DrupalWebTestCase {
231233
'name' => t('Features Chaos Tools integration'),
232234
'description' => t('Run tests for ctool integration of features.') ,
233235
'group' => t('Features'),
236+
'dependencies' => array('views', 'strongarm'),
234237
);
235238
}
236239

sites/all/modules/contrib/features/tests/features_test/features_test.info

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ features[user_permission][] = create features_test content
2121
features[views_view][] = features_test
2222
hidden = 1
2323

24-
; Information added by Drupal.org packaging script on 2016-04-18
25-
version = "7.x-2.10"
24+
; Information added by Drupal.org packaging script on 2018-11-01
25+
version = "7.x-2.11"
2626
core = "7.x"
2727
project = "features"
28-
datestamp = "1461011641"
29-
28+
datestamp = "1541050686"

0 commit comments

Comments
 (0)