|
6 | 6 |
|
7 | 7 | /** |
8 | 8 | * Generates and reads the wp-config.php file. |
| 9 | + * |
| 10 | + * ## EXAMPLES |
| 11 | + * |
| 12 | + * # Create standard wp-config.php file. |
| 13 | + * $ wp config create --dbname=testing --dbuser=wp --dbpass=securepswd --locale=ro_RO |
| 14 | + * Success: Generated 'wp-config.php' file. |
| 15 | + * |
| 16 | + * # List constants and variables defined in wp-config.php file. |
| 17 | + * $ wp config list |
| 18 | + * +------------------+------------------------------------------------------------------+----------+ |
| 19 | + * | key | value | type | |
| 20 | + * +------------------+------------------------------------------------------------------+----------+ |
| 21 | + * | table_prefix | wp_ | variable | |
| 22 | + * | DB_NAME | wp_cli_test | constant | |
| 23 | + * | DB_USER | root | constant | |
| 24 | + * | DB_PASSWORD | root | constant | |
| 25 | + * | AUTH_KEY | r6+@shP1yO&$)1gdu.hl[/j;7Zrvmt~o;#WxSsa0mlQOi24j2cR,7i+QM/#7S:o^ | constant | |
| 26 | + * | SECURE_AUTH_KEY | iO-z!_m--YH$Tx2tf/&V,YW*13Z_HiRLqi)d?$o-tMdY+82pK$`T.NYW~iTLW;xp | constant | |
| 27 | + * +------------------+------------------------------------------------------------------+----------+ |
| 28 | + * |
| 29 | + * # Get wp-config.php file path. |
| 30 | + * $ wp config path |
| 31 | + * /home/person/htdocs/project/wp-config.php |
| 32 | + * |
| 33 | + * # Get the table_prefix as defined in wp-config.php file. |
| 34 | + * $ wp config get table_prefix |
| 35 | + * wp_ |
| 36 | + * |
| 37 | + * # Set the WP_DEBUG constant to true. |
| 38 | + * $ wp config set WP_DEBUG true --raw |
| 39 | + * Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'. |
| 40 | + * |
| 41 | + * # Delete the COOKIE_DOMAIN constant from the wp-config.php file. |
| 42 | + * $ wp config delete COOKIE_DOMAIN |
| 43 | + * Success: Deleted the constant 'COOKIE_DOMAIN' from the 'wp-config.php' file. |
| 44 | + * |
| 45 | + * # Launch system editor to edit wp-config.php file. |
| 46 | + * $ wp config edit |
| 47 | + * |
| 48 | + * # Check whether the DB_PASSWORD constant exists in the wp-config.php file. |
| 49 | + * $ wp config has DB_PASSWORD |
| 50 | + * $ echo $? |
| 51 | + * 0 |
| 52 | + * |
| 53 | + * # Assert if MULTISITE is true. |
| 54 | + * $ wp config is-true MULTISITE |
| 55 | + * $ echo $? |
| 56 | + * 0 |
| 57 | + * |
| 58 | + * # Get new salts for your wp-config.php file. |
| 59 | + * $ wp config shuffle-salts |
| 60 | + * Success: Shuffled the salt keys. |
| 61 | + * |
| 62 | + * @package wp-cli |
9 | 63 | */ |
10 | 64 | class Config_Command extends WP_CLI_Command { |
11 | 65 |
|
@@ -582,6 +636,7 @@ private static function get_wp_config_vars( $wp_config_path = '' ) { |
582 | 636 | * |
583 | 637 | * # Set the WP_DEBUG constant to true. |
584 | 638 | * $ wp config set WP_DEBUG true --raw |
| 639 | + * Success: Updated the constant 'WP_DEBUG' in the 'wp-config.php' file with the raw value 'true'. |
585 | 640 | * |
586 | 641 | * @when before_wp_load |
587 | 642 | */ |
@@ -685,6 +740,7 @@ public function set( $args, $assoc_args ) { |
685 | 740 | * |
686 | 741 | * # Delete the COOKIE_DOMAIN constant from the wp-config.php file. |
687 | 742 | * $ wp config delete COOKIE_DOMAIN |
| 743 | + * Success: Deleted the constant 'COOKIE_DOMAIN' from the 'wp-config.php' file. |
688 | 744 | * |
689 | 745 | * @when before_wp_load |
690 | 746 | */ |
@@ -815,6 +871,7 @@ public function has( $args, $assoc_args ) { |
815 | 871 | * |
816 | 872 | * # Add a cache key salt to the wp-config.php file |
817 | 873 | * $ wp config shuffle-salts WP_CACHE_KEY_SALT --force |
| 874 | + * Success: Shuffled the salt keys. |
818 | 875 | * |
819 | 876 | * @subcommand shuffle-salts |
820 | 877 | * @when before_wp_load |
|
0 commit comments