updated features

This commit is contained in:
Bachir Soussi Chiadmi
2016-04-19 16:32:54 +02:00
parent fb0666538c
commit e2fde76aff
13 changed files with 295 additions and 190 deletions

View File

@@ -88,6 +88,12 @@ function features_settings_form($form, $form_state) {
'#default_value' => variable_get('features_rebuild_on_flush', TRUE),
'#description' => t('If you have a large site with many features, you may experience lag on full cache clear. If disabled, features will rebuild only when viewing the features list or saving the modules list.'),
);
$form['general']['features_rebuild_modules_page'] = array(
'#type' => 'checkbox',
'#title' => t('Rebuild features on accessing modules list page'),
'#default_value' => variable_get('features_rebuild_modules_page', FALSE),
'#description' => t('If you have a large site with many features, you may experience lag on accessing the modules administration page. If disabled, features will not rebuild when viewing the modules list.'),
);
return system_settings_form($form);
}
@@ -109,7 +115,7 @@ function features_export_form($form, $form_state, $feature = NULL) {
$feature_name = !empty($feature->name) ? $feature->name : '';
$form = array(
'#attributes' => array('class' => array('features-export-form')),
'#attributes' => array('class' => array('features-export-form', 'clearfix')),
'#feature' => isset($feature) ? $feature : NULL,
);
$form['info'] = array(
@@ -756,7 +762,7 @@ function features_export_form_rebuild($form, &$form_state) {
function features_export_components_json($feature_name) {
module_load_include('inc', 'features', 'features.export');
$export = array();
$export = array('features' => array());
if (!empty($_POST['items'])) {
$excluded = (!empty($_POST['excluded'])) ? $_POST['excluded'] : array();
$stub = array();
@@ -1143,7 +1149,7 @@ function features_admin_form($form, $form_state) {
// As of 7.0 beta 2 it matters where the "vertical_tabs" element lives on the
// the array. We add it late, but at the beginning of the array because that
// keeps us away from trouble.
$form = array('packages' => array('#type' => 'vertical_tabs')) + $form;
$form = array_merge(array('packages' => array('#type' => 'vertical_tabs')), $form);
$form['buttons'] = array(
'#theme' => 'features_form_buttons',
@@ -1328,7 +1334,7 @@ function features_form_submit(&$form, &$form_state) {
// page callback rather than as part of the submit handler as some modules
// have includes/other directives of importance in hooks that have already
// been called in this page load.
$form_state['redirect'] = 'admin/structure/features/cleanup/clear';
$form_state['redirect'] = array('admin/structure/features/cleanup', array('query' => array('token' => drupal_get_token())));
$features = $form['#features'];
if (!empty($features)) {
@@ -1352,21 +1358,19 @@ function features_form_rebuild() {
}
/**
* Form for clearing cache after enabling a feature.
* Callback for clearing cache after enabling a feature.
*/
function features_cleanup_form($form, $form_state, $cache_clear = FALSE) {
// Clear caches if we're getting a post-submit redirect that requests it.
if ($cache_clear) {
function features_cleanup() {
if (!empty($_GET['token']) && drupal_valid_token($_GET['token'])) {
drupal_flush_all_caches();
// The following functions need to be run because drupal_flush_all_caches()
// runs rebuilds in the wrong order. The node type cache is rebuilt *after*
// the menu is rebuilt, meaning that the menu tree is stale in certain
// circumstances after drupal_flush_all_caches(). We rebuild again.
menu_rebuild();
}
drupal_goto('admin/structure/features');
}
return MENU_NOT_FOUND;
}
/**