You are here

function _migrate_settings_form_submit in Migrate 6

File

./migrate_pages.inc, line 897

Code

function _migrate_settings_form_submit($form, &$form_state) {
  $values = $form_state['values'];
  variable_set('migrate_display_timers', $values['display_timers']);
  variable_set('migrate_hide_help_message', $values['hide_help_message']);
  $original_cache = variable_get('migrate_cache_counts', 0);
  variable_set('migrate_cache_counts', $values['cache_counts']);
  variable_set('migrate_integration_settings', $values['integrations']);
  if (isset($values['refresh_counts']) || $values['cache_counts'] && !$original_cache) {
    $sql = "SELECT mcsid,view_name,view_args FROM {migrate_content_sets}";
    $result = db_query($sql);
    while ($row = db_fetch_object($result)) {
      $rowcount = _migrate_get_view_count($row->view_name, $row->view_args);
      $sql = "UPDATE {migrate_content_sets}\n              SET rowcount=%d WHERE mcsid=%d";
      db_query($sql, $rowcount, $row->mcsid);
    }
    if ($values['refresh_counts']) {
      drupal_set_message(t('Content set counts refreshed'));
    }
    else {
      drupal_set_message(t('Content set counts saved'));
    }
  }
  drupal_set_message(t('Settings saved'));
}