function webform_update_4 in Webform 5
Same name and namespace in other branches
- 5.2 webform.install \webform_update_4()
- 6.2 webform.install \webform_update_4()
File
- ./
webform.install, line 215
Code
function webform_update_4() {
$ret[] = update_sql("DROP TABLE if exists {webform_role_node}");
$ret[] = update_sql("ALTER TABLE {webform_submissions} ADD user varchar(128) AFTER submitted");
$ret[] = update_sql("ALTER TABLE {webform_submissions} ADD remote_addr varchar(128) AFTER user");
$ret[] = update_sql("ALTER TABLE {webform} ADD submit_limit int(2) NOT NULL DEFAULT '-1' AFTER redirect_post");
$ret[] = update_sql("ALTER TABLE {webform} ADD submit_interval int(10) NOT NULL DEFAULT '157784630' AFTER submit_limit");
// 5 years in seconds.
// Split 'maintain webforms' permissions into both 'edit webforms' and 'access webform results'.
$result = db_query("SELECT rid,perm FROM {permission}");
while ($row = db_fetch_object($result)) {
if (strpos($row->perm, "maintain webforms") !== false) {
$updated_perm = str_replace("maintain webforms", "edit webforms, access webform results", $row->perm);
db_query("UPDATE {permission} SET perm = '%s' WHERE rid = %d", $updated_perm, $row->rid);
}
}
return $ret;
}