Disk Space Widget rounding

got quickbox running on 2 different kimsufi with ubuntu 16.04, booth of them display the free space as following:

Free: 1732.325 GB
Used: 99.3599999999999 GB
Size: 1831.685 GB

and

Free: 1357.861 GB
Used: 473.8239999999998 GB
Size: 1831.685 GB

well, the 999999 is pretty ugly. anyone else got this format problem?

When was the last time you updated as this should had been resolved at the beginning of #v2.4.5.

Can you check that your /srv/rutorrent/home/widgets/disk_data.php file looks like the following around line 68 - 76

  //hard disk
  $dftotal = number_format(round(@disk_total_space(".")/(1024*1024*1024),3)); //Total
  $dffree = number_format(round(@disk_free_space(".")/(1024*1024*1024),3)); //Available
  $dfused = number_format(round(@disk_total_space(".")/(1024*1024*1024),3)-round(@disk_free_space(".")/(1024*1024*1024),3)); //used
  //hard disk for percentages
  $dptotal = round(@disk_total_space(".")/(1024*1024*1024),3); //Total
  $dpfree = round(@disk_free_space(".")/(1024*1024*1024),3); //Available
  $dpused = $dptotal-$dpfree; //used
  $perused = (floatval($dptotal)!=0)?round($dpused/$dptotal*100,2):0;

I have applied this very calc to Kimsufi’s that I have installed for various people and can confirm it should round as follows:

Free: 3,283 GB
Used: 2,238 GB
Size: 5,521 GB

At the same time with the bottom percentage variable, it keeps the percentages in tact and that was specifically for the kernel of default Kimsufi servers.

####Post Script
For clarity


If you are using a /home mounted install, then the (".") will read as ($location)

Also, on a recent commit I published there are new aliases that can fire the updating of the disk widget.

On /home mounted installs you can run fix-disk_widget_home
On /(root) mounted installs you can run fix-disk_widget_root

These aliases fire one of the two functions posted below:

# -> Performs some quick adjustments for certain conditions.
home_diskwidget() {
  cp /root/QuickBox/dashboard/widgets/disk_datah.php /srv/rutorrent/home/widgets/disk_data.php
  service apache2 restart
}

root_diskwidget() {
  cp /root/QuickBox/dashboard/widgets/disk_data.php /srv/rutorrent/home/widgets/disk_data.php
  service apache2 restart
}

If you have ran an update within the last 8 hours you will have these aliases on your install. If you cannot seem to have the commands, please type source /root/.bashrc to update your bashrc file without the need for a reboot.

2 Likes

it wasn’t resolved with just the update via dashboard today
but it’s working now after running fix_disk_widget command

thx for the fast reply and solution!