| @@ -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.13 | |
| 7 | + * Version: 2.3.0 | |
| 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.13'; | |
| 62 | + const VERSION = '2.3.0'; | |
| 63 | 63 | |
| 64 | 64 | /** |
| 65 | 65 | * API URL of Patchstack to communicate with. |
| 66 | 66 | * |
| @@ -275,15 +275,23 @@ | ||
| 275 | 275 | $this->activation->deactivate(); |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | + * Load translated strings for the plugin. | |
| 280 | + * | |
| 281 | + * @return void | |
| 282 | + */ | |
| 283 | + public function load_textdomain () { | |
| 284 | + load_plugin_textdomain( 'patchstack', false, dirname( $this->basename ) . '/languages/' ); | |
| 285 | + } | |
| 286 | + | |
| 287 | + /** | |
| 279 | 288 | * Boot Patchstack. |
| 280 | 289 | * |
| 281 | 290 | * @return void |
| 282 | 291 | */ |
| 283 | 292 | public function init() { |
| 284 | - // Load translated strings for plugin. | |
| 285 | - load_plugin_textdomain( 'patchstack', false, dirname( $this->basename ) . '/languages/' ); | |
| 293 | + add_action( 'init', [ $this, 'load_textdomain' ] ); | |
| 286 | 294 | |
| 287 | 295 | // Initialize plugin classes. |
| 288 | 296 | $this->plugin_classes(); |
| 289 | 297 | |
| @@ -351,22 +359,35 @@ | ||
| 351 | 359 | * @return void |
| 352 | 360 | */ |
| 353 | 361 | function patchstack_uninstall() { |
| 354 | 362 | // Delete most of the Patchstack options. |
| 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 ); | |
| 363 | + global $wpdb; | |
| 364 | + $options = $wpdb->get_results( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE 'patchstack_%'" ); | |
| 358 | 365 | |
| 366 | + // Few options we want to keep. | |
| 367 | + $keep = ['patchstack_hits_last_30', 'patchstack_hits_all_time', 'patchstack_clientid', 'patchstack_secretkey', 'patchstack_secretkey_nonce', 'patchstack_api_token']; | |
| 368 | + | |
| 369 | + // Delete everything else. | |
| 370 | + foreach( $options as $option ) { | |
| 371 | + if ( in_array( $option->option_name, $keep ) || stripos( $option->option_name, 'patchstack_captcha_' ) !== false ) { | |
| 372 | + continue; | |
| 373 | + } | |
| 374 | + | |
| 375 | + delete_option( $option->option_name ); | |
| 376 | + | |
| 359 | 377 | if ( is_multisite() ) { |
| 360 | - delete_site_option( $option ); | |
| 378 | + delete_site_option( $option->option_name ); | |
| 361 | 379 | } |
| 362 | 380 | } |
| 363 | 381 | |
| 364 | - // Drop all Patchstack tables. | |
| 382 | + // Drop all tables. | |
| 365 | 383 | global $wpdb; |
| 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 ); | |
| 384 | + $prefixes = ['patchstack_', 'webarx_']; | |
| 385 | + foreach ( $prefixes as $prefix ) { | |
| 386 | + $tables = [ 'user_log', 'visitor_log', 'firewall_log', 'file_hashes', 'logic', 'ip', 'event_log' ]; | |
| 387 | + foreach ( $tables as $table ) { | |
| 388 | + $wpdb->query( 'DROP TABLE IF EXISTS ' . $wpdb->prefix . $prefix . $table ); | |
| 389 | + } | |
| 369 | 390 | } |
| 370 | 391 | } |
| 371 | 392 | } |
| 372 | 393 | |