Update dashboard app defaults

- Remove old dashboard data
- Add more comments
This commit is contained in:
markjcrane
2025-11-18 19:20:50 -07:00
parent bbe7b9e9b7
commit acbddb2a4d

View File

@@ -7,15 +7,17 @@ if ($domains_processed == 1) {
unset($array);
}
//migrate widget data
//get the new dashboard widgets
$sql = "select * from v_dashboard_widgets ";
$new_table = $database->select($sql, null, 'all');
unset($sql, $parameters);
//get the old dashboard
$sql = "select * from v_dashboard ";
$old_table = $database->select($sql, null, 'all');
unset($sql, $parameters);
//if the new table is empty then use the old table to populate the new table
if (empty($new_table) && !empty($old_table)) {
$sql = "INSERT INTO v_dashboard_widgets ( ";
$sql .= " dashboard_uuid, ";
@@ -99,16 +101,29 @@ if ($domains_processed == 1) {
$sql .= "FROM v_dashboard; ";
$database->execute($sql);
unset($sql, $parameters);
//get the new dashboard widgets
$sql = "select * from v_dashboard_widgets ";
$new_table = $database->select($sql, null, 'all');
unset($sql, $parameters);
}
//simplify the dashboard path
if (!empty($new_table)) {
$database->execute("delete from v_dashboard;");
}
//get the dashboard widget groups
$sql = "select * from v_dashboard_widget_groups ";
$new_groups = $database->select($sql, null, 'all');
unset($sql, $parameters);
//get the dashboard groups
$sql = "select * from v_dashboard_groups ";
$old_groups = $database->select($sql, null, 'all');
unset($sql, $parameters);
//use the dashboard groups to add data into the dashboard widget groups
if (empty($new_groups) && !empty($old_groups)) {
$sql = "INSERT INTO v_dashboard_widget_groups ( ";
$sql .= " dashboard_uuid, ";
@@ -185,7 +200,7 @@ if ($domains_processed == 1) {
$x++;
}
}
//exit;
//save the data
if (!empty($array)) {
$database->save($array, false);