You are here

function webform_validation_update_1 in Webform Validation 6

Same name and namespace in other branches
  1. 7 webform_validation.install \webform_validation_update_1()

Implementation of hook_update_X().

File

./webform_validation.install, line 101
webform_validation installation file

Code

function webform_validation_update_1() {
  $ret = array();
  $has_numeric_validator = FALSE;
  $result = db_query("SELECT ruleid, data FROM {webform_validation_rule} WHERE validator = 'numeric'");
  while ($row = db_fetch_object($result)) {
    $has_numeric_validator = TRUE;
    $range = $row->data;
    $range = _webform_validation_update_range_syntax($range);
    db_query("UPDATE {webform_validation_rule} SET data = '%s' WHERE ruleid = %d", $range, $row->ruleid);
  }
  if ($has_numeric_validator) {
    $warning_message = t('IMPORTANT: the numeric validation rule range syntax has changed with this release. Existing numeric validation rules were found and updated. Please verify that they still work as expected!');
    drupal_set_message($warning_message, 'warning');
  }
  return $ret;
}