diff --git a/app/classes/BaseController.php b/app/classes/BaseController.php
index 6f75fa1..594c4fd 100644
--- a/app/classes/BaseController.php
+++ b/app/classes/BaseController.php
@@ -229,6 +229,38 @@ protected function _highlight($var, $format = "array", $label = false) {
return $string;
}
+ /**
+ * Export IndexSizes as string.
+ *
+ * @param mixed $var variable to be exported
+ * @return string
+ */
+ protected function _highlightIndexSizes($var) {
+ $string = "
";
+ $c = 0;
+ foreach($var as $key => $value) {
+ if ($value < 1024) {
+ $formatted_size = $value . "b";
+ } else if ($value < 1024 * 1024) {
+ $formatted_size = round($value/1024, 2) . " kb";
+ } else if ($value < 1024 * 1024 * 1024) {
+ $formatted_size = round($value/1024/1024, 2) . " mb";
+ } else if ($value < 1024 * 1024 * 1024 * 1024) {
+ $formatted_size = round($value/1024/1024/1024, 2) . " gb";
+ }
+ if (($c%2) == 0) {
+ $bgc = "#fff";
+ } else {
+ $bgc = "#eee";
+ }
+ $string .= "| " . $key . " | ";
+ $string .= "" . $formatted_size . " |
";
+ $c++;
+ }
+ $string .= "
";
+ return $string;
+ }
+
/**
* format bytes to human size
*
diff --git a/app/controllers/collection.php b/app/controllers/collection.php
index 3c454bd..33d59f6 100644
--- a/app/controllers/collection.php
+++ b/app/controllers/collection.php
@@ -785,7 +785,11 @@ public function doCollectionStats() {
$this->stats = $ret;
foreach ($this->stats as $index => $stat) {
if (is_array($stat)) {
- $this->stats[$index] = $this->_highlight($stat, "json");
+ if ($index == "indexSizes") {
+ $this->stats[$index] = $this->_highlightIndexSizes($stat, "json");
+ } else {
+ $this->stats[$index] = $this->_highlight($stat);
+ }
}
}
}