You are here

function configuration_drupal_execute in Configuration Management 6

Do the actual drupal execute on an action

1 call to configuration_drupal_execute()
configuration_process_action in ./configuration.module
Execute a single action

File

./configuration.module, line 1020
Provide a unified method for defining site configurations abstracted from their data format. Various data formats should be supported via a plugin architecture such as XML, YAML, JSON, PHP

Code

function configuration_drupal_execute($form_id, &$form_state, $params) {

  // Make sure we always have a clear cache for everything
  $result = db_query('SHOW TABLES LIKE "cache_%"');
  while ($table = db_fetch_array($result)) {
    $table = current($table);
    cache_clear_all(null, $table);
  }

  // Perform direct and automatic manipulation of the configuration data
  // from the default fapi form object
  configuration_sync_data_form($form_state['values'], $form_id, $form_state, $params);
  $args = array(
    $form_id,
    &$form_state,
  );
  if (is_array($params)) {
    $args = array_merge($args, $params);
  }
  configuration_set_data('executing', true);

  // If we are in batch mode, trick the form api to think
  // otherwise to avoid potential problems
  $batch =& batch_get();
  $batch_clone = $batch;
  $batch = null;

  // drupal_execute fails to keep $form_state in-sync through the
  // whole FAPI process. Issue http://drupal.org/node/346244

  //$return = call_user_func_array('drupal_execute', $args);

  // Copy of drupal_execute until above issue is fixed
  $form = call_user_func_array('drupal_retrieve_form', $args);
  $form['#post'] = $form_state['values'];
  drupal_prepare_form($form_id, $form, $form_state);

  // If you call drupal_validate_form() on the same form more
  // than once per page request, validation is not performed
  // on any but the first call.
  // see issue: http://drupal.org/node/260934
  // drupal_process_form($form_id, $form, $form_state);
  // Until above issue is fixed we use our own implementation
  // of drupal_process_form() and drupal_validate_form().
  _configuration_process_form($form_id, $form, $form_state);
  configuration_set_data('executing', true);
  $batch = $batch_clone;
}