|
21 | 21 | *
|
22 | 22 | * # Execute a SQL query stored in a file.
|
23 | 23 | * $ wp db query < debug.sql
|
| 24 | + * |
| 25 | + * @when after_wp_config_load |
24 | 26 | */
|
25 | 27 | class DB_Command extends WP_CLI_Command {
|
26 | 28 |
|
@@ -469,6 +471,8 @@ public function import( $args, $assoc_args ) {
|
469 | 471 | * # Export only tables for a single site
|
470 | 472 | * $ wp db export --tables=$(wp db tables --url=sub.example.com --format=csv)
|
471 | 473 | * Success: Exported to wordpress_dbase.sql
|
| 474 | + * |
| 475 | + * @when after_wp_load |
472 | 476 | */
|
473 | 477 | public function tables( $args, $assoc_args ) {
|
474 | 478 |
|
@@ -568,12 +572,11 @@ public function tables( $args, $assoc_args ) {
|
568 | 572 | *
|
569 | 573 | * $ wp db size --size_format=mb
|
570 | 574 | * 6
|
| 575 | + * |
| 576 | + * @when after_wp_load |
571 | 577 | */
|
572 | 578 | public function size( $args, $assoc_args ) {
|
573 | 579 |
|
574 |
| - // Avoid a constant redefinition in wp-config. |
575 |
| - @WP_CLI::get_runner()-> load_wordpress(); |
576 |
| - |
577 | 580 | global $wpdb;
|
578 | 581 |
|
579 | 582 | $format = WP_CLI\Utils\get_flag_value( $assoc_args, 'format' );
|
@@ -668,11 +671,10 @@ public function size( $args, $assoc_args ) {
|
668 | 671 | *
|
669 | 672 | * $ wp db prefix
|
670 | 673 | * wp_
|
| 674 | + * |
| 675 | + * @when after_wp_load |
671 | 676 | */
|
672 | 677 | public function prefix() {
|
673 |
| - // Avoid a constant redefinition in wp-config. |
674 |
| - @WP_CLI::get_runner()->load_wordpress(); |
675 |
| - |
676 | 678 | global $wpdb;
|
677 | 679 |
|
678 | 680 | WP_CLI::log( $wpdb->prefix );
|
@@ -799,15 +801,13 @@ public function prefix() {
|
799 | 801 | * ...
|
800 | 802 | * Success: Found 99146 matches in 10.752s (10.559s searching). Searched 12 tables, 53 columns, 1358907 rows. 1 table skipped: wp_term_relationships.
|
801 | 803 | *
|
| 804 | + * @when after_wp_load |
802 | 805 | */
|
803 | 806 | public function search( $args, $assoc_args ) {
|
804 | 807 | global $wpdb;
|
805 | 808 |
|
806 | 809 | $start_run_time = microtime( true );
|
807 | 810 |
|
808 |
| - // Avoid a constant redefinition in wp-config. |
809 |
| - @WP_CLI::get_runner()->load_wordpress(); |
810 |
| - |
811 | 811 | $search = array_shift( $args );
|
812 | 812 |
|
813 | 813 | $before_context = \WP_CLI\Utils\get_flag_value( $assoc_args, 'before_context', 40 );
|
|
0 commit comments