You are here

function feedback_update_2 in Feedback 5

File

./feedback.install, line 46

Code

function feedback_update_2() {
  global $conf;
  $defaults = array();
  $defaults['email'] = variable_get('feedback_email', variable_get('site_mail', ini_get('sendmail_from')));
  $defaults['title'] = variable_get('feedback_nav_link', t('feedback'));
  $defaults['instructions'] = variable_get('feedback_instructions', '');
  $defaults['subject_prefix'] = variable_get('feedback_subject_prefix', '');
  $defaults["field_subject"] = variable_get('feedback_field_subject', '1');
  $defaults["field_name"] = variable_get('feedback_field_name', '1');
  $defaults["field_postal"] = variable_get('feedback_field_postal', '0');
  $defaults["field_phone"] = variable_get('feedback_field_phone', '0');
  $defaults["field_body"] = variable_get('feedback_field_body', '1');
  $defaults["logging"] = variable_get('feedback_logging', '1');
  $defaults['hourly_threshold'] = 3;
  $result = db_query("UPDATE {feedback_pages} SET data = '%s' WHERE name = '%s'", serialize($defaults), 'default');
  if ($result) {

    //clear old unused variables
    foreach ($conf as $key => $variable) {
      if (strpos($key, 'feedback') === 0) {
        variable_del($key);
      }
    }
  }
  else {
    drupal_set_message('Failed to transfer old feedback configuration to new feedback configuration table', 'error');
  }
  return array();
}