Remove the 'v_' prefix when moving the provision variable to the default settings table.

This commit is contained in:
Mark Crane 2012-08-11 23:00:41 +00:00
parent 54e7708156
commit eaed58712e
1 changed files with 29 additions and 22 deletions

View File

@ -56,6 +56,13 @@
$prep_statement->execute(); $prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED); $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) { foreach ($result as &$row) {
//set the variable
$var_name = check_str($row['var_name']);
//remove the 'v_' prefix from the variable name
if (substr($var_name, 0, 2) == "v_") {
$var_name = substr($var_name, 2);
}
//add the provision variable to the default settings table
$sql = "insert into v_default_settings "; $sql = "insert into v_default_settings ";
$sql .= "("; $sql .= "(";
$sql .= "default_setting_uuid, "; $sql .= "default_setting_uuid, ";
@ -70,7 +77,7 @@
$sql .= "("; $sql .= "(";
$sql .= "'".uuid()."', "; $sql .= "'".uuid()."', ";
$sql .= "'provision', "; $sql .= "'provision', ";
$sql .= "'".check_str($row['var_name'])."', "; $sql .= "'".$var_name."', ";
$sql .= "'var', "; $sql .= "'var', ";
$sql .= "'".check_str($row['var_value'])."', "; $sql .= "'".check_str($row['var_value'])."', ";
$sql .= "'".check_str($row['var_enabled'])."', "; $sql .= "'".check_str($row['var_enabled'])."', ";