Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
### Fixed

- Fix option ```Use LastHWScan``` that no longer worked.
- Fix the disk space units for `TOTAL` and `FREE`.

20 changes: 20 additions & 0 deletions inc/sccm.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,26 @@ public function showHome()
echo __('Please, read the documentation before using that.', 'footprints');
}

public function getSccmBuildNumber()
{
$PluginSccmSccmdb = new PluginSccmSccmdb();
$res = $PluginSccmSccmdb->connect();
if (!$res) {
die;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid Die, maybe you can throw an exception and return false?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we migrate the plugin, we will update this section (which is used throughout this class).

}

$query = "SELECT TOP 1 BuildNumber FROM dbo.Site;";

$result = $PluginSccmSccmdb->exec_query($query);

$version = null;
if ($row = sqlsrv_fetch_array($result, SQLSRV_FETCH_ASSOC)) {
$version = Sanitizer::sanitize($row['BuildNumber']);
}

return (int) $version;
}

public function getDevices($where = 0, $limit = 99999999)
{

Expand Down
9 changes: 7 additions & 2 deletions inc/sccmxml.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -418,8 +418,13 @@ public function setStorages()
$CONTENT = $this->sxml->CONTENT[0];
$i = 0;
foreach ($PluginSccmSccm->getStorages($this->device_id) as $value) {
$value['gld-TotalSize'] = intval($value['gld-TotalSize']) * 1024;
$value['gld-FreeSpace'] = intval($value['gld-FreeSpace']) * 1024;
// since SCCM 2409 (Version: 5.0.9132.1000) (BuildNumber 9132)
// is total and freespace are no more in KB but in MB
$multiplier = ($PluginSccmSccm->getSccmBuildNumber() > 9132) ? 1 : 1024;

$value['gld-TotalSize'] = intval($value['gld-TotalSize']) * $multiplier;
$value['gld-FreeSpace'] = intval($value['gld-FreeSpace']) * $multiplier;

$CONTENT->addChild('DRIVES');
$DRIVES = $this->sxml->CONTENT[0]->DRIVES[$i];
$DRIVES->addChild('DESCRIPTION', $value['gld-Description']);
Expand Down