WP Reset – Fastest WordPress Reset Plugin - Version 1.96

Version Description

Download this release

Release Info

Developer WebFactory
Plugin Icon 128x128 WP Reset – Fastest WordPress Reset Plugin
Version 1.96
Comparing to
See all releases

Code changes from version 1.95 to 1.96

Files changed (4) hide show
  1. readme.txt +8 -1
  2. wf-flyout/wf-flyout.php +1 -1
  3. wp-reset-licensing.php +1 -1
  4. wp-reset.php +31 -20
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: WebFactory
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 6.1
7
- Stable tag: 1.95
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -82,6 +82,9 @@ WP Reset has yet to be completely tested with multisite! Please be careful when
82
  * Empty or delete custom tables - empties (truncates) or deletes (drops) all custom database tables.
83
  * Delete .htaccess file - deletes the .htaccess file. If you need to edit .htaccess without FTP use our free <a href="https://wordpress.org/plugins/wp-htaccess-editor/">WP Htaccess Editor</a> plugin.
84
 
 
 
 
85
 
86
  #### Friends who helped us translate WP Reset
87
 
@@ -116,6 +119,10 @@ Or if needed, upload manually;
116
 
117
  == Changelog ==
118
 
 
 
 
 
119
  = v1.95 =
120
  * 2022/01/06
121
  * security fixes
4
  Requires at least: 4.0
5
  Requires PHP: 5.2
6
  Tested up to: 6.1
7
+ Stable tag: 1.96
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
82
  * Empty or delete custom tables - empties (truncates) or deletes (drops) all custom database tables.
83
  * Delete .htaccess file - deletes the .htaccess file. If you need to edit .htaccess without FTP use our free <a href="https://wordpress.org/plugins/wp-htaccess-editor/">WP Htaccess Editor</a> plugin.
84
 
85
+ #### GDPR compatibility
86
+ We are not lawyers. Please do not take any of the following as legal advice.
87
+ WP Reset does not track, collect or process any user data on the front end. Nothing is logged or pushed to any 3rd parties. We also don't use any 3rd party services or CDNs. All actions are performed in the admin and started exclusively on users' request. If you opt to activate your PRO license in the plugin, some data will be shared with WebFactory Ltd; that's clearly noted below the license activation form. Based on that, we feel it's GDPR compatible, but again, please, don't take this as legal advice.
88
 
89
  #### Friends who helped us translate WP Reset
90
 
119
 
120
  == Changelog ==
121
 
122
+ = v1.96 =
123
+ * 2022/11/18
124
+ * security fixes
125
+
126
  = v1.95 =
127
  * 2022/01/06
128
  * security fixes
wf-flyout/wf-flyout.php CHANGED
@@ -82,7 +82,7 @@ if (false == class_exists('wf_flyout')) {
82
  }
83
 
84
  wp_enqueue_style('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.css', array(), $this->ver);
85
- wp_enqueue_script('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.js', array(), $this->ver, true);;
86
  } // admin_enqueue_scripts
87
 
88
 
82
  }
83
 
84
  wp_enqueue_style('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.css', array(), $this->ver);
85
+ wp_enqueue_script('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.js', array(), $this->ver, true);
86
  } // admin_enqueue_scripts
87
 
88
 
wp-reset-licensing.php CHANGED
@@ -486,7 +486,7 @@ if (false === class_exists('WF_Licensing')) {
486
  $license_key = trim(substr($license_key, 0, 64));
487
  $out['license_key'] = $license_key;
488
 
489
- if ($_POST['success'] == 'true') {
490
  $out['error'] = sanitize_text_field($_POST['data']['error']);
491
  $out['name'] = sanitize_text_field($_POST['data']['name']);
492
  $out['valid_until'] = sanitize_text_field($_POST['data']['valid_until']);
486
  $license_key = trim(substr($license_key, 0, 64));
487
  $out['license_key'] = $license_key;
488
 
489
+ if (sanitize_text_field($_POST['success']) == 'true') {
490
  $out['error'] = sanitize_text_field($_POST['data']['error']);
491
  $out['name'] = sanitize_text_field($_POST['data']['name']);
492
  $out['valid_until'] = sanitize_text_field($_POST['data']['valid_until']);
wp-reset.php CHANGED
@@ -3,10 +3,10 @@
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
6
- Version: 1.95
7
  Requires at least: 4.0
8
  Requires PHP: 5.2
9
- Tested up to: 6.0
10
  Author: WebFactory Ltd
11
  Author URI: https://www.webfactoryltd.com/
12
  Text Domain: wp-reset
@@ -277,7 +277,7 @@ class WP_Reset
277
  */
278
  function action_dismiss_notice()
279
  {
280
- if (false == wp_verify_nonce(@$_GET['_wpnonce'], 'wpr_dismiss_notice')) {
281
  wp_die('Please reload the page and try again.');
282
  }
283
 
@@ -751,8 +751,9 @@ class WP_Reset
751
  $custom_tables = $this->get_custom_tables();
752
 
753
  foreach ($custom_tables as $tbl) {
 
754
  $wpdb->query('SET foreign_key_checks = 0');
755
- $wpdb->query("TRUNCATE TABLE {$tbl['name']}");
756
  } // foreach
757
 
758
  do_action('wp_reset_truncate_custom_tables', $custom_tables);
@@ -772,8 +773,9 @@ class WP_Reset
772
  $custom_tables = $this->get_custom_tables();
773
 
774
  foreach ($custom_tables as $tbl) {
 
775
  $wpdb->query('SET foreign_key_checks = 0');
776
- $wpdb->query("DROP TABLE IF EXISTS {$tbl['name']}");
777
  } // foreach
778
 
779
  do_action('wp_reset_drop_custom_tables', $custom_tables);
@@ -1054,9 +1056,11 @@ class WP_Reset
1054
 
1055
  // delete custom tables with WP's prefix
1056
  $prefix = str_replace('_', '\_', $wpdb->prefix);
1057
- $tables = $wpdb->get_col("SHOW TABLES LIKE '{$prefix}%'");
 
1058
  foreach ($tables as $table) {
1059
- $wpdb->query("DROP TABLE $table");
 
1060
  }
1061
 
1062
  $old_user_pass = $current_user->user_pass;
@@ -1134,7 +1138,7 @@ class WP_Reset
1134
  }
1135
 
1136
  // check nonce
1137
- if (true === isset($_POST['wp_reset_confirm']) && false === wp_verify_nonce(@$_POST['_wpnonce'], 'wp-reset')) {
1138
  add_settings_error('wp-reset', 'bad-nonce', __('Something went wrong. Please refresh the page and try again.', 'wp-reset'), 'error');
1139
  return false;
1140
  }
@@ -1914,7 +1918,7 @@ class WP_Reset
1914
  echo '<div class="card-body">';
1915
  echo '<p>' . __('This action affects only custom tables with <code>' . esc_html($wpdb->prefix) . '</code> prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.<br>Always <a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>', 'wp-reset');
1916
  if ($custom_tables) {
1917
- echo '<p>' . __('The following ' . esc_html(sizeof($custom_tables)) . ' custom tables are affected by this tool: ');
1918
  foreach ($custom_tables as $tbl) {
1919
  echo '<code>' . esc_html($tbl['name']) . '</code>';
1920
  if (next($custom_tables)) {
@@ -2484,10 +2488,13 @@ class WP_Reset
2484
  } else {
2485
  $tbl_custom++;
2486
  }
2487
-
2488
- $wpdb->query("OPTIMIZE TABLE {$table->Name}");
2489
- $wpdb->query("CREATE TABLE {$uid}_{$table->Name} LIKE {$table->Name}");
2490
- $wpdb->query("INSERT {$uid}_{$table->Name} SELECT * FROM {$table->Name}");
 
 
 
2491
  } // foreach
2492
  } else {
2493
  return new WP_Error(1, 'Can\'t get table status data.');
@@ -2530,7 +2537,8 @@ class WP_Reset
2530
 
2531
  $tables = $wpdb->get_col($wpdb->prepare('SHOW TABLES LIKE %s', array($uid . '\_%')));
2532
  foreach ($tables as $table) {
2533
- $wpdb->query('DROP TABLE IF EXISTS ' . $table);
 
2534
  }
2535
 
2536
  $snapshot_copy = $snapshots[$uid];
@@ -2637,15 +2645,17 @@ class WP_Reset
2637
  continue;
2638
  }
2639
 
2640
- $wpdb->query('DROP TABLE ' . $table->Name);
 
2641
  } // foreach
2642
 
2643
  // copy snapshot tables to original name
2644
  foreach ($new_tables as $table) {
2645
- $new_name = str_replace($uid . '_', '', $table);
 
2646
 
2647
- $wpdb->query("CREATE TABLE {$new_name} LIKE {$table}");
2648
- $wpdb->query("INSERT {$new_name} SELECT * FROM {$table}");
2649
  }
2650
 
2651
  wp_cache_flush();
@@ -2740,7 +2750,8 @@ class WP_Reset
2740
  $info['rows'] = $table->Rows;
2741
  $info['size_data'] = $table->Data_length;
2742
  $info['size_index'] = $table->Index_length;
2743
- $schema = $wpdb->get_row('SHOW CREATE TABLE ' . $table->Name, ARRAY_N);
 
2744
  $info['schema'] = $schema[1];
2745
  $info['engine'] = $table->Engine;
2746
  $info['fullname'] = $table->Name;
@@ -2931,7 +2942,7 @@ class WP_Reset
2931
 
2932
  do {
2933
  $cnt++;
2934
- $uid = sprintf('%06x', mt_rand(0, 0xFFFFFF));
2935
 
2936
  $verify_db = $wpdb->get_col($wpdb->prepare('SHOW TABLES LIKE %s', array('%' . $uid . '%')));
2937
  } while (!empty($verify_db) && isset($snapshots[$uid]) && $cnt < 30);
3
  Plugin Name: WP Reset
4
  Plugin URI: https://wpreset.com/
5
  Description: Reset the entire site or just selected parts while reserving the option to undo by using snapshots.
6
+ Version: 1.96
7
  Requires at least: 4.0
8
  Requires PHP: 5.2
9
+ Tested up to: 6.1
10
  Author: WebFactory Ltd
11
  Author URI: https://www.webfactoryltd.com/
12
  Text Domain: wp-reset
277
  */
278
  function action_dismiss_notice()
279
  {
280
+ if (false == wp_verify_nonce(sanitize_text_field(@$_GET['_wpnonce']), 'wpr_dismiss_notice')) {
281
  wp_die('Please reload the page and try again.');
282
  }
283
 
751
  $custom_tables = $this->get_custom_tables();
752
 
753
  foreach ($custom_tables as $tbl) {
754
+ $wpdb->wpreset_custom_table = $tbl['name'];
755
  $wpdb->query('SET foreign_key_checks = 0');
756
+ $wpdb->query("TRUNCATE TABLE " . $wpdb->wpreset_custom_table);
757
  } // foreach
758
 
759
  do_action('wp_reset_truncate_custom_tables', $custom_tables);
773
  $custom_tables = $this->get_custom_tables();
774
 
775
  foreach ($custom_tables as $tbl) {
776
+ $wpdb->wpreset_custom_table = $tbl['name'];
777
  $wpdb->query('SET foreign_key_checks = 0');
778
+ $wpdb->query("DROP TABLE IF EXISTS " . $wpdb->wpreset_custom_table);
779
  } // foreach
780
 
781
  do_action('wp_reset_drop_custom_tables', $custom_tables);
1056
 
1057
  // delete custom tables with WP's prefix
1058
  $prefix = str_replace('_', '\_', $wpdb->prefix);
1059
+ $tables = $wpdb->get_col($wpdb->prepare("SHOW TABLES LIKE %s", array($prefix . '%')));
1060
+
1061
  foreach ($tables as $table) {
1062
+ $wpdb->wpreset_table = $table;
1063
+ $wpdb->query("DROP TABLE " . $wpdb->wpreset_table);
1064
  }
1065
 
1066
  $old_user_pass = $current_user->user_pass;
1138
  }
1139
 
1140
  // check nonce
1141
+ if (true === isset($_POST['wp_reset_confirm']) && false === wp_verify_nonce(sanitize_text_field(@$_POST['_wpnonce']), 'wp-reset')) {
1142
  add_settings_error('wp-reset', 'bad-nonce', __('Something went wrong. Please refresh the page and try again.', 'wp-reset'), 'error');
1143
  return false;
1144
  }
1918
  echo '<div class="card-body">';
1919
  echo '<p>' . __('This action affects only custom tables with <code>' . esc_html($wpdb->prefix) . '</code> prefix. Core WP tables and other tables in the database that do not have that prefix will not be deleted/emptied. Deleting (dropping) tables completely removes them from the database. Emptying (truncating) removes all content from them, but keeps the structure intact.<br>Always <a href="#" class="create-new-snapshot" data-description="Before deleting custom tables">create a snapshot</a> before using this tool if you want to be able to undo its actions.</p>', 'wp-reset');
1920
  if ($custom_tables) {
1921
+ echo '<p>' . __('The following ' . esc_html(sizeof($custom_tables)) . ' custom tables are affected by this tool: ', 'wp-reset');
1922
  foreach ($custom_tables as $tbl) {
1923
  echo '<code>' . esc_html($tbl['name']) . '</code>';
1924
  if (next($custom_tables)) {
2488
  } else {
2489
  $tbl_custom++;
2490
  }
2491
+
2492
+ $wpdb->wpreset_snapshot_table_name = $table->Name;
2493
+ $wpdb->wpreset_snapshot_table_copy_name = $uid . '_' . $table->Name;
2494
+
2495
+ $wpdb->query("OPTIMIZE TABLE " . $wpdb->wpreset_snapshot_table_name);
2496
+ $wpdb->query("CREATE TABLE " . $wpdb->wpreset_snapshot_table_copy_name . " LIKE " . $wpdb->wpreset_snapshot_table_name);
2497
+ $wpdb->query("INSERT " . $wpdb->wpreset_snapshot_table_copy_name . " SELECT * FROM " . $wpdb->wpreset_snapshot_table_name);
2498
  } // foreach
2499
  } else {
2500
  return new WP_Error(1, 'Can\'t get table status data.');
2537
 
2538
  $tables = $wpdb->get_col($wpdb->prepare('SHOW TABLES LIKE %s', array($uid . '\_%')));
2539
  foreach ($tables as $table) {
2540
+ $wpdb->wpreset_snapshot_table = $table;
2541
+ $wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->wpreset_snapshot_table);
2542
  }
2543
 
2544
  $snapshot_copy = $snapshots[$uid];
2645
  continue;
2646
  }
2647
 
2648
+ $wpdb->wpreset_snapshot_table = $table->Name;
2649
+ $wpdb->query('DROP TABLE ' . $wpdb->wpreset_snapshot_table);
2650
  } // foreach
2651
 
2652
  // copy snapshot tables to original name
2653
  foreach ($new_tables as $table) {
2654
+ $wpdb->wpreset_snapshot_table = $table;
2655
+ $wpdb->wpreset_snapshot_table_new = str_replace($uid . '_', '', $table);
2656
 
2657
+ $wpdb->query("CREATE TABLE " . $wpdb->wpreset_snapshot_table_new . " LIKE " . $wpdb->wpreset_snapshot_table);
2658
+ $wpdb->query("INSERT " . $wpdb->wpreset_snapshot_table_new . " SELECT * FROM " . $wpdb->wpreset_snapshot_table);
2659
  }
2660
 
2661
  wp_cache_flush();
2750
  $info['rows'] = $table->Rows;
2751
  $info['size_data'] = $table->Data_length;
2752
  $info['size_index'] = $table->Index_length;
2753
+ $wpdb->wpreset_table_name = $table->Name;
2754
+ $schema = $wpdb->get_row('SHOW CREATE TABLE ' . $wpdb->wpreset_table_name, ARRAY_N);
2755
  $info['schema'] = $schema[1];
2756
  $info['engine'] = $table->Engine;
2757
  $info['fullname'] = $table->Name;
2942
 
2943
  do {
2944
  $cnt++;
2945
+ $uid = substr(str_shuffle(str_repeat('abcdefghijklmnopqrstuvwxyz', 6)), 0, 6);
2946
 
2947
  $verify_db = $wpdb->get_col($wpdb->prepare('SHOW TABLES LIKE %s', array('%' . $uid . '%')));
2948
  } while (!empty($verify_db) && isset($snapshots[$uid]) && $cnt < 30);