| @@ -3,9 +3,9 @@ | ||
| 3 | 3 | * Plugin Name: Patchstack Security |
| 4 | 4 | * Plugin URI: https://patchstack.com/?utm_medium=wp&utm_source=dashboard&utm_campaign=patchstack%20plugin |
| 5 | 5 | * Author URI: https://patchstack.com/?utm_medium=wp&utm_source=dashboard&utm_campaign=patchstack%20plugin |
| 6 | 6 | * Description: Patchstack identifies security vulnerabilities in WordPress plugins, themes, and core. |
| 7 | - * Version: 2.2.7 | |
| 7 | + * Version: 2.2.8 | |
| 8 | 8 | * Author: Patchstack |
| 9 | 9 | * License: GPLv3 |
| 10 | 10 | * Text Domain: patchstack |
| 11 | 11 | * Domain Path: /languages |
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | * The plugin version. |
| 59 | 59 | * |
| 60 | 60 | * @var string |
| 61 | 61 | */ |
| 62 | - const VERSION = '2.2.7'; | |
| 62 | + const VERSION = '2.2.8'; | |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * API URL of Patchstack to communicate with. |
| 66 | 66 | * |
| @@ -229,22 +229,35 @@ | ||
| 229 | 229 | * Returns an error if the connection was not successful. |
| 230 | 230 | * |
| 231 | 231 | * ## OPTIONS |
| 232 | 232 | * |
| 233 | - * <id> | |
| 233 | + * [<id>] | |
| 234 | 234 | * : The API client id. |
| 235 | 235 | * |
| 236 | - * <secret> | |
| 236 | + * [<secret>] | |
| 237 | 237 | * : The API secret key. |
| 238 | - * | |
| 238 | + * | |
| 239 | + * <secret-id> | |
| 240 | + * : The API client id and secret key merged together, found in the App. E.g. 2b072e8b60402e30d481df351fc08183906254e0-123456 | |
| 241 | + * | |
| 239 | 242 | * ## EXAMPLES |
| 240 | - * | |
| 243 | + * | |
| 241 | 244 | * $ wp patchstack activate 123456 2b072e8b60402e30d481df351fc08183906254e0 |
| 242 | 245 | * Success: The Patchstack plugin has been successfully connected. |
| 246 | + * | |
| 247 | + * or | |
| 248 | + * | |
| 249 | + * $ wp patchstack activate 2b072e8b60402e30d481df351fc08183906254e0-123456 | |
| 250 | + * Success: The Patchstack plugin has been successfully connected. | |
| 243 | 251 | */ |
| 244 | 252 | public function cli_activate( $args ) { |
| 245 | - $id = isset( $args[0] ) ? trim( $args[0] ) : ''; | |
| 246 | - $secret = isset( $args[1] ) ? trim( $args[1] ) : ''; | |
| 253 | + // Handle both ways to activate the plugin. | |
| 254 | + if ( count( $args ) === 1 && strpos( $args[0], '-' ) !== false ) { | |
| 255 | + list( $secret, $id ) = explode( '-', $args[0] ); | |
| 256 | + } else { | |
| 257 | + $id = isset( $args[0] ) ? trim( $args[0] ) : ''; | |
| 258 | + $secret = isset( $args[1] ) ? trim( $args[1] ) : ''; | |
| 259 | + } | |
| 247 | 260 | |
| 248 | 261 | $result = $this->activation->alter_license( $id, $secret, 'activate' ); |
| 249 | 262 | if ( $result['result'] == 'error' ) { |
| 250 | 263 | \WP_CLI::error( 'The Patchstack plugin could not be connected. Make sure the id and secret key are valid and that api.patchstack.com is not blocked.' ); |