mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-22 23:02:42 +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:
parent
91abc0f027
commit
201f29fbf4
1 changed files with 13 additions and 3 deletions
|
@ -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)),
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue