| @@ -3,14 +3,14 @@ | ||
| 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.3.7 | |
| 7 | + * Version: 2.2.10 | |
| 8 | 8 | * Author: Patchstack |
| 9 | 9 | * License: GPLv3 |
| 10 | 10 | * Text Domain: patchstack |
| 11 | 11 | * Domain Path: /languages |
| 12 | - * Requires at least: 5.2 | |
| 12 | + * Requires at least: 4.4 | |
| 13 | 13 | * Requires PHP: 5.6 |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | 16 | // Do not allow the file to be called directly. |
| @@ -58,9 +58,9 @@ | ||
| 58 | 58 | * The plugin version. |
| 59 | 59 | * |
| 60 | 60 | * @var string |
| 61 | 61 | */ |
| 62 | - const VERSION = '2.3.7'; | |
| 62 | + const VERSION = '2.2.10'; | |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * API URL of Patchstack to communicate with. |
| 66 | 66 | * |
| @@ -173,10 +173,8 @@ | ||
| 173 | 173 | |
| 174 | 174 | // Define WP_CLI command. |
| 175 | 175 | if ( defined( 'WP_CLI' ) && WP_CLI && method_exists('\WP_CLI', 'add_command')) { |
| 176 | 176 | \WP_CLI::add_command( 'patchstack activate', [ $this, 'cli_activate' ] ); |
| 177 | - \WP_CLI::add_command( 'patchstack deactivate', [ $this, 'cli_deactivate' ] ); | |
| 178 | - \WP_CLI::add_command( 'patchstack status', [ $this, 'cli_status' ] ); | |
| 179 | 177 | } |
| 180 | 178 | } |
| 181 | 179 | |
| 182 | 180 | /** |
| @@ -231,22 +229,22 @@ | ||
| 231 | 229 | * ## OPTIONS |
| 232 | 230 | * |
| 233 | 231 | * [<id>] |
| 234 | 232 | * : The API client id. |
| 235 | - * | |
| 233 | + * | |
| 236 | 234 | * [<secret>] |
| 237 | 235 | * : The API secret key. |
| 238 | - * | |
| 236 | + * | |
| 239 | 237 | * <secret-id> |
| 240 | 238 | * : The API client id and secret key merged together, found in the App. E.g. 2b072e8b60402e30d481df351fc08183906254e0-123456 |
| 241 | - * | |
| 239 | + * | |
| 242 | 240 | * ## EXAMPLES |
| 243 | - * | |
| 241 | + * | |
| 244 | 242 | * $ wp patchstack activate 123456 2b072e8b60402e30d481df351fc08183906254e0 |
| 245 | 243 | * Success: The Patchstack plugin has been successfully connected. |
| 246 | - * | |
| 244 | + * | |
| 247 | 245 | * or |
| 248 | - * | |
| 246 | + * | |
| 249 | 247 | * $ wp patchstack activate 2b072e8b60402e30d481df351fc08183906254e0-123456 |
| 250 | 248 | * Success: The Patchstack plugin has been successfully connected. |
| 251 | 249 | */ |
| 252 | 250 | public function cli_activate( $args ) { |
| @@ -259,9 +257,9 @@ | ||
| 259 | 257 | } |
| 260 | 258 | |
| 261 | 259 | $result = $this->activation->alter_license( $id, $secret, 'activate' ); |
| 262 | 260 | if ( $result['result'] == 'error' ) { |
| 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. Additional information:\n" . $result['body'] ); | |
| 261 | + \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.' ); | |
| 264 | 262 | return; |
| 265 | 263 | } |
| 266 | 264 | |
| 267 | 265 | \WP_CLI::success( 'The Patchstack plugin has been successfully connected.' ); |
| @@ -267,42 +265,8 @@ | ||
| 267 | 265 | \WP_CLI::success( 'The Patchstack plugin has been successfully connected.' ); |
| 268 | 266 | } |
| 269 | 267 | |
| 270 | 268 | /** |
| 271 | - * Disconnects the Patchstack plugin from the API and removes the API key. | |
| 272 | - * | |
| 273 | - * ## EXAMPLES | |
| 274 | - * | |
| 275 | - * $ wp patchstack deactivate | |
| 276 | - * Success: The Patchstack plugin has been successfully disconnected. | |
| 277 | - */ | |
| 278 | - public function cli_deactivate() { | |
| 279 | - $this->activation->deactivate(); | |
| 280 | - $this->activation->alter_license( '', '', 'deactivate' ); | |
| 281 | - | |
| 282 | - \WP_CLI::success( 'The Patchstack plugin has been successfully disconnected.' ); | |
| 283 | - } | |
| 284 | - | |
| 285 | - /** | |
| 286 | - * Gets the current API connection status from the Patchstack plugin. | |
| 287 | - * | |
| 288 | - * ## EXAMPLES | |
| 289 | - * | |
| 290 | - * $ wp patchstack status | |
| 291 | - * Success: The Patchstack plugin is currently connected to the API. | |
| 292 | - * | |
| 293 | - * $ wp patchstack status | |
| 294 | - * Warning: The Patchstack plugin is not connected to the API. | |
| 295 | - */ | |
| 296 | - public function cli_status() { | |
| 297 | - if ( $this->api->is_connected() ) { | |
| 298 | - \WP_CLI::success( __( 'The Patchstack plugin is currently connected to the API.', 'patchstack' ) ); | |
| 299 | - } else { | |
| 300 | - \WP_CLI::warning( __( 'The Patchstack plugin is not connected to the API.', 'patchstack' ) ); | |
| 301 | - } | |
| 302 | - } | |
| 303 | - | |
| 304 | - /** | |
| 305 | 269 | * Deactivate the plugin. |
| 306 | 270 | * |
| 307 | 271 | * @return void |
| 308 | 272 | */ |
| @@ -311,23 +275,15 @@ | ||
| 311 | 275 | $this->activation->deactivate(); |
| 312 | 276 | } |
| 313 | 277 | |
| 314 | 278 | /** |
| 315 | - * Load translated strings for the plugin. | |
| 316 | - * | |
| 317 | - * @return void | |
| 318 | - */ | |
| 319 | - public function load_textdomain () { | |
| 320 | - load_plugin_textdomain( 'patchstack', false, dirname( $this->basename ) . '/languages/' ); | |
| 321 | - } | |
| 322 | - | |
| 323 | - /** | |
| 324 | 279 | * Boot Patchstack. |
| 325 | 280 | * |
| 326 | 281 | * @return void |
| 327 | 282 | */ |
| 328 | 283 | public function init() { |
| 329 | - add_action( 'init', [ $this, 'load_textdomain' ] ); | |
| 284 | + // Load translated strings for plugin. | |
| 285 | + load_plugin_textdomain( 'patchstack', false, dirname( $this->basename ) . '/languages/' ); | |
| 330 | 286 | |
| 331 | 287 | // Initialize plugin classes. |
| 332 | 288 | $this->plugin_classes(); |
| 333 | 289 | |
| @@ -395,35 +351,22 @@ | ||
| 395 | 351 | * @return void |
| 396 | 352 | */ |
| 397 | 353 | function patchstack_uninstall() { |
| 398 | 354 | // Delete most of the Patchstack options. |
| 399 | - global $wpdb; | |
| 400 | - $options = $wpdb->get_results( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'patchstack_%'" ); | |
| 355 | + $options = [ 'patchstack_eventlog_lastid', 'patchstack_api_token', 'patchstack_dashboardlock', 'patchstack_pluginedit', 'patchstack_move_logs', 'patchstack_userenum', 'patchstack_basicscanblock', 'patchstack_hidewpcontent', 'patchstack_hidewpversionk', 'patchstack_prevent_default_file_access', 'patchstack_basic_firewall', 'patchstack_known_blacklist', 'patchstack_block_debug_log_access', 'patchstack_block_fake_bots', 'patchstack_index_views', 'patchstack_proxy_comment_posting', 'patchstack_bad_query_strings', 'patchstack_advanced_character_string_filter', 'patchstack_advanced_blacklist_firewall', 'patchstack_forbid_rfi', 'patchstack_image_hotlinking', 'patchstack_add_security_headers', 'patchstack_firewall_log_lastid', 'patchstack_user_log_lastid', 'patchstack_captcha_public_key', 'patchstack_captcha_private_key', 'patchstack_scan_interval', 'patchstack_scan_day', 'patchstack_scan_time', 'patchstack_hackers_log', 'patchstack_users_log', 'patchstack_visitors_log', 'external_updates-webarx', 'patchstack_wp_stats', 'patchstack_captcha_login_form', 'patchstack_license_activated', 'patchstack_license_expiry', 'patchstack_software_data_hash', 'patchstack_mv_wp_login', 'patchstack_rename_wp_login', 'patchstack_googledrive_backup_is_running', 'patchstack_googledrive_upload_state', 'patchstack_googledrive_access_token', 'patchstack_googledrive_refresh_token', 'patchstack_cron_offset', 'patchstack_htaccess_rules_hash' ]; | |
| 356 | + foreach ( $options as $option ) { | |
| 357 | + delete_option( $option ); | |
| 401 | 358 | |
| 402 | - // Few options we want to keep. | |
| 403 | - $keep = ['patchstack_hits_last_30', 'patchstack_hits_all_time', 'patchstack_clientid', 'patchstack_secretkey', 'patchstack_secretkey_nonce', 'patchstack_api_token']; | |
| 404 | - | |
| 405 | - // Delete everything else. | |
| 406 | - foreach( $options as $option ) { | |
| 407 | - if ( in_array( $option->option_name, $keep ) || stripos( $option->option_name, 'patchstack_captcha_' ) !== false ) { | |
| 408 | - continue; | |
| 409 | - } | |
| 410 | - | |
| 411 | - delete_option( $option->option_name ); | |
| 412 | - | |
| 413 | 359 | if ( is_multisite() ) { |
| 414 | - delete_site_option( $option->option_name ); | |
| 360 | + delete_site_option( $option ); | |
| 415 | 361 | } |
| 416 | 362 | } |
| 417 | 363 | |
| 418 | - // Drop all tables. | |
| 364 | + // Drop all Patchstack tables. | |
| 419 | 365 | global $wpdb; |
| 420 | - $prefixes = ['patchstack_', 'webarx_']; | |
| 421 | - foreach ( $prefixes as $prefix ) { | |
| 422 | - $tables = [ 'user_log', 'visitor_log', 'firewall_log', 'file_hashes', 'logic', 'ip', 'event_log' ]; | |
| 423 | - foreach ( $tables as $table ) { | |
| 424 | - $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . $prefix . $table ); | |
| 425 | - } | |
| 366 | + $tables = [ 'patchstack_user_log', 'patchstack_visitor_log', 'patchstack_firewall_log', 'patchstack_file_hashes', 'patchstack_logic', 'patchstack_ip', 'patchstack_event_log' ]; | |
| 367 | + foreach ( $tables as $table ) { | |
| 368 | + $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . $table ); | |
| 426 | 369 | } |
| 427 | 370 | } |
| 428 | 371 | } |
| 429 | 372 | |
| @@ -437,13 +380,11 @@ | ||
| 437 | 380 | return patchstack::get_instance(); |
| 438 | 381 | } |
| 439 | 382 | } |
| 440 | 383 | |
| 441 | -if ( ! has_action( 'plugins_loaded', [ patchstack(), 'init' ] ) ) { | |
| 442 | - // Kick it off. | |
| 443 | - add_action( 'plugins_loaded', [ patchstack(), 'init' ] ); | |
| 384 | +// Kick it off. | |
| 385 | +add_action( 'plugins_loaded', [ patchstack(), 'init' ] ); | |
| 444 | 386 | |
| 445 | - // Activation and deactivation hooks. | |
| 446 | - register_activation_hook( __FILE__, [ patchstack(), 'activate' ] ); | |
| 447 | - register_deactivation_hook( __FILE__, [ patchstack(), 'deactivate' ] ); | |
| 448 | - register_uninstall_hook( __FILE__, 'patchstack_uninstall' ); | |
| 449 | -} | |
| 387 | +// Activation and deactivation hooks. | |
| 388 | +register_activation_hook( __FILE__, [ patchstack(), 'activate' ] ); | |
| 389 | +register_deactivation_hook( __FILE__, [ patchstack(), 'deactivate' ] ); | |
| 390 | +register_uninstall_hook( __FILE__, 'patchstack_uninstall' ); | |