File tree Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Expand file tree Collapse file tree 2 files changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -49,3 +49,15 @@ Feature: Display database size
49
49
50
50
When I run `wp db size --size_format=mb`
51
51
Then STDOUT should be a number
52
+
53
+ Scenario : Display only database size in gigabytes for a WordPress install
54
+ Given a WP install
55
+
56
+ When I run `wp db size --size_format=gb`
57
+ Then STDOUT should be a number
58
+
59
+ Scenario : Display only database size in terabytes for a WordPress install
60
+ Given a WP install
61
+
62
+ When I run `wp db size --size_format=tb`
63
+ Then STDOUT should be a number
Original file line number Diff line number Diff line change @@ -590,6 +590,8 @@ public function tables( $args, $assoc_args ) {
590
590
* - b (bytes)
591
591
* - kb (kilobytes)
592
592
* - mb (megabytes)
593
+ * - gb (gigabytes)
594
+ * - tb (terabytes)
593
595
* ---
594
596
*
595
597
* [--tables]
@@ -722,9 +724,23 @@ public function size( $args, $assoc_args ) {
722
724
if ( ! defined ( 'MB_IN_BYTES ' ) ) {
723
725
define ( 'MB_IN_BYTES ' , 1024 * KB_IN_BYTES );
724
726
}
727
+ if ( ! defined ( 'GB_IN_BYTES ' ) ) {
728
+ define ( 'GB_IN_BYTES ' , 1024 * MB_IN_BYTES );
729
+ }
730
+ if ( ! defined ( 'TB_IN_BYTES ' ) ) {
731
+ define ( 'TB_IN_BYTES ' , 1024 * GB_IN_BYTES );
732
+ }
725
733
726
734
// Display the database size as a number.
727
735
switch ( $ size_format ) {
736
+ case 'tb ' :
737
+ $ divisor = TB_IN_BYTES ;
738
+ break ;
739
+
740
+ case 'gb ' :
741
+ $ divisor = GB_IN_BYTES ;
742
+ break ;
743
+
728
744
case 'mb ' :
729
745
$ divisor = MB_IN_BYTES ;
730
746
break ;
You can’t perform that action at this time.
0 commit comments