1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 16:52:41 +01:00

Fix truncation in "bin/storage probe" of tables larger than 100GB

Summary:
Ref T13164. PHI805 incidentally includes some `bin/storage probe` output for 100GB+ tables which renders wrong.

We have the tools to render it properly, so stop doing this manually and let ConsoleTable figure out the alignment.

Test Plan:
Faked very large table sizes, ran `bin/storage probe`:

{F5785946}

(Then, un-faked the very large table sizes and ran it again, got sensible output.)

Reviewers: amckinley

Reviewed By: amckinley

Maniphest Tasks: T13164

Differential Revision: https://secure.phabricator.com/D19567
This commit is contained in:
epriestley 2018-08-08 09:24:48 -07:00
parent 91abc0f027
commit 201f29fbf4

View file

@ -56,8 +56,18 @@ final class PhabricatorStorageManagementProbeWorkflow
->setShowHeader(false)
->setPadding(2)
->addColumn('name', array('title' => pht('Database / Table')))
->addColumn('size', array('title' => pht('Size')))
->addColumn('percentage', array('title' => pht('Percentage')));
->addColumn(
'size',
array(
'title' => pht('Size'),
'align' => PhutilConsoleTable::ALIGN_RIGHT,
))
->addColumn(
'percentage',
array(
'title' => pht('Percentage'),
'align' => PhutilConsoleTable::ALIGN_RIGHT,
));
foreach ($totals as $db => $size) {
list($database_size, $database_percentage) = $this->formatSize(
@ -98,7 +108,7 @@ final class PhabricatorStorageManagementProbeWorkflow
private function formatSize($n, $o) {
return array(
sprintf('%8.8s MB', number_format($n / (1024 * 1024), 1)),
pht('%s MB', new PhutilNumber($n / (1024 * 1024), 1)),
sprintf('%3.1f%%', 100 * ($n / $o)),
);
}