@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator

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

+13 -3
+13 -3
src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
··· 56 56 ->setShowHeader(false) 57 57 ->setPadding(2) 58 58 ->addColumn('name', array('title' => pht('Database / Table'))) 59 - ->addColumn('size', array('title' => pht('Size'))) 60 - ->addColumn('percentage', array('title' => pht('Percentage'))); 59 + ->addColumn( 60 + 'size', 61 + array( 62 + 'title' => pht('Size'), 63 + 'align' => PhutilConsoleTable::ALIGN_RIGHT, 64 + )) 65 + ->addColumn( 66 + 'percentage', 67 + array( 68 + 'title' => pht('Percentage'), 69 + 'align' => PhutilConsoleTable::ALIGN_RIGHT, 70 + )); 61 71 62 72 foreach ($totals as $db => $size) { 63 73 list($database_size, $database_percentage) = $this->formatSize( ··· 98 108 99 109 private function formatSize($n, $o) { 100 110 return array( 101 - sprintf('%8.8s MB', number_format($n / (1024 * 1024), 1)), 111 + pht('%s MB', new PhutilNumber($n / (1024 * 1024), 1)), 102 112 sprintf('%3.1f%%', 100 * ($n / $o)), 103 113 ); 104 114 }