Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15297957
D13339.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D13339.diff
View Options
diff --git a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
--- a/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
+++ b/src/infrastructure/storage/management/workflow/PhabricatorStorageManagementProbeWorkflow.php
@@ -45,34 +45,57 @@
}
}
- $console->writeOut("%s\n", pht('APPROXIMATE TABLE SIZES'));
asort($totals);
+
+ $table = id(new PhutilConsoleTable())
+ ->setShowHeader(false)
+ ->setPadding(2)
+ ->addColumn('name', array('title' => pht('Database / Table')))
+ ->addColumn('size', array('title' => pht('Size')))
+ ->addColumn('percentage', array('title' => pht('Percentage')));
+
foreach ($totals as $db => $size) {
- $database_size = $this->formatSize($totals[$db], $overall);
- $console->writeOut(
- "**%s**\n",
- sprintf('%-32.32s %18s', $db, $database_size));
+ list($database_size, $database_percentage) = $this->formatSize(
+ $totals[$db],
+ $overall);
+
+ $table->addRow(array(
+ 'name' => phutil_console_format('**%s**', $db),
+ 'size' => phutil_console_format('**%s**', $database_size),
+ 'percentage' => phutil_console_format('**%s**', $database_percentage),
+ ));
$data[$db] = isort($data[$db], '_totalSize');
- foreach ($data[$db] as $table => $info) {
- $table_size = $this->formatSize($info['_totalSize'], $overall);
- $console->writeOut(
- "%s\n",
- sprintf(' %-28.28s %18s', $table, $table_size));
+ foreach ($data[$db] as $table_name => $info) {
+ list($table_size, $table_percentage) = $this->formatSize(
+ $info['_totalSize'],
+ $overall);
+
+ $table->addRow(array(
+ 'name' => ' '.$table_name,
+ 'size' => $table_size,
+ 'percentage' => $table_percentage,
+ ));
}
}
- $overall_size = $this->formatSize($overall, $overall);
- $console->writeOut(
- "**%s**\n",
- sprintf('%-32.32s %18s', pht('TOTAL'), $overall_size));
+ list($overall_size, $overall_percentage) = $this->formatSize(
+ $overall,
+ $overall);
+ $table->addRow(array(
+ 'name' => phutil_console_format('**%s**', pht('TOTAL')),
+ 'size' => phutil_console_format('**%s**', $overall_size),
+ 'percentage' => phutil_console_format('**%s**', $overall_percentage),
+ ));
+
+ $table->draw();
return 0;
}
private function formatSize($n, $o) {
- return sprintf(
- '%8.8s MB %5.5s%%',
- number_format($n / (1024 * 1024), 1),
- sprintf('%3.1f', 100 * ($n / $o)));
+ return array(
+ sprintf('%8.8s MB', number_format($n / (1024 * 1024), 1)),
+ sprintf('%3.1f%%', 100 * ($n / $o)),
+ );
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mar 6 2025, 12:50 PM (4 w, 5 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7254258
Default Alt Text
D13339.diff (2 KB)
Attached To
Mode
D13339: Use PhutilConsoleTable in `./bin/storage probe`
Attached
Detach File
Event Timeline
Log In to Comment