non security modules update
This commit is contained in:
@@ -151,7 +151,7 @@ function field_base_features_export_render($module, $data, $export = NULL) {
|
||||
foreach ($data as $identifier) {
|
||||
if ($field = features_field_base_load($identifier)) {
|
||||
unset($field['columns']);
|
||||
// unset($field['locked']);
|
||||
unset($field['foreign keys']);
|
||||
// Only remove the 'storage' declaration if the field is using the default
|
||||
// storage type.
|
||||
if ($field['storage']['type'] == variable_get('field_storage_default', 'field_sql_storage')) {
|
||||
@@ -166,8 +166,15 @@ function field_base_features_export_render($module, $data, $export = NULL) {
|
||||
|
||||
_field_instance_features_export_sort($field);
|
||||
$field_export = features_var_export($field, ' ');
|
||||
$field_prefix = ' // Exported field_base: ';
|
||||
$field_identifier = features_var_export($identifier);
|
||||
$code[] = " // Exported field_base: {$field_identifier}";
|
||||
if (features_field_export_needs_wrap($field_prefix, $field_identifier)) {
|
||||
$code[] = rtrim($field_prefix);
|
||||
$code[] = " // {$field_identifier}";
|
||||
}
|
||||
else {
|
||||
$code[] = $field_prefix . $field_identifier;
|
||||
}
|
||||
$code[] = " \$field_bases[{$field_identifier}] = {$field_export};";
|
||||
$code[] = "";
|
||||
}
|
||||
@@ -190,8 +197,15 @@ function field_instance_features_export_render($module, $data, $export = NULL) {
|
||||
if ($instance = features_field_instance_load($identifier)) {
|
||||
_field_instance_features_export_sort($instance);
|
||||
$field_export = features_var_export($instance, ' ');
|
||||
$instance_prefix = ' // Exported field_instance: ';
|
||||
$instance_identifier = features_var_export($identifier);
|
||||
$code[] = " // Exported field_instance: {$instance_identifier}";
|
||||
if (features_field_export_needs_wrap($instance_prefix, $instance_identifier)) {
|
||||
$code[] = rtrim($instance_prefix);
|
||||
$code[] = " // {$instance_identifier}";
|
||||
}
|
||||
else {
|
||||
$code[] = $instance_prefix . $instance_identifier;
|
||||
}
|
||||
$code[] = " \$field_instances[{$instance_identifier}] = {$field_export};";
|
||||
$code[] = "";
|
||||
|
||||
@@ -528,3 +542,23 @@ function features_field_load($identifier) {
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if a field export line needs to be wrapped.
|
||||
*
|
||||
* Drupal code standards specify that comments should wrap at 80 characters or
|
||||
* less.
|
||||
*
|
||||
* @param string $prefix
|
||||
* The prefix to be exported before the field identifier.
|
||||
* @param string $identifier
|
||||
* The field identifier.
|
||||
*
|
||||
* @return BOOL
|
||||
* TRUE if the line should be wrapped after the prefix, else FALSE.
|
||||
*
|
||||
* @see https://www.drupal.org/node/1354
|
||||
*/
|
||||
function features_field_export_needs_wrap($prefix, $identifier) {
|
||||
return (strlen($prefix) + strlen($identifier) > 80);
|
||||
}
|
||||
|
@@ -86,16 +86,25 @@ function image_features_revert($module) {
|
||||
/**
|
||||
* Remove unnecessary keys for export.
|
||||
*/
|
||||
function _image_features_style_sanitize(&$style, $child = FALSE) {
|
||||
$omit = $child ? array('isid', 'ieid', 'storage') : array('isid', 'ieid', 'storage', 'module');
|
||||
if (is_array($style)) {
|
||||
foreach ($style as $k => $v) {
|
||||
if (in_array($k, $omit, TRUE)) {
|
||||
unset($style[$k]);
|
||||
}
|
||||
else if (is_array($v)) {
|
||||
_image_features_style_sanitize($style[$k], TRUE);
|
||||
}
|
||||
}
|
||||
function _image_features_style_sanitize(array &$style) {
|
||||
// Sanitize style: Don't export numeric IDs and things which get overwritten
|
||||
// in image_styles() or are code/storage specific. The name property will be
|
||||
// the key of the exported $style array.
|
||||
$style = array_diff_key($style, array_flip(array(
|
||||
'isid',
|
||||
'name',
|
||||
'module',
|
||||
'storage',
|
||||
)));
|
||||
|
||||
// Sanitize effects: all that needs to be kept is name, weight and data,
|
||||
// which holds all the style-specific configuration. Other keys are assumed
|
||||
// to belong to the definition of the effect itself, so not configuration.
|
||||
foreach ($style['effects'] as $id => $effect) {
|
||||
$style['effects'][$id] = array_intersect_key($effect, array_flip(array(
|
||||
'name',
|
||||
'data',
|
||||
'weight',
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
@@ -134,6 +134,7 @@ function _features_language_save($language) {
|
||||
->fields(array(
|
||||
'plurals' => empty($language->plurals) ? 0 : $language->plurals,
|
||||
'formula' => empty($language->formula) ? '' : $language->formula,
|
||||
'weight' => empty($language->weight) ? 0 : $language->weight,
|
||||
))
|
||||
->condition('language', $language->language)
|
||||
->execute();
|
||||
|
@@ -241,7 +241,8 @@ function menu_links_features_export_render($module, $data, $export = NULL) {
|
||||
// Don't show new identifier unless we are actually exporting.
|
||||
$link['options']['identifier'] = $new_identifier;
|
||||
// identifiers are renewed, => that means we need to update them in the db
|
||||
menu_link_save($temp = $link);
|
||||
$temp = $link;
|
||||
menu_link_save($temp);
|
||||
}
|
||||
|
||||
unset($link['plid']);
|
||||
@@ -295,19 +296,27 @@ function menu_links_features_rebuild_ordered($menu_links, $reset = FALSE) {
|
||||
foreach ($unordered as $key => $link) {
|
||||
$identifier = menu_links_features_identifier($link);
|
||||
$parent = isset($link['parent_identifier']) ? $link['parent_identifier'] : '';
|
||||
if (empty($parent)) {
|
||||
$ordered[$identifier] = 0;
|
||||
$all_links[$identifier] = $link;
|
||||
unset($unordered[$key]);
|
||||
$weight = 0;
|
||||
// Parent has been seen, so weigh this above parent.
|
||||
if (isset($ordered[$parent])) {
|
||||
$weight = $ordered[$parent] + 1;
|
||||
}
|
||||
elseif (isset($ordered[$parent])) {
|
||||
$ordered[$identifier] = $ordered[$parent] + 1;
|
||||
$all_links[$identifier] = $link;
|
||||
unset($unordered[$key]);
|
||||
// Next loop will try to find parent weight instead.
|
||||
elseif ($parent) {
|
||||
continue;
|
||||
}
|
||||
$ordered[$identifier] = $weight;
|
||||
$all_links[$identifier] = $link;
|
||||
unset($unordered[$key]);
|
||||
}
|
||||
// Exit out when the above does no changes this loop.
|
||||
} while (count($unordered) < $current);
|
||||
}
|
||||
// Add all remaining unordered items to the ordered list.
|
||||
foreach ($unordered as $link) {
|
||||
$identifier = menu_links_features_identifier($link);
|
||||
$ordered[$identifier] = 0;
|
||||
}
|
||||
asort($ordered);
|
||||
}
|
||||
|
||||
@@ -356,10 +365,11 @@ function features_menu_link_load($identifier) {
|
||||
list($menu_name, $link_path) = explode(':', $identifier, 2);
|
||||
}
|
||||
$links = db_select('menu_links')
|
||||
->fields('menu_links', array('menu_name', 'mlid', 'plid', 'link_path', 'router_path', 'link_title', 'options', 'module', 'hidden', 'external', 'has_children', 'expanded', 'weight', 'customized'))
|
||||
->condition('menu_name', $menu_name)
|
||||
->condition('link_path', $link_path)
|
||||
->execute()
|
||||
->fields('menu_links', array('menu_name', 'mlid', 'plid', 'link_path', 'router_path', 'link_title', 'options', 'module', 'hidden', 'external', 'has_children', 'expanded', 'weight', 'customized'))
|
||||
->condition('menu_name', $menu_name)
|
||||
->condition('link_path', $link_path)
|
||||
->addTag('features_menu_link')
|
||||
->execute()
|
||||
->fetchAllAssoc('mlid');
|
||||
|
||||
foreach($links as $link) {
|
||||
@@ -391,11 +401,14 @@ function features_menu_link_load($identifier) {
|
||||
|
||||
foreach($links as $link) {
|
||||
$link->options = unserialize($link->options);
|
||||
|
||||
// title or previous identifier matches
|
||||
if ((isset($link->options['identifier']) && strcmp($link->options['identifier'], $identifier) == 0)
|
||||
|| (isset($clean_title) && strcmp(features_clean_title($link->link_title), $clean_title) == 0)) {
|
||||
|
||||
// Links with a stored identifier must only be matched on that identifier,
|
||||
// to prevent cross over assumptions.
|
||||
if (isset($link->options['identifier'])) {
|
||||
if (strcmp($link->options['identifier'], $identifier) == 0) {
|
||||
return (array)$link;
|
||||
}
|
||||
}
|
||||
elseif ((strcmp(features_clean_title($link->link_title), $clean_title) == 0)) {
|
||||
return (array)$link;
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ function node_features_api() {
|
||||
'name' => t('Content types'),
|
||||
'feature_source' => TRUE,
|
||||
'default_hook' => 'node_info',
|
||||
'alter_type' => FEATURES_ALTER_TYPE_INLINE,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -86,6 +87,7 @@ function node_features_export_render($module, $data, $export = NULL) {
|
||||
}
|
||||
}
|
||||
$output[] = ' );';
|
||||
$output[] = ' drupal_alter(\'node_info\', $items);';
|
||||
$output[] = ' return $items;';
|
||||
$output = implode("\n", $output);
|
||||
return array('node_info' => $output);
|
||||
@@ -115,7 +117,7 @@ function node_features_revert($module = NULL) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_features_disable().
|
||||
* Implements hook_features_disable_feature().
|
||||
*
|
||||
* When a features module is disabled, modify any node types it provides so
|
||||
* they can be deleted manually through the content types UI.
|
||||
@@ -123,7 +125,7 @@ function node_features_revert($module = NULL) {
|
||||
* @param $module
|
||||
* Name of module that has been disabled.
|
||||
*/
|
||||
function node_features_disable($module) {
|
||||
function node_features_disable_feature($module) {
|
||||
if ($default_types = features_get_default('node', $module)) {
|
||||
foreach ($default_types as $type_name => $type_info) {
|
||||
$type_info = node_type_load($type_name);
|
||||
@@ -131,13 +133,14 @@ function node_features_disable($module) {
|
||||
$type_info->custom = 1;
|
||||
$type_info->modified = 1;
|
||||
$type_info->locked = 0;
|
||||
$type_info->disabled = 0;
|
||||
node_type_save($type_info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements hook_features_enable().
|
||||
* Implements hook_features_enable_feature().
|
||||
*
|
||||
* When a features module is enabled, modify any node types it provides so
|
||||
* they can no longer be deleted manually through the content types UI.
|
||||
@@ -145,7 +148,7 @@ function node_features_disable($module) {
|
||||
* @param $module
|
||||
* Name of module that has been enabled.
|
||||
*/
|
||||
function node_features_enable($module) {
|
||||
function node_features_enable_feature($module) {
|
||||
if ($default_types = features_get_default('node', $module)) {
|
||||
foreach ($default_types as $type_name => $type_info) {
|
||||
// Ensure the type exists.
|
||||
@@ -154,6 +157,7 @@ function node_features_enable($module) {
|
||||
$type_info->custom = 0;
|
||||
$type_info->modified = 0;
|
||||
$type_info->locked = 1;
|
||||
$type_info->disabled = 0;
|
||||
node_type_save($type_info);
|
||||
}
|
||||
}
|
||||
|
@@ -50,12 +50,12 @@ function user_permission_features_export_options() {
|
||||
$modules = array();
|
||||
$module_info = system_get_info('module');
|
||||
foreach (module_implements('permission') as $module) {
|
||||
$modules[$module_info[$module]['name']] = $module;
|
||||
$modules[$module] = $module_info[$module]['name'];
|
||||
}
|
||||
ksort($modules);
|
||||
|
||||
$options = array();
|
||||
foreach ($modules as $display_name => $module) {
|
||||
foreach ($modules as $module => $display_name) {
|
||||
if ($permissions = module_invoke($module, 'permission')) {
|
||||
foreach ($permissions as $perm => $perm_item) {
|
||||
// Export vocabulary permissions using the machine name, instead of
|
||||
|
Reference in New Issue
Block a user