function webform_validation_update_1 in Webform Validation 7
Same name and namespace in other branches
- 6 webform_validation.install \webform_validation_update_1()
Update numeric validator range to new syntax.
File
- ./
webform_validation.install, line 104 - 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'");
foreach ($result as $row) {
$has_numeric_validator = TRUE;
$range = $row->data;
$range = _webform_validation_update_range_syntax($range);
db_update('webform_validation_rule')
->fields(array(
'data' => $range,
))
->condition('ruleid', $row->ruleid, '=')
->execute();
}
if ($has_numeric_validator) {
drupal_set_message(t('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!'), 'warning');
}
return $ret;
}