Update app_defaults.php
This commit is contained in:
parent
6f0c466a36
commit
d61e1444ce
|
|
@ -28,72 +28,6 @@
|
||||||
//process this code online once
|
//process this code online once
|
||||||
if ($domains_processed == 1) {
|
if ($domains_processed == 1) {
|
||||||
|
|
||||||
//define array of settings
|
}
|
||||||
$x = 0;
|
|
||||||
$array[$x]['default_setting_uuid'] = 'e13895b7-ef2f-43ed-8d2a-e739ccffccc2';
|
|
||||||
$array[$x]['default_setting_category'] = 'provision';
|
|
||||||
$array[$x]['default_setting_subcategory'] = 'tftp_service_address';
|
|
||||||
$array[$x]['default_setting_name'] = 'text';
|
|
||||||
$array[$x]['default_setting_value'] = '0.0.0.0';
|
|
||||||
$array[$x]['default_setting_enabled'] = 'true';
|
|
||||||
$array[$x]['default_setting_description'] = 'the address for the TFTP service to listen for connection on';
|
|
||||||
$x++;
|
|
||||||
$array[$x]['default_setting_uuid'] = '3fe87ea5-9633-4af0-bb5c-a61dbba2772c';
|
|
||||||
$array[$x]['default_setting_category'] = 'provision';
|
|
||||||
$array[$x]['default_setting_subcategory'] = 'tftp_service_port';
|
|
||||||
$array[$x]['default_setting_name'] = 'numeric';
|
|
||||||
$array[$x]['default_setting_value'] = '69';
|
|
||||||
$array[$x]['default_setting_enabled'] = 'true';
|
|
||||||
$array[$x]['default_setting_description'] = 'the port for the TFTP service to listen for connection on';
|
|
||||||
$x++;
|
|
||||||
$array[$x]['default_setting_uuid'] = '5e21c189-ac27-42aa-acaf-57c8cdcbbcef';
|
|
||||||
$array[$x]['default_setting_category'] = 'provision';
|
|
||||||
$array[$x]['default_setting_subcategory'] = 'tftp_service_file_path';
|
|
||||||
$array[$x]['default_setting_name'] = 'numeric';
|
|
||||||
$array[$x]['default_setting_value'] = '/tmp';
|
|
||||||
$array[$x]['default_setting_enabled'] = 'true';
|
|
||||||
$array[$x]['default_setting_description'] = 'the location for static files e.g. firmware';
|
|
||||||
|
|
||||||
//get an array of the default settings
|
|
||||||
$sql = "SELECT * FROM v_default_settings ";
|
|
||||||
$sql .= "WHERE default_setting_category = 'provision' AND default_setting_subcategory LIKE 'tftp_service_%'";
|
|
||||||
$prep_statement = $db->prepare($sql);
|
|
||||||
$prep_statement->execute();
|
|
||||||
$default_settings = $prep_statement->fetchAll(PDO::FETCH_NAMED);
|
|
||||||
unset ($prep_statement, $sql);
|
|
||||||
|
|
||||||
//find the missing default settings
|
|
||||||
$x = 0;
|
|
||||||
foreach ($array as $setting) {
|
|
||||||
$found = false;
|
|
||||||
$missing[$x] = $setting;
|
|
||||||
foreach ($default_settings as $row) {
|
|
||||||
if (trim($row['default_setting_subcategory']) == trim($setting['default_setting_subcategory'])) {
|
|
||||||
$found = true;
|
|
||||||
//remove items from the array that were found
|
|
||||||
unset($missing[$x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$x++;
|
|
||||||
}
|
|
||||||
unset($array);
|
|
||||||
|
|
||||||
//update the array structure
|
|
||||||
if (is_array($missing)) {
|
|
||||||
$array['default_settings'] = $missing;
|
|
||||||
unset($missing);
|
|
||||||
}
|
|
||||||
|
|
||||||
//add the default settings
|
|
||||||
if (is_array($array)) {
|
|
||||||
$database = new database;
|
|
||||||
$database->app_name = 'default_settings';
|
|
||||||
$database->app_uuid = '2c2453c0-1bea-4475-9f44-4d969650de09';
|
|
||||||
$database->save($array);
|
|
||||||
$message = $database->message;
|
|
||||||
unset($database);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue