diff options
author | Simon Rettberg | 2016-08-22 12:13:19 +0200 |
---|---|---|
committer | Simon Rettberg | 2016-08-22 12:13:19 +0200 |
commit | bf9db9aef8966de85652393cbcc28053dd2ffed3 (patch) | |
tree | d5a8cc8f6d3fcfe5013d3e5d263cc88912b77554 /modules-available/dozmod | |
parent | [statistics] Handle lastboot = 0 as offline, fix hdd parsing, add raw display (diff) | |
download | slx-admin-bf9db9aef8966de85652393cbcc28053dd2ffed3.tar.gz slx-admin-bf9db9aef8966de85652393cbcc28053dd2ffed3.tar.xz slx-admin-bf9db9aef8966de85652393cbcc28053dd2ffed3.zip |
[dozmod] Show wasted space in blockstats
Diffstat (limited to 'modules-available/dozmod')
-rw-r--r-- | modules-available/dozmod/page.inc.php | 3 | ||||
-rw-r--r-- | modules-available/dozmod/templates/blockstats-details.html | 2 | ||||
-rw-r--r-- | modules-available/dozmod/templates/blockstats.html | 6 |
3 files changed, 9 insertions, 2 deletions
diff --git a/modules-available/dozmod/page.inc.php b/modules-available/dozmod/page.inc.php index dfb49e0b..6c0c8a6b 100644 --- a/modules-available/dozmod/page.inc.php +++ b/modules-available/dozmod/page.inc.php @@ -126,11 +126,14 @@ class Page_DozMod extends Page $res = Database::simpleQuery("SELECT blocksha1, blocksize, Count(*) AS blockcount FROM sat.imageblock" . " GROUP BY blocksha1, blocksize HAVING blockcount > 1 ORDER BY blockcount DESC, blocksha1 ASC"); $data = array('hashes' => array()); + $spaceWasted = 0; while ($row = $res->fetch(PDO::FETCH_ASSOC)) { $row['hash_hex'] = bin2hex($row['blocksha1']); $row['blocksize_s'] = Util::readableFileSize($row['blocksize']); $data['hashes'][] = $row; + $spaceWasted += $row['blocksize'] * ($row['blockcount'] - 1); } + $data['spacewasted'] = Util::readableFileSize($spaceWasted); Render::addTemplate('blockstats', $data); } diff --git a/modules-available/dozmod/templates/blockstats-details.html b/modules-available/dozmod/templates/blockstats-details.html index 68e03fbc..e9466d94 100644 --- a/modules-available/dozmod/templates/blockstats-details.html +++ b/modules-available/dozmod/templates/blockstats-details.html @@ -1,6 +1,6 @@ <table class="table table-bordered table-striped"> <tr> - <th>{{lang_imageName}}</th> + <th>{{lang_image}}</th> <th>{{lang_createTime}}</th> <th>{{lang_fileSize}}</th> <th>{{lang_blockCount}}</th> diff --git a/modules-available/dozmod/templates/blockstats.html b/modules-available/dozmod/templates/blockstats.html index 82a66146..cba3b476 100644 --- a/modules-available/dozmod/templates/blockstats.html +++ b/modules-available/dozmod/templates/blockstats.html @@ -1,8 +1,12 @@ +<div class="alert alert-info"> + {{lang_spaceWastedDuplication}}: {{spacewasted}} +</div> + <table class="table table-condensed table-striped" style="width: auto"> <tr> <th>{{lang_hash}}</th> <th>{{lang_size}}</th> - <th>{{lang_count}}</th> + <th>{{lang_blockCount}}</th> </tr> {{#hashes}} <tr> |