Remove sub table data if it doesn't have more details than domain_uuid an device_uuid.
This commit is contained in:
@@ -361,6 +361,35 @@
|
|||||||
//process a chunk of the array
|
//process a chunk of the array
|
||||||
if ($row_id === 1000) {
|
if ($row_id === 1000) {
|
||||||
|
|
||||||
|
//remove sub table data if it doesn't have more details than domain_uuid an device_uuid
|
||||||
|
$x = 0;
|
||||||
|
foreach ($array['devices'] as $row) {
|
||||||
|
//remove empty device keys
|
||||||
|
if (isset($row['device_keys'])) {
|
||||||
|
$y = 0;
|
||||||
|
foreach ($row['device_keys'] as &$sub_row) {
|
||||||
|
if (count($sub_row) == 2) {
|
||||||
|
unset($array['devices'][$x]['device_keys']);
|
||||||
|
}
|
||||||
|
$y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove empty device lines
|
||||||
|
if (isset($row['device_lines'])) {
|
||||||
|
$y = 0;
|
||||||
|
foreach ($row['device_lines'] as &$sub_row) {
|
||||||
|
if (count($sub_row) == 2) {
|
||||||
|
unset($array['devices'][$x]['device_lines']);
|
||||||
|
}
|
||||||
|
$y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//increment device id
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
|
||||||
//save to the data
|
//save to the data
|
||||||
$database->save($array);
|
$database->save($array);
|
||||||
//$message = $database->message;
|
//$message = $database->message;
|
||||||
@@ -379,6 +408,35 @@
|
|||||||
} //end while
|
} //end while
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
|
|
||||||
|
//remove sub table data if it doesn't have more details than domain_uuid an device_uuid
|
||||||
|
$x = 0;
|
||||||
|
foreach ($array['devices'] as $row) {
|
||||||
|
//remove empty device keys
|
||||||
|
if (isset($row['device_keys'])) {
|
||||||
|
$y = 0;
|
||||||
|
foreach ($row['device_keys'] as &$sub_row) {
|
||||||
|
if (count($sub_row) == 2) {
|
||||||
|
unset($array['devices'][$x]['device_keys']);
|
||||||
|
}
|
||||||
|
$y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove empty device lines
|
||||||
|
if (isset($row['device_lines'])) {
|
||||||
|
$y = 0;
|
||||||
|
foreach ($row['device_lines'] as &$sub_row) {
|
||||||
|
if (count($sub_row) == 2) {
|
||||||
|
unset($array['devices'][$x]['device_lines']);
|
||||||
|
}
|
||||||
|
$y++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//increment device id
|
||||||
|
$x++;
|
||||||
|
}
|
||||||
|
|
||||||
//debug info
|
//debug info
|
||||||
//view_array($array);
|
//view_array($array);
|
||||||
|
|
||||||
@@ -386,6 +444,7 @@
|
|||||||
if (is_array($array)) {
|
if (is_array($array)) {
|
||||||
$database->save($array);
|
$database->save($array);
|
||||||
//$message = $database->message;
|
//$message = $database->message;
|
||||||
|
//view_array($message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strlen($_SESSION['provision']['path']['text']) > 0) {
|
if (strlen($_SESSION['provision']['path']['text']) > 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user