Advanced Database Cleaner - Version 3.0.1

Version Description

  • 26/08/2020 =
  • Fix: some calls in the JS file has been corrected
  • Fix: the warning "Deprecated: array_key_exists()" is now solved
  • Fix: an issue of 'failed to open stream: No such file or directory' is now solved
  • Tested with WordPress 5.5
  • New features very soon!
Download this release

Release Info

Developer symptote
Plugin Icon 128x128 Advanced Database Cleaner
Version 3.0.1
Comparing to
See all releases

Code changes from version 3.0.0 to 3.0.1

README.txt CHANGED
@@ -4,8 +4,8 @@ Donate Link: https://www.sigmaplugin.com/donation
4
  Tags: clean, clean up, cleanup, database, optimize, performance, speed, optimizing, clean-up, orphan, orphaned, tables, options
5
  Requires at least: 3.1.0
6
  Requires PHP: 5.0
7
- Tested up to: 5.4
8
- Stable tag: 3.0.0
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -135,6 +135,13 @@ This section describes how to install the plugin. In general, there are 3 ways t
135
 
136
  == Changelog ==
137
 
 
 
 
 
 
 
 
138
  = 3.0.0 - 05/12/2019 =
139
  * IMPORTANT NOTICE FOR PRO USERS: After you upgrade to 3.0.0 from an old version, you will notice that WordPress has deactivated the plugin due to an error: 'Plugin file does not exist'. This is because we have renamed the pro plugin folder name from "advanced-db-cleaner" to "advanced-database-cleaner-pro", causing the WordPress to not being able to find the old one and therefore deactivating the plugin. Just activate it again. It doesn’t break anything. Once you activate the plugin again it will continue working normally without any issues. You will also probably lose the pro version after this upgrade (This is due to a conflict between the free and pro versions which is now solved). If it is the case, please follow these steps to restore your pro version with all new features: (https://sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0)
140
 
4
  Tags: clean, clean up, cleanup, database, optimize, performance, speed, optimizing, clean-up, orphan, orphaned, tables, options
5
  Requires at least: 3.1.0
6
  Requires PHP: 5.0
7
+ Tested up to: 5.5
8
+ Stable tag: 3.0.1
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
135
 
136
  == Changelog ==
137
 
138
+ = 3.0.1 - 26/08/2020 =
139
+ - Fix: some calls in the JS file has been corrected
140
+ - Fix: the warning "Deprecated: array_key_exists()" is now solved
141
+ - Fix: an issue of 'failed to open stream: No such file or directory' is now solved
142
+ - Tested with WordPress 5.5
143
+ - New features very soon!
144
+
145
  = 3.0.0 - 05/12/2019 =
146
  * IMPORTANT NOTICE FOR PRO USERS: After you upgrade to 3.0.0 from an old version, you will notice that WordPress has deactivated the plugin due to an error: 'Plugin file does not exist'. This is because we have renamed the pro plugin folder name from "advanced-db-cleaner" to "advanced-database-cleaner-pro", causing the WordPress to not being able to find the old one and therefore deactivating the plugin. Just activate it again. It doesn’t break anything. Once you activate the plugin again it will continue working normally without any issues. You will also probably lose the pro version after this upgrade (This is due to a conflict between the free and pro versions which is now solved). If it is the case, please follow these steps to restore your pro version with all new features: (https://sigmaplugin.com/blog/restore-pro-version-after-upgrade-to-3-0-0)
147
 
advanced-db-cleaner.php CHANGED
@@ -5,7 +5,7 @@ if (!is_main_site()) return;
5
  Plugin Name: Advanced Database Cleaner
6
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
7
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
8
- Version: 3.0.0
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
@@ -30,7 +30,7 @@ class ADBC_Advanced_DB_Cleaner {
30
 
31
  // Define common constants that should be modified in each version
32
  if(!defined("ADBC_PLUGIN_F_TYPE")) define("ADBC_PLUGIN_F_TYPE", "free");
33
- if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.0");
34
 
35
  // Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
36
  add_action('plugins_loaded', array($this, 'plugins_loaded'));
@@ -317,14 +317,14 @@ class ADBC_Advanced_DB_Cleaner {
317
  delete_option('aDBc_tasks_status');
318
 
319
  // These options are temp and should not exist after finishing the search of oprhans. We make sure to clean them just in case
320
- $array_items = array('options','tables','tasks');
321
- foreach($array_items as $item){
322
- delete_option('aDBc_temp_last_iteration_' . $item);
323
- delete_option('aDBc_temp_still_searching_' . $item);
324
- delete_option('aDBc_temp_last_item_line_' . $item);
325
- delete_option('aDBc_temp_last_file_line_' . $item);
326
- delete_option('aDBc_last_search_ok_') . $item;
327
- }
328
 
329
  // if we are in pro version, clean these ones
330
  if(ADBC_PLUGIN_F_TYPE == "pro"){
5
  Plugin Name: Advanced Database Cleaner
6
  Plugin URI: https://sigmaplugin.com/downloads/wordpress-advanced-database-cleaner
7
  Description: Clean database by deleting unused data such as 'old revisions', 'old drafts', 'orphan options', etc. Optimize database and more.
8
+ Version: 3.0.1
9
  Author: Younes JFR.
10
  Author URI: https://www.sigmaplugin.com
11
  Contributors: symptote
30
 
31
  // Define common constants that should be modified in each version
32
  if(!defined("ADBC_PLUGIN_F_TYPE")) define("ADBC_PLUGIN_F_TYPE", "free");
33
+ if(!defined("ADBC_PLUGIN_VERSION")) define("ADBC_PLUGIN_VERSION", "3.0.1");
34
 
35
  // Prevent conflicts between free and pro, load text-domain and check if should update settings after upgrade
36
  add_action('plugins_loaded', array($this, 'plugins_loaded'));
317
  delete_option('aDBc_tasks_status');
318
 
319
  // These options are temp and should not exist after finishing the search of oprhans. We make sure to clean them just in case
320
+ //$array_items = array('options','tables','tasks');
321
+ //foreach($array_items as $item){
322
+ //delete_option('aDBc_temp_last_iteration_' . $item);
323
+ //delete_option('aDBc_temp_still_searching_' . $item);
324
+ //delete_option('aDBc_temp_last_item_line_' . $item);
325
+ //delete_option('aDBc_temp_last_file_line_' . $item);
326
+ //delete_option('aDBc_last_search_ok_' . $item);
327
+ //}
328
 
329
  // if we are in pro version, clean these ones
330
  if(ADBC_PLUGIN_F_TYPE == "pro"){
includes/class_clean_tables.php CHANGED
@@ -95,9 +95,9 @@ class ADBC_Tables_List extends WP_List_Table {
95
  $table_name = "";
96
  // This test to prevent issues in MySQL 8 where tables are not shown
97
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
98
- if(array_key_exists("table_name", $table)){
99
  $table_name = $table->table_name;
100
- }else if(array_key_exists("TABLE_NAME", $table)){
101
  $table_name = $table->TABLE_NAME;
102
  }
103
 
@@ -113,9 +113,9 @@ class ADBC_Tables_List extends WP_List_Table {
113
  $table_name = "";
114
  // This test to prevent issues in MySQL 8 where tables are not shown
115
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
116
- if(array_key_exists("table_name", $table)){
117
  $table_name = $table->table_name;
118
- }else if(array_key_exists("TABLE_NAME", $table)){
119
  $table_name = $table->TABLE_NAME;
120
  }
121
 
95
  $table_name = "";
96
  // This test to prevent issues in MySQL 8 where tables are not shown
97
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
98
+ if(property_exists($table, "table_name")){
99
  $table_name = $table->table_name;
100
+ }else if(property_exists($table, "TABLE_NAME")){
101
  $table_name = $table->TABLE_NAME;
102
  }
103
 
113
  $table_name = "";
114
  // This test to prevent issues in MySQL 8 where tables are not shown
115
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
116
+ if(property_exists($table, "table_name")){
117
  $table_name = $table->table_name;
118
+ }else if(property_exists($table, "TABLE_NAME")){
119
  $table_name = $table->TABLE_NAME;
120
  }
121
 
includes/functions.php CHANGED
@@ -248,9 +248,9 @@ function aDBc_optimize_scheduled_tables($schedule_name){
248
  $table_name = "";
249
  // This test to prevent issues in MySQL 8 where tables are not shown
250
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
251
- if(array_key_exists("table_name", $table)){
252
  $table_name = $table->table_name;
253
- }else if(array_key_exists("TABLE_NAME", $table)){
254
  $table_name = $table->TABLE_NAME;
255
  }
256
 
@@ -267,9 +267,9 @@ function aDBc_optimize_scheduled_tables($schedule_name){
267
  $table_name = "";
268
  // This test to prevent issues in MySQL 8 where tables are not shown
269
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
270
- if(array_key_exists("table_name", $table)){
271
  $table_name = $table->table_name;
272
- }else if(array_key_exists("TABLE_NAME", $table)){
273
  $table_name = $table->TABLE_NAME;
274
  }
275
 
@@ -523,36 +523,30 @@ function aDBc_prepare_items_to_display(
523
  switch($items_type){
524
  case 'tasks' :
525
  $aDBc_all_items = aDBc_get_all_scheduled_tasks();
526
- //$aDBc_saved_items = get_option("aDBc_tasks_status");
527
- $aDBc_saved_items_file = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tasks.txt", "r");
528
  $aDBc_items_categories_info = array(
529
- 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
530
  'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
531
  'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
532
  'p' => array('name' => __('Plugins tasks', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
533
- 't' => array('name' => __('Themes tasks', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
534
- 'w' => array('name' => __('WP tasks', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
535
  );
536
  break;
537
  case 'options' :
538
  $aDBc_all_items = aDBc_get_all_options();
539
- //$aDBc_saved_items = get_option("aDBc_options_status");
540
- $aDBc_saved_items_file = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/options.txt", "r");
541
  $aDBc_items_categories_info = array(
542
- 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
543
  'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
544
  'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
545
- 'p' => array('name' => __('Plugins options', 'advanced-database-cleaner'),'color' => '#00BAFF', 'count' => 0),
546
  't' => array('name' => __('Themes options', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
547
  'w' => array('name' => __('WP options', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
548
  );
549
  break;
550
  case 'tables' :
551
  $aDBc_all_items = aDBc_get_all_tables();
552
- //$aDBc_saved_items = get_option("aDBc_tables_status");
553
- $aDBc_saved_items_file = @fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/tables.txt", "r");
554
  $aDBc_items_categories_info = array(
555
- 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
556
  'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
557
  'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
558
  'p' => array('name' => __('Plugins tables', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
@@ -562,6 +556,12 @@ function aDBc_prepare_items_to_display(
562
  break;
563
  }
564
 
 
 
 
 
 
 
565
  // Affect type and belongs_to to items.
566
  if ($aDBc_saved_items_file) {
567
  while(($item = fgets($aDBc_saved_items_file)) !== false) {
@@ -842,9 +842,9 @@ function aDBc_get_all_tables() {
842
  $table_name = "";
843
  // This test to prevent issues in MySQL 8 where tables are not shown
844
  // MySQL 5 uses $aDBc_table->table_name while MySQL 8 uses $aDBc_table->TABLE_NAME
845
- if(array_key_exists("table_name", $aDBc_table)){
846
  $table_name = $aDBc_table->table_name;
847
- }else if(array_key_exists("TABLE_NAME", $aDBc_table)){
848
  $table_name = $aDBc_table->TABLE_NAME;
849
  }
850
 
248
  $table_name = "";
249
  // This test to prevent issues in MySQL 8 where tables are not shown
250
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
251
+ if(property_exists($table, "table_name")){
252
  $table_name = $table->table_name;
253
+ }else if(property_exists($table, "TABLE_NAME")){
254
  $table_name = $table->TABLE_NAME;
255
  }
256
 
267
  $table_name = "";
268
  // This test to prevent issues in MySQL 8 where tables are not shown
269
  // MySQL 5 uses $table->table_name while MySQL 8 uses $table->TABLE_NAME
270
+ if(property_exists($table, "table_name")){
271
  $table_name = $table->table_name;
272
+ }else if(property_exists($table, "TABLE_NAME")){
273
  $table_name = $table->TABLE_NAME;
274
  }
275
 
523
  switch($items_type){
524
  case 'tasks' :
525
  $aDBc_all_items = aDBc_get_all_scheduled_tasks();
 
 
526
  $aDBc_items_categories_info = array(
527
+ 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
528
  'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
529
  'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
530
  'p' => array('name' => __('Plugins tasks', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
531
+ 't' => array('name' => __('Themes tasks', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
532
+ 'w' => array('name' => __('WP tasks', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
533
  );
534
  break;
535
  case 'options' :
536
  $aDBc_all_items = aDBc_get_all_options();
 
 
537
  $aDBc_items_categories_info = array(
538
+ 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
539
  'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
540
  'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
541
+ 'p' => array('name' => __('Plugins options', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
542
  't' => array('name' => __('Themes options', 'advanced-database-cleaner'), 'color' => '#45C966', 'count' => 0),
543
  'w' => array('name' => __('WP options', 'advanced-database-cleaner'), 'color' => '#D091BE', 'count' => 0)
544
  );
545
  break;
546
  case 'tables' :
547
  $aDBc_all_items = aDBc_get_all_tables();
 
 
548
  $aDBc_items_categories_info = array(
549
+ 'all' => array('name' => __('All', 'advanced-database-cleaner'), 'color' => '#4E515B', 'count' => 0),
550
  'u' => array('name' => __('Uncategorized', 'advanced-database-cleaner'), 'color' => 'grey', 'count' => 0),
551
  'o' => array('name' => __('Orphans','advanced-database-cleaner'), 'color' => '#E97F31', 'count' => 0),
552
  'p' => array('name' => __('Plugins tables', 'advanced-database-cleaner'), 'color' => '#00BAFF', 'count' => 0),
556
  break;
557
  }
558
 
559
+ $aDBc_saved_items_file = "";
560
+ // xxx change this later, no need for this test in the free verion. Moreover, ADBC_UPLOAD_DIR_PATH_TO_ADBC is not defined here
561
+ /*if(file_exists(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . ".txt")){
562
+ $aDBc_saved_items_file = fopen(ADBC_UPLOAD_DIR_PATH_TO_ADBC . "/" . $items_type . ".txt", "r");
563
+ }*/
564
+
565
  // Affect type and belongs_to to items.
566
  if ($aDBc_saved_items_file) {
567
  while(($item = fgets($aDBc_saved_items_file)) !== false) {
842
  $table_name = "";
843
  // This test to prevent issues in MySQL 8 where tables are not shown
844
  // MySQL 5 uses $aDBc_table->table_name while MySQL 8 uses $aDBc_table->TABLE_NAME
845
+ if(property_exists($aDBc_table, "table_name")){
846
  $table_name = $aDBc_table->table_name;
847
+ }else if(property_exists($aDBc_table, "TABLE_NAME")){
848
  $table_name = $aDBc_table->TABLE_NAME;
849
  }
850
 
js/admin.js CHANGED
@@ -203,7 +203,7 @@ jQuery(function($) {
203
  });
204
 
205
  $("#doaction").click(function(event) {
206
- var $bulk_action = $('#bulk-action-selector-top').attr('value');
207
  if($bulk_action == 'delete' || $bulk_action == 'clean'){
208
  event.preventDefault();
209
  $delete_warning.dialog('open');
@@ -217,7 +217,7 @@ jQuery(function($) {
217
  });
218
 
219
  $("#doaction2").click(function(event) {
220
- var $bulk_action = $('#bulk-action-selector-bottom').attr('value');
221
  if($bulk_action == 'delete' || $bulk_action == 'clean'){
222
  event.preventDefault();
223
  $delete_warning.dialog('open');
203
  });
204
 
205
  $("#doaction").click(function(event) {
206
+ var $bulk_action = $('#bulk-action-selector-top').val();
207
  if($bulk_action == 'delete' || $bulk_action == 'clean'){
208
  event.preventDefault();
209
  $delete_warning.dialog('open');
217
  });
218
 
219
  $("#doaction2").click(function(event) {
220
+ var $bulk_action = $('#bulk-action-selector-bottom').val();
221
  if($bulk_action == 'delete' || $bulk_action == 'clean'){
222
  event.preventDefault();
223
  $delete_warning.dialog('open');