Skip to content

Commit

Permalink
Make sure we have at least 9 as a size for disk, memory and partition.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Jul 23, 2024
1 parent b3e7420 commit b08af9e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/Models/ComponentsModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,11 @@ public function upsert(string $table = '', object $device = null, array $data =
if ((string)$table === 'disk') {
$count = count($data);
for ($i=0; $i < $count; $i++) {
if (empty($data[$i]->size)) {
$data[$i]->size = 0;
} else {
$data[$i]->size = intval($data[$i]->size);
}
if (empty($data[$i]->manufacturer) or $data[$i]->manufacturer === '(Standard disk drives)') {
$data[$i]->manufacturer = '';
}
Expand Down Expand Up @@ -815,6 +820,11 @@ public function upsert(string $table = '', object $device = null, array $data =
if (empty($data[$i]->name) and ! empty($data[$i]->tag)) {
$data[$i]->name = $data[$i]->tag;
}
if (empty($data[$i]->size)) {
$data[$i]->size = 0;
} else {
$data[$i]->size = intval($data[$i]->size);
}
}
}

Expand Down Expand Up @@ -960,6 +970,8 @@ public function upsert(string $table = '', object $device = null, array $data =
}
if (empty($data[$i]->size)) {
$data[$i]->size = 0;
} else {
$data[$i]->size = intval($data[$i]->size);
}
}
}
Expand Down

0 comments on commit b08af9e

Please sign in to comment.