Optimize Database after Deleting Revisions - Version 4.3

Version Description

[07/24/2017] = * NEW: New setting added: Delete revisions of (POSTS and PAGES, POSTS only or PAGES only) * CHANGE: Some code clean-up and minor changes

Download this release

Release Info

Developer cageehv
Plugin Icon 128x128 Optimize Database after Deleting Revisions
Version 4.3
Comparing to
See all releases

Code changes from version 4.2.3 to 4.3

classes/odb-cleaner.php CHANGED
@@ -6,8 +6,7 @@
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
- class ODB_Cleaner
10
- {
11
  var $start_size;
12
  var $nr_of_optimized_tables;
13
 
@@ -15,20 +14,17 @@ class ODB_Cleaner
15
  /********************************************************************************************
16
  * CONSTRUCTOR
17
  ********************************************************************************************/
18
- function __construct()
19
- {
20
  } // __construct()
21
 
22
 
23
  /********************************************************************************************
24
  * RUN CLEANER
25
  ********************************************************************************************/
26
- function odb_run_cleaner($scheduler)
27
- {
28
  global $odb_class;
29
 
30
- if(!$scheduler)
31
- {
32
  echo '
33
  <div id="odb-cleaner" class="odb-padding-left">
34
  <div class="odb-title-bar">
@@ -37,7 +33,7 @@ class ODB_Cleaner
37
  <br>
38
  <br>
39
  ';
40
- }
41
 
42
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
43
  $this->start_size = $odb_class->odb_utilities_obj->odb_get_db_size();
@@ -62,24 +58,22 @@ class ODB_Cleaner
62
  /****************************************************************************************
63
  * DELETE REVISIONS
64
  ****************************************************************************************/
65
- if($odb_class->odb_rvg_options['delete_older'] == 'Y' || $odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
66
- {
67
  // FIND REVISIONS
68
  $results_older_than = array();
69
- if($odb_class->odb_rvg_options['delete_older'] == 'Y')
70
- { $results_older_than = $this->odb_get_revisions_older_than();
71
  }
72
 
73
  $results_keep_revisions = array();
74
- if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
75
- { $results_keep_revisions = $this->odb_get_revisions_keep_revisions();
76
  }
77
 
78
  $total_deleted = 0;
79
- if(count($results_older_than) > 0 || count($results_keep_revisions) > 0)
80
- { // WE HAVE REVISIONS TO DELETE!
81
- if(!$scheduler)
82
- {
83
  ?>
84
  <table border="0" cellspacing="8" cellpadding="2" class="odb-result-table">
85
  <tr>
@@ -100,8 +94,7 @@ class ODB_Cleaner
100
  // LOOP THROUGH THE REVISIONS AND DELETE THEM
101
  $total_deleted = $this->odb_delete_revisions($scheduler);
102
 
103
- if(!$scheduler)
104
- {
105
  ?>
106
  <tr>
107
  <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of revisions deleted', $odb_class->odb_txt_domain);?></td>
@@ -110,10 +103,8 @@ class ODB_Cleaner
110
  </table>
111
  <?php
112
  } // if(!$scheduler)
113
- }
114
- else
115
- { if(!$scheduler)
116
- {
117
  ?>
118
  <div class="odb-not-found">
119
  <?php _e('No REVISIONS found to delete', $odb_class->odb_txt_domain);?>
@@ -130,16 +121,14 @@ class ODB_Cleaner
130
  /****************************************************************************************
131
  * DELETE TRASHED ITEMS
132
  ****************************************************************************************/
133
- if($odb_class->odb_rvg_options['clear_trash'] == 'Y')
134
- {
135
  // GET TRASHED POSTS / PAGES AND COMMENTS
136
  $results = $this->odb_get_trash();
137
 
138
  $total_deleted = 0;
139
- if(count($results)>0)
140
- { // WE HAVE TRASH TO DELETE!
141
- if(!$scheduler)
142
- {
143
  ?>
144
  <table border="0" cellspacing="8" cellpadding="2" class="odb-result-table">
145
  <tr>
@@ -160,8 +149,7 @@ class ODB_Cleaner
160
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
161
  $total_deleted = $this->odb_delete_trash($results, $scheduler);
162
 
163
- if(!$scheduler)
164
- {
165
  ?>
166
  <tr>
167
  <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of trashed items deleted', $odb_class->odb_txt_domain);?></td>
@@ -170,11 +158,8 @@ class ODB_Cleaner
170
  </table>
171
  <?php
172
  } // if(!$scheduler)
173
- }
174
- else
175
- {
176
- if(!$scheduler)
177
- {
178
  ?>
179
  <div class="odb-not-found">
180
  <?php _e('No TRASHED ITEMS found to delete', $odb_class->odb_txt_domain);?>
@@ -191,16 +176,14 @@ class ODB_Cleaner
191
  /****************************************************************************************
192
  * DELETE SPAMMED ITEMS
193
  ****************************************************************************************/
194
- if($odb_class->odb_rvg_options['clear_spam'] == 'Y')
195
- {
196
  // GET SPAMMED COMMENTS
197
  $results = $this->odb_get_spam();
198
 
199
  $total_deleted = 0;
200
- if(count($results)>0)
201
- { // WE HAVE SPAM TO DELETE!
202
- if (!$scheduler)
203
- {
204
  ?>
205
  <table border="0" cellspacing="8" cellpadding="2" class="odb-result-table">
206
  <tr>
@@ -221,8 +204,7 @@ class ODB_Cleaner
221
  // LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
222
  $total_deleted = $this->odb_delete_spam($results, $scheduler);
223
 
224
- if (!$scheduler)
225
- {
226
  ?>
227
  <tr>
228
  <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of spammed items deleted', $odb_class->odb_txt_domain);?></td>
@@ -231,11 +213,8 @@ class ODB_Cleaner
231
  </table>
232
  <?php
233
  } // if (!$scheduler)
234
- }
235
- else
236
- {
237
- if (!$scheduler)
238
- {
239
  ?>
240
  <div class="odb-not-found">
241
  <?php _e('No SPAMMED ITEMS found to delete', $odb_class->odb_txt_domain);?>
@@ -252,24 +231,19 @@ class ODB_Cleaner
252
  /****************************************************************************************
253
  * DELETE UNUSED TAGS
254
  ****************************************************************************************/
255
- if($odb_class->odb_rvg_options['clear_tags'] == 'Y')
256
- {
257
  // DELETE UNUSED TAGS
258
  $total_deleted = $this->odb_delete_tags();
259
- if($total_deleted>0)
260
- { // TAGS DELETED
261
- if (!$scheduler)
262
- {
263
  ?>
264
  <div class="odb-found-number">
265
  <?php _e('NUMBER OF UNUSED TAGS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
266
  <?php
267
  } // if (!$scheduler)
268
- }
269
- else
270
- {
271
- if (!$scheduler)
272
- {
273
  ?>
274
  <div class="odb-not-found">
275
  <?php _e('No UNUSED TAGS found to delete', $odb_class->odb_txt_domain);?>
@@ -286,24 +260,19 @@ class ODB_Cleaner
286
  /****************************************************************************************
287
  * DELETE EXPIRED TRANSIENTS
288
  ****************************************************************************************/
289
- if($odb_class->odb_rvg_options['clear_transients'] == 'Y')
290
- {
291
  // DELETE UNUSED TAGS
292
  $total_deleted = $this->odb_delete_transients();
293
- if($total_deleted>0)
294
- { // TRANSIENTS DELETED
295
- if (!$scheduler)
296
- {
297
  ?>
298
  <div class="odb-found-number">
299
  <?php _e('NUMBER OF EXPIRED TRANSIENTS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
300
  <?php
301
  } // if (!$scheduler)
302
- }
303
- else
304
- {
305
- if (!$scheduler)
306
- {
307
  ?>
308
  <div class="odb-not-found">
309
  <?php _e('No EXPIRED TRANSIENTS found to delete', $odb_class->odb_txt_domain);?>
@@ -320,24 +289,19 @@ class ODB_Cleaner
320
  /****************************************************************************************
321
  * DELETE PINGBACKS AND TRACKBACKS
322
  ****************************************************************************************/
323
- if($odb_class->odb_rvg_options['clear_pingbacks'] == 'Y')
324
- {
325
  // DELETE UNUSED TAGS
326
  $total_deleted = $this->odb_delete_pingbacks();
327
- if($total_deleted>0)
328
- { // PINGBACKS / TRACKBACKS DELETED\
329
- if (!$scheduler)
330
- {
331
  ?>
332
  <div class="odb-found-number">
333
  <?php _e('NUMBER OF PINGBACKS AND TRACKBACKS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
334
  <?php
335
  } // if (!$scheduler)
336
- }
337
- else
338
- {
339
- if (!$scheduler)
340
- {
341
  ?>
342
  <div class="odb-not-found">
343
  <?php _e('No PINGBACKS nor TRACKBACKS found to delete', $odb_class->odb_txt_domain);?>
@@ -355,20 +319,15 @@ class ODB_Cleaner
355
  * DELETE ORPHANS
356
  ****************************************************************************************/
357
  $total_deleted = $this->odb_delete_orphans();
358
- if($total_deleted > 0)
359
- {
360
- if (!$scheduler)
361
- {
362
  ?>
363
  <div class="odb-found-number">
364
  <?php _e('NUMBER OF POSTMETA ORPHANS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
365
  <?php
366
  } // if (!$scheduler)
367
- }
368
- else
369
- {
370
- if (!$scheduler)
371
- {
372
  ?>
373
  <div class="odb-not-found">
374
  <?php _e('No POSTMETA ORPHANS found to delete', $odb_class->odb_txt_domain);?>
@@ -379,23 +338,21 @@ class ODB_Cleaner
379
  // FOR LOG FILE
380
  $odb_class->log_arr["orphans"] = $total_deleted;
381
 
382
- if (!$scheduler)
383
- {
384
  ?>
385
  </div><!-- /odb-cleaner -->
386
  <?php
387
- }
388
  } // odb_run_cleaner()
389
 
390
 
391
  /********************************************************************************************
392
  * RUN OPTIMIZER
393
  ********************************************************************************************/
394
- function odb_run_optimizer($scheduler)
395
- { global $odb_class;
396
 
397
- if(!$scheduler)
398
- {
399
  ?>
400
  <div class="odb-optimizing-table" class="odb-padding-left">
401
  <div class="odb-title-bar">
@@ -418,8 +375,7 @@ class ODB_Cleaner
418
  # OPTIMIZE THE DATABASE TABLES
419
  $this->nr_of_optimized_tables = $this->odb_optimize_tables($scheduler);
420
 
421
- if(!$scheduler)
422
- {
423
  ?>
424
  </table>
425
  </div><!-- /odb-optimizing-table -->
@@ -431,8 +387,8 @@ class ODB_Cleaner
431
  /********************************************************************************************
432
  * CALCULATE AND DISPLAY SAVINGS
433
  ********************************************************************************************/
434
- function odb_savings($scheduler)
435
- { global $odb_class;
436
  global $odb_logger_obj;
437
 
438
  // NUMBER OF TABLES
@@ -453,8 +409,7 @@ class ODB_Cleaner
453
 
454
  $odb_class->odb_multisite_obj->odb_ms_update_option('odb_rvg_options', $odb_class->odb_rvg_options);
455
 
456
- if(!$scheduler)
457
- {
458
  ?>
459
  <div id="odb-savings" class="odb-padding-left">
460
  <div class="odb-title-bar">
@@ -493,8 +448,7 @@ class ODB_Cleaner
493
  /********************************************************************************************
494
  * SHOW LOADING TIME
495
  ********************************************************************************************/
496
- function odb_done()
497
- {
498
  global $odb_class;
499
 
500
  $time = microtime();
@@ -534,34 +488,45 @@ class ODB_Cleaner
534
  /********************************************************************************************
535
  * GET REVISIONS (OLDER THAN x DAYS)
536
  ********************************************************************************************/
537
- function odb_get_revisions_older_than()
538
- {
539
  global $odb_class, $wpdb;
540
 
541
  $res_arr = array();
542
 
 
 
 
 
543
  $older_than = $odb_class->odb_rvg_options['older_than'];
544
 
545
  $index = 0;
546
 
547
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
548
- { $sql = sprintf("
549
- SELECT `ID`, `post_parent`, `post_title`, `post_modified`
550
- FROM %sposts
551
- WHERE `post_type` = 'revision'
552
- AND `post_modified` < date_sub(now(), INTERVAL %d DAY)
553
- ORDER BY UCASE(`post_title`)
554
- ", $odb_class->odb_ms_prefixes[$i], $older_than);
555
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
556
  $res = $wpdb->get_results($sql, ARRAY_A);
557
 
558
- for($j=0; $j<count($res); $j++)
559
- { if(isset($res[$j]) && !$this->odb_post_is_excluded($res[$j]['post_parent']))
560
- { $res_arr[$index] = $res[$j];
561
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
562
  $index++;
563
- }
564
- }
 
565
  } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
566
 
567
  return $res_arr;
@@ -571,11 +536,14 @@ class ODB_Cleaner
571
  /********************************************************************************************
572
  * GET REVISIONS (KEEP MAX NUMBER OF REVISIONS)
573
  ********************************************************************************************/
574
- function odb_get_revisions_keep_revisions()
575
- {
576
  global $odb_class, $wpdb;
577
 
578
  $res_arr = array();
 
 
 
 
579
 
580
  // MAX NUMBER OF REVISIONS TO KEEP
581
  $max_revisions = $odb_class->odb_rvg_options['nr_of_revisions'];
@@ -583,27 +551,35 @@ class ODB_Cleaner
583
  $index = 0;
584
 
585
  // SKIP REVISIONS THAT WILL BE DELETED BY THE 'OLDER THAN' OPTION
586
- $where = '';
587
- if($odb_class->odb_rvg_options['delete_older'] == 'Y')
588
- { $older_than = $odb_class->odb_rvg_options['older_than'];
589
- $where = 'AND `post_modified` >= date_sub(now(), INTERVAL '.$older_than.' DAY)';
590
  }
591
 
592
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
593
- { $sql = sprintf ("
594
- SELECT `ID`, `post_parent`, `post_title`, COUNT(*) cnt
595
- FROM %sposts
596
- WHERE `post_type` = 'revision'
 
 
 
597
  %s
598
- GROUP BY `post_parent`
599
  HAVING COUNT(*) > %d
600
- ORDER BY UCASE(`post_title`)
601
- ", $odb_class->odb_ms_prefixes[$i], $where, $max_revisions);
 
 
 
 
 
602
 
603
  $res = $wpdb->get_results($sql, ARRAY_A);
604
- for($j=0; $j<count($res); $j++)
605
- { if(isset($res[$j]) && !$this->odb_post_is_excluded($res[$j]['post_parent']))
606
- { $res_arr[$index] = $res[$j];
607
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
608
  $index++;
609
  }
@@ -617,23 +593,20 @@ class ODB_Cleaner
617
  /********************************************************************************************
618
  * DELETE THE REVISIONS
619
  ********************************************************************************************/
620
- function odb_delete_revisions($scheduler)
621
- {
622
  global $odb_class, $wpdb;
623
 
624
  $total_deleted = 0;
625
  $nr = 1;
626
 
627
- if($odb_class->odb_rvg_options['delete_older'] == 'Y')
628
- { // DELETE REVISIONS OLDER THAN x DAYS
629
  $results = $this->odb_get_revisions_older_than();
630
  $older_than = $odb_class->odb_rvg_options['older_than'];
631
  $total_deleted += count($results);
632
 
633
- for($i=0; $i<count($results); $i++)
634
- {
635
- if (!$scheduler)
636
- {
637
  ?>
638
  <tr>
639
  <td align="right" valign="top"><?php echo $nr?>.</td>
@@ -650,8 +623,7 @@ class ODB_Cleaner
650
  $wpdb->get_results($sql_delete);
651
 
652
  $nr++;
653
- if(!$scheduler)
654
- {
655
  ?>
656
  <td align="right" valign="top" class="odb-bold">1</td>
657
  </tr>
@@ -660,17 +632,16 @@ class ODB_Cleaner
660
  } // for($i=0; $i<count($results); $i++)
661
  } // if($odb_class->odb_rvg_options['delete_older'] == 'Y')
662
 
663
- if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
664
- { // KEEP MAX NUMBER OF REVISIONS
665
  $results = $this->odb_get_revisions_keep_revisions();
666
  $max_revisions = $odb_class->odb_rvg_options['nr_of_revisions'];
667
 
668
- for($i=0; $i<count($results); $i++)
669
- { $nr_to_delete = $results[$i]['cnt'] - $max_revisions;
670
  $total_deleted += $nr_to_delete;
671
 
672
- if (!$scheduler)
673
- {
674
  ?>
675
  <tr>
676
  <td align="right" valign="top"><?php echo $nr?>.</td>
@@ -689,24 +660,19 @@ class ODB_Cleaner
689
 
690
  $results_get_posts = $wpdb->get_results($sql_get_posts);
691
 
692
- for($j=0; $j<$nr_to_delete; $j++)
693
- {
694
- //if (!$this->odb_post_is_excluded($results_get_posts[$j]['ID']))
695
- //{
696
- if(!$scheduler) echo $results_get_posts[$j]->post_modified.'<br />';
697
-
698
- $sql_delete = sprintf ("
699
- DELETE FROM %sposts
700
- WHERE `ID` = %d
701
- ", $results[$i]['site'], $results_get_posts[$j]->ID);
702
-
703
- $wpdb->get_results($sql_delete);
704
- //}
705
  } // for($j=0; $j<$nr_to_delete; $j++)
706
 
707
  $nr++;
708
- if(!$scheduler)
709
- {
710
  ?></td>
711
  <td align="right" valign="top" class="odb-bold"><?php echo $nr_to_delete?> <?php _e('of', $odb_class->odb_txt_domain)?> <?php echo $results[$i]['cnt'];?></td>
712
  </tr>
@@ -722,8 +688,7 @@ class ODB_Cleaner
722
  /********************************************************************************************
723
  * CHECK IF POST IS EXCLUDED BY A CUSTOM FIELD ('keep_revisions')
724
  ********************************************************************************************/
725
- function odb_post_is_excluded($parent_id)
726
- {
727
  $keep_revisions = get_post_meta($parent_id, 'keep_revisions', true);
728
  return ($keep_revisions === 'Y');
729
  } // odb_post_is_exclude()
@@ -732,16 +697,14 @@ class ODB_Cleaner
732
  /********************************************************************************************
733
  * GET TRASHED POSTS / PAGES AND COMMENTS
734
  ********************************************************************************************/
735
- function odb_get_trash()
736
- {
737
  global $wpdb, $odb_class;
738
 
739
  $res_arr = array();
740
 
741
  $index = 0;
742
  // LOOP TROUGH SITES
743
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
744
- {
745
  $sql = sprintf ("
746
  SELECT `ID` AS id, 'post' AS post_type, `post_title` AS title, `post_modified` AS modified
747
  FROM %sposts
@@ -754,12 +717,12 @@ class ODB_Cleaner
754
  ", $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i]);
755
  $res = $wpdb->get_results($sql, ARRAY_A);
756
 
757
- if($res != null)
758
- { $res_arr[$index] = $res[0];
759
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
760
  $index++;
761
- }
762
- }
763
 
764
  return $res_arr;
765
  } // odb_get_trash()
@@ -768,16 +731,14 @@ class ODB_Cleaner
768
  /********************************************************************************************
769
  * DELETE TRASHED POSTS AND PAGES
770
  ********************************************************************************************/
771
- function odb_delete_trash($results, $scheduler)
772
- {
773
  global $wpdb;
774
 
775
  $nr = 1;
776
  $total_deleted = count($results);
777
 
778
- for($i=0; $i<$total_deleted; $i++)
779
- { if(!$scheduler)
780
- {
781
  ?>
782
  <tr>
783
  <td align="right" valign="top"><?php echo $nr; ?></td>
@@ -789,14 +750,14 @@ class ODB_Cleaner
789
  <?php
790
  } // if(!$scheduler)
791
 
792
- if($results[$i]['post_type'] == 'comment')
793
- { // DELETE META DATA (IF ANY...)
794
  $sql_delete = sprintf ("
795
  DELETE FROM %scommentmeta
796
  WHERE `comment_id` = %d
797
  ", $results[$i]['site'], $results[$i]['id']);
798
  $wpdb->get_results($sql_delete);
799
- }
800
 
801
  // DELETE TRASHED POSTS / PAGES
802
  $sql_delete = sprintf ("
@@ -822,16 +783,14 @@ class ODB_Cleaner
822
  /********************************************************************************************
823
  * GET SPAMMED COMMENTS
824
  ********************************************************************************************/
825
- function odb_get_spam()
826
- {
827
  global $wpdb, $odb_class;
828
 
829
  $res_arr = array();
830
 
831
  $index = 0;
832
  // LOOP THROUGH SITES
833
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
834
- {
835
  $sql = sprintf ("
836
  SELECT `comment_ID`, `comment_author`, `comment_author_email`, `comment_date`
837
  FROM %scomments
@@ -840,15 +799,14 @@ class ODB_Cleaner
840
  ", $odb_class->odb_ms_prefixes[$i]);
841
  $res = $wpdb->get_results($sql, ARRAY_A);
842
 
843
- if($res != null)
844
- { $res_arr[$index] = $res[0];
845
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
846
  $index++;
847
- }
848
- }
849
 
850
  return $res_arr;
851
-
852
  } // odb_get_spam()
853
 
854
 
@@ -861,9 +819,8 @@ class ODB_Cleaner
861
 
862
  $nr = 1;
863
  $total_deleted = count($results);
864
- for($i=0; $i<count($results); $i++)
865
- { if (!$scheduler)
866
- {
867
  ?>
868
  <tr>
869
  <td align="right" valign="top"><?php echo $nr; ?></td>
@@ -891,22 +848,19 @@ class ODB_Cleaner
891
  } // for($i=0; $i<count($results); $i++)
892
 
893
  return $total_deleted;
894
-
895
  } // odb_delete_spam()
896
 
897
 
898
  /********************************************************************************************
899
  * DELETE UNUSED TAGS
900
  ********************************************************************************************/
901
- function odb_delete_tags()
902
- {
903
  global $wpdb, $odb_class;
904
 
905
  $total_deleted = 0;
906
 
907
  // LOOP THROUGH THE NETWORK
908
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
909
- {
910
  $sql = sprintf ("
911
  SELECT a.term_id AS term_id, a.name AS name
912
  FROM `%sterms` a, `%sterm_taxonomy` b
@@ -919,9 +873,9 @@ class ODB_Cleaner
919
  ", $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i]);
920
 
921
  $res = $wpdb->get_results($sql);
922
- for($j=0; $j<count($res); $j++)
923
- { if(!$this->odb_delete_tags_is_scheduled($res[$j]->term_id, $odb_class->odb_ms_prefixes[$i]))
924
- { // TAG NOT USED IN SCHEDULED POSTS: CAN BE DELETED
925
  $total_deleted++;
926
 
927
  $sql_del = sprintf ("
@@ -946,8 +900,7 @@ class ODB_Cleaner
946
  /********************************************************************************************
947
  * IS THE UNUSED TAG USED IN ONE OR MORE SCHEDULED POSTS?
948
  ********************************************************************************************/
949
- function odb_delete_tags_is_scheduled($term_id, $odb_prefix)
950
- {
951
  global $wpdb;
952
 
953
  $sql_get_posts = sprintf ("
@@ -962,15 +915,13 @@ class ODB_Cleaner
962
  if($results_get_posts[$i]->post_status == 'future') return true;
963
 
964
  return false;
965
-
966
  } // odb_delete_tags_is_scheduled()
967
 
968
 
969
  /********************************************************************************************
970
  * DELETE EXPIRED TRANSIENTS
971
  ********************************************************************************************/
972
- function odb_delete_transients()
973
- {
974
  global $wpdb, $odb_class;
975
 
976
  $delay = time() - 60; // ONE MINUTE DELAY
@@ -978,8 +929,7 @@ class ODB_Cleaner
978
  $total_deleted = 0;
979
 
980
  // LOOP THROUGH THE NETWORK
981
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
982
- {
983
  // FIND EXPIRED TRANSIENTS
984
  $sql = "
985
  SELECT `option_name`
@@ -995,23 +945,21 @@ class ODB_Cleaner
995
  $total_deleted += count($results);
996
 
997
  // LOOP THROUGH THE RESULTS
998
- for($j=0; $j<count($results); $j++)
999
- {
1000
- if(substr($results[$j]->option_name, 0, 19) == '_transient_timeout_')
1001
- { // _transient_timeout_%
1002
  $transient = substr($results[$j]->option_name, 19);
1003
  // DELETE THE TRANSIENT
1004
  delete_transient($transient);
1005
- }
1006
- else
1007
- { // _site_transient_timeout_%
1008
  $transient = substr($results[$j]->option_name, 24);
1009
  // DELETE THE TRANSIENT
1010
  delete_site_transient($transient);
1011
- }
1012
  } // for($j=0; $j<count($results); $j++)
1013
-
1014
  } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
 
1015
  return $total_deleted;
1016
  } // odb_delete_transients()
1017
 
@@ -1019,15 +967,13 @@ class ODB_Cleaner
1019
  /********************************************************************************************
1020
  * DELETE PINGBACKS AND TRACKBACKS
1021
  ********************************************************************************************/
1022
- function odb_delete_pingbacks()
1023
- {
1024
  global $wpdb, $odb_class;
1025
 
1026
  $total_deleted = 0;
1027
 
1028
  // LOOP THROUGH THE NETWORK
1029
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
1030
- {
1031
  $sql = sprintf ("
1032
  SELECT `comment_ID`
1033
  FROM %scomments
@@ -1040,8 +986,8 @@ class ODB_Cleaner
1040
  $results = $wpdb->get_results($sql);
1041
  $total_deleted = count($results);
1042
 
1043
- for($j=0; $j<count($results); $j++)
1044
- { // DELETE METADATA FOR THIS COMMENT (IF ANY)
1045
  $sql_delete_meta = sprintf ("
1046
  DELETE FROM %scommentmeta
1047
  WHERE `comment_id` = %d
@@ -1067,8 +1013,7 @@ class ODB_Cleaner
1067
  /********************************************************************************************
1068
  * DELETE ORPHAN POSTMETA AND MEDIA RECORDS
1069
  ********************************************************************************************/
1070
- function odb_delete_orphans()
1071
- {
1072
  global $wpdb, $odb_class;
1073
 
1074
  $meta_orphans = 0;
@@ -1076,8 +1021,7 @@ class ODB_Cleaner
1076
  $media_orphans = 0; // v4.1.7
1077
 
1078
  // LOOP THROUGH THE NETWORK
1079
- for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
1080
- {
1081
  // DELETE POST ORPHANS (AUTO DRAFTS)
1082
  $sql_delete = sprintf ("
1083
  SELECT COUNT(*) cnt
@@ -1090,8 +1034,8 @@ class ODB_Cleaner
1090
 
1091
  $post_orphans = $results[0]->cnt;
1092
 
1093
- if($post_orphans > 0)
1094
- { $sql_delete = sprintf ("
1095
  DELETE FROM %sposts
1096
  WHERE ID NOT IN (SELECT post_id FROM %spostmeta)
1097
  AND post_status = 'auto-draft'
@@ -1110,8 +1054,8 @@ class ODB_Cleaner
1110
 
1111
  $meta_orphans = $results[0]->cnt;
1112
 
1113
- if($meta_orphans > 0)
1114
- { $sql_delete = sprintf ("
1115
  DELETE FROM %spostmeta
1116
  WHERE post_id NOT IN (SELECT ID FROM %sposts)
1117
  ", $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i]);
@@ -1143,6 +1087,7 @@ class ODB_Cleaner
1143
  */
1144
 
1145
  } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
 
1146
  return ($meta_orphans + $post_orphans);
1147
  } // odb_delete_orphans()
1148
 
@@ -1150,15 +1095,13 @@ class ODB_Cleaner
1150
  /********************************************************************************************
1151
  * OPTIMIZE DATABASE TABLES
1152
  ********************************************************************************************/
1153
- function odb_optimize_tables($scheduler)
1154
- {
1155
  global $odb_class, $wpdb;
1156
 
1157
  $cnt = 0;
1158
- for ($i=0; $i<count($odb_class->odb_tables); $i++)
1159
- {
1160
- if(!isset($odb_class->odb_rvg_excluded_tabs[$odb_class->odb_tables[$i][0]]))
1161
- { # TABLE NOT EXCLUDED
1162
  $cnt++;
1163
 
1164
  $sql = sprintf ("
@@ -1169,12 +1112,11 @@ class ODB_Cleaner
1169
  ", DB_NAME, $odb_class->odb_tables[$i][0]);
1170
  $table_info = $wpdb->get_results($sql);
1171
 
1172
- if($odb_class->odb_rvg_options["optimize_innodb"] == 'N' && strtolower($table_info[0]->engine) == 'innodb')
1173
- { // SKIP InnoDB tables
1174
  $msg = __('InnoDB table: skipped...', 'rvg-optimize-database');
1175
- }
1176
- else
1177
- { $query = "OPTIMIZE TABLE ".$odb_class->odb_tables[$i][0];
1178
  $result = $wpdb->get_results($query);
1179
  $msg = $result[0]->Msg_text;
1180
  $msg = str_replace('OK', __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database'), $msg);
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
+ class ODB_Cleaner {
 
10
  var $start_size;
11
  var $nr_of_optimized_tables;
12
 
14
  /********************************************************************************************
15
  * CONSTRUCTOR
16
  ********************************************************************************************/
17
+ function __construct() {
 
18
  } // __construct()
19
 
20
 
21
  /********************************************************************************************
22
  * RUN CLEANER
23
  ********************************************************************************************/
24
+ function odb_run_cleaner($scheduler) {
 
25
  global $odb_class;
26
 
27
+ if(!$scheduler) {
 
28
  echo '
29
  <div id="odb-cleaner" class="odb-padding-left">
30
  <div class="odb-title-bar">
33
  <br>
34
  <br>
35
  ';
36
+ } // if(!$scheduler)
37
 
38
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
39
  $this->start_size = $odb_class->odb_utilities_obj->odb_get_db_size();
58
  /****************************************************************************************
59
  * DELETE REVISIONS
60
  ****************************************************************************************/
61
+ if($odb_class->odb_rvg_options['delete_older'] == 'Y' || $odb_class->odb_rvg_options['rvg_revisions'] == 'Y') {
 
62
  // FIND REVISIONS
63
  $results_older_than = array();
64
+ if($odb_class->odb_rvg_options['delete_older'] == 'Y') {
65
+ $results_older_than = $this->odb_get_revisions_older_than();
66
  }
67
 
68
  $results_keep_revisions = array();
69
+ if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y') {
70
+ $results_keep_revisions = $this->odb_get_revisions_keep_revisions();
71
  }
72
 
73
  $total_deleted = 0;
74
+ if(count($results_older_than) > 0 || count($results_keep_revisions) > 0) {
75
+ // WE HAVE REVISIONS TO DELETE!
76
+ if(!$scheduler) {
 
77
  ?>
78
  <table border="0" cellspacing="8" cellpadding="2" class="odb-result-table">
79
  <tr>
94
  // LOOP THROUGH THE REVISIONS AND DELETE THEM
95
  $total_deleted = $this->odb_delete_revisions($scheduler);
96
 
97
+ if(!$scheduler) {
 
98
  ?>
99
  <tr>
100
  <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of revisions deleted', $odb_class->odb_txt_domain);?></td>
103
  </table>
104
  <?php
105
  } // if(!$scheduler)
106
+ } else {
107
+ if(!$scheduler) {
 
 
108
  ?>
109
  <div class="odb-not-found">
110
  <?php _e('No REVISIONS found to delete', $odb_class->odb_txt_domain);?>
121
  /****************************************************************************************
122
  * DELETE TRASHED ITEMS
123
  ****************************************************************************************/
124
+ if($odb_class->odb_rvg_options['clear_trash'] == 'Y') {
 
125
  // GET TRASHED POSTS / PAGES AND COMMENTS
126
  $results = $this->odb_get_trash();
127
 
128
  $total_deleted = 0;
129
+ if(count($results)>0) {
130
+ // WE HAVE TRASH TO DELETE!
131
+ if(!$scheduler) {
 
132
  ?>
133
  <table border="0" cellspacing="8" cellpadding="2" class="odb-result-table">
134
  <tr>
149
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
150
  $total_deleted = $this->odb_delete_trash($results, $scheduler);
151
 
152
+ if(!$scheduler) {
 
153
  ?>
154
  <tr>
155
  <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of trashed items deleted', $odb_class->odb_txt_domain);?></td>
158
  </table>
159
  <?php
160
  } // if(!$scheduler)
161
+ } else {
162
+ if(!$scheduler) {
 
 
 
163
  ?>
164
  <div class="odb-not-found">
165
  <?php _e('No TRASHED ITEMS found to delete', $odb_class->odb_txt_domain);?>
176
  /****************************************************************************************
177
  * DELETE SPAMMED ITEMS
178
  ****************************************************************************************/
179
+ if($odb_class->odb_rvg_options['clear_spam'] == 'Y') {
 
180
  // GET SPAMMED COMMENTS
181
  $results = $this->odb_get_spam();
182
 
183
  $total_deleted = 0;
184
+ if(count($results)>0) {
185
+ // WE HAVE SPAM TO DELETE!
186
+ if (!$scheduler) {
 
187
  ?>
188
  <table border="0" cellspacing="8" cellpadding="2" class="odb-result-table">
189
  <tr>
204
  // LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
205
  $total_deleted = $this->odb_delete_spam($results, $scheduler);
206
 
207
+ if (!$scheduler) {
 
208
  ?>
209
  <tr>
210
  <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of spammed items deleted', $odb_class->odb_txt_domain);?></td>
213
  </table>
214
  <?php
215
  } // if (!$scheduler)
216
+ } else{
217
+ if (!$scheduler) {
 
 
 
218
  ?>
219
  <div class="odb-not-found">
220
  <?php _e('No SPAMMED ITEMS found to delete', $odb_class->odb_txt_domain);?>
231
  /****************************************************************************************
232
  * DELETE UNUSED TAGS
233
  ****************************************************************************************/
234
+ if($odb_class->odb_rvg_options['clear_tags'] == 'Y') {
 
235
  // DELETE UNUSED TAGS
236
  $total_deleted = $this->odb_delete_tags();
237
+ if($total_deleted > 0) {
238
+ // TAGS DELETED
239
+ if (!$scheduler) {
 
240
  ?>
241
  <div class="odb-found-number">
242
  <?php _e('NUMBER OF UNUSED TAGS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
243
  <?php
244
  } // if (!$scheduler)
245
+ } else {
246
+ if (!$scheduler) {
 
 
 
247
  ?>
248
  <div class="odb-not-found">
249
  <?php _e('No UNUSED TAGS found to delete', $odb_class->odb_txt_domain);?>
260
  /****************************************************************************************
261
  * DELETE EXPIRED TRANSIENTS
262
  ****************************************************************************************/
263
+ if($odb_class->odb_rvg_options['clear_transients'] == 'Y') {
 
264
  // DELETE UNUSED TAGS
265
  $total_deleted = $this->odb_delete_transients();
266
+ if($total_deleted > 0) {
267
+ // TRANSIENTS DELETED
268
+ if (!$scheduler) {
 
269
  ?>
270
  <div class="odb-found-number">
271
  <?php _e('NUMBER OF EXPIRED TRANSIENTS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
272
  <?php
273
  } // if (!$scheduler)
274
+ } else {
275
+ if (!$scheduler) {
 
 
 
276
  ?>
277
  <div class="odb-not-found">
278
  <?php _e('No EXPIRED TRANSIENTS found to delete', $odb_class->odb_txt_domain);?>
289
  /****************************************************************************************
290
  * DELETE PINGBACKS AND TRACKBACKS
291
  ****************************************************************************************/
292
+ if($odb_class->odb_rvg_options['clear_pingbacks'] == 'Y') {
 
293
  // DELETE UNUSED TAGS
294
  $total_deleted = $this->odb_delete_pingbacks();
295
+ if($total_deleted > 0) {
296
+ // PINGBACKS / TRACKBACKS DELETED\
297
+ if (!$scheduler) {
 
298
  ?>
299
  <div class="odb-found-number">
300
  <?php _e('NUMBER OF PINGBACKS AND TRACKBACKS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
301
  <?php
302
  } // if (!$scheduler)
303
+ } else {
304
+ if (!$scheduler) {
 
 
 
305
  ?>
306
  <div class="odb-not-found">
307
  <?php _e('No PINGBACKS nor TRACKBACKS found to delete', $odb_class->odb_txt_domain);?>
319
  * DELETE ORPHANS
320
  ****************************************************************************************/
321
  $total_deleted = $this->odb_delete_orphans();
322
+ if($total_deleted > 0) {
323
+ if (!$scheduler) {
 
 
324
  ?>
325
  <div class="odb-found-number">
326
  <?php _e('NUMBER OF POSTMETA ORPHANS DELETED', $odb_class->odb_txt_domain);?>: <span class="odb-blue"><?php echo $total_deleted;?></span> </div>
327
  <?php
328
  } // if (!$scheduler)
329
+ } else {
330
+ if (!$scheduler) {
 
 
 
331
  ?>
332
  <div class="odb-not-found">
333
  <?php _e('No POSTMETA ORPHANS found to delete', $odb_class->odb_txt_domain);?>
338
  // FOR LOG FILE
339
  $odb_class->log_arr["orphans"] = $total_deleted;
340
 
341
+ if (!$scheduler) {
 
342
  ?>
343
  </div><!-- /odb-cleaner -->
344
  <?php
345
+ } // if (!$scheduler)
346
  } // odb_run_cleaner()
347
 
348
 
349
  /********************************************************************************************
350
  * RUN OPTIMIZER
351
  ********************************************************************************************/
352
+ function odb_run_optimizer($scheduler) {
353
+ global $odb_class;
354
 
355
+ if(!$scheduler) {
 
356
  ?>
357
  <div class="odb-optimizing-table" class="odb-padding-left">
358
  <div class="odb-title-bar">
375
  # OPTIMIZE THE DATABASE TABLES
376
  $this->nr_of_optimized_tables = $this->odb_optimize_tables($scheduler);
377
 
378
+ if(!$scheduler) {
 
379
  ?>
380
  </table>
381
  </div><!-- /odb-optimizing-table -->
387
  /********************************************************************************************
388
  * CALCULATE AND DISPLAY SAVINGS
389
  ********************************************************************************************/
390
+ function odb_savings($scheduler) {
391
+ global $odb_class;
392
  global $odb_logger_obj;
393
 
394
  // NUMBER OF TABLES
409
 
410
  $odb_class->odb_multisite_obj->odb_ms_update_option('odb_rvg_options', $odb_class->odb_rvg_options);
411
 
412
+ if(!$scheduler) {
 
413
  ?>
414
  <div id="odb-savings" class="odb-padding-left">
415
  <div class="odb-title-bar">
448
  /********************************************************************************************
449
  * SHOW LOADING TIME
450
  ********************************************************************************************/
451
+ function odb_done() {
 
452
  global $odb_class;
453
 
454
  $time = microtime();
488
  /********************************************************************************************
489
  * GET REVISIONS (OLDER THAN x DAYS)
490
  ********************************************************************************************/
491
+ function odb_get_revisions_older_than() {
 
492
  global $odb_class, $wpdb;
493
 
494
  $res_arr = array();
495
 
496
+ $rev_post_type = $odb_class->odb_rvg_options['rev_post_type'];
497
+ $where = "";
498
+ if ($rev_post_type) $where = " AND p2.`post_type` = '" . $rev_post_type . "'";
499
+
500
  $older_than = $odb_class->odb_rvg_options['older_than'];
501
 
502
  $index = 0;
503
 
504
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
 
 
 
 
 
 
505
 
506
+ $sql = sprintf("
507
+ SELECT p1.`ID`, p1.`post_parent`, p1.`post_title`, p1.`post_modified`
508
+ FROM %sposts p1, %sposts p2
509
+ WHERE p1.`post_type` = 'revision'
510
+ AND p1.`post_parent` = p2.ID
511
+ %s
512
+ AND p1.`post_modified` < date_sub(now(), INTERVAL %d DAY)
513
+ ORDER BY UCASE(p1.`post_title`)
514
+ ",
515
+ $odb_class->odb_ms_prefixes[$i],
516
+ $odb_class->odb_ms_prefixes[$i],
517
+ $where,
518
+ $older_than);
519
+
520
  $res = $wpdb->get_results($sql, ARRAY_A);
521
 
522
+ for($j=0; $j<count($res); $j++) {
523
+ if(isset($res[$j]) && !$this->odb_post_is_excluded($res[$j]['post_parent'])) {
524
+ $res_arr[$index] = $res[$j];
525
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
526
  $index++;
527
+ } // if(isset($res[$j]) && !$this->odb_post_is_excluded($res[$j]['post_parent']))
528
+ } // for($j=0; $j<count($res); $j++)
529
+
530
  } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
531
 
532
  return $res_arr;
536
  /********************************************************************************************
537
  * GET REVISIONS (KEEP MAX NUMBER OF REVISIONS)
538
  ********************************************************************************************/
539
+ function odb_get_revisions_keep_revisions() {
 
540
  global $odb_class, $wpdb;
541
 
542
  $res_arr = array();
543
+
544
+ $rev_post_type = $odb_class->odb_rvg_options['rev_post_type'];
545
+ $where1 = '';
546
+ if ($rev_post_type) $where1 = " AND p2.`post_type` = '" . $rev_post_type . "'";
547
 
548
  // MAX NUMBER OF REVISIONS TO KEEP
549
  $max_revisions = $odb_class->odb_rvg_options['nr_of_revisions'];
551
  $index = 0;
552
 
553
  // SKIP REVISIONS THAT WILL BE DELETED BY THE 'OLDER THAN' OPTION
554
+ $where2 = '';
555
+ if($odb_class->odb_rvg_options['delete_older'] == 'Y') {
556
+ $older_than = $odb_class->odb_rvg_options['older_than'];
557
+ $where2 = 'AND p1.`post_modified` >= date_sub(now(), INTERVAL '.$older_than.' DAY)';
558
  }
559
 
560
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
561
+
562
+ $sql = sprintf ("
563
+ SELECT p1.`ID`, p1.`post_parent`, p1.`post_title`, COUNT(*) cnt
564
+ FROM %sposts p1, %sposts p2
565
+ WHERE p1.`post_type` = 'revision'
566
+ AND p1.`post_parent` = p2.ID
567
+ %s
568
  %s
569
+ GROUP BY p1.`post_parent`
570
  HAVING COUNT(*) > %d
571
+ ORDER BY UCASE(p1.`post_title`)
572
+ ",
573
+ $odb_class->odb_ms_prefixes[$i],
574
+ $odb_class->odb_ms_prefixes[$i],
575
+ $where1,
576
+ $where2,
577
+ $max_revisions);
578
 
579
  $res = $wpdb->get_results($sql, ARRAY_A);
580
+ for($j=0; $j<count($res); $j++) {
581
+ if(isset($res[$j]) && !$this->odb_post_is_excluded($res[$j]['post_parent'])) {
582
+ $res_arr[$index] = $res[$j];
583
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
584
  $index++;
585
  }
593
  /********************************************************************************************
594
  * DELETE THE REVISIONS
595
  ********************************************************************************************/
596
+ function odb_delete_revisions($scheduler) {
 
597
  global $odb_class, $wpdb;
598
 
599
  $total_deleted = 0;
600
  $nr = 1;
601
 
602
+ if($odb_class->odb_rvg_options['delete_older'] == 'Y') {
603
+ // DELETE REVISIONS OLDER THAN x DAYS
604
  $results = $this->odb_get_revisions_older_than();
605
  $older_than = $odb_class->odb_rvg_options['older_than'];
606
  $total_deleted += count($results);
607
 
608
+ for($i=0; $i<count($results); $i++) {
609
+ if (!$scheduler) {
 
 
610
  ?>
611
  <tr>
612
  <td align="right" valign="top"><?php echo $nr?>.</td>
623
  $wpdb->get_results($sql_delete);
624
 
625
  $nr++;
626
+ if(!$scheduler) {
 
627
  ?>
628
  <td align="right" valign="top" class="odb-bold">1</td>
629
  </tr>
632
  } // for($i=0; $i<count($results); $i++)
633
  } // if($odb_class->odb_rvg_options['delete_older'] == 'Y')
634
 
635
+ if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y') {
636
+ // KEEP MAX NUMBER OF REVISIONS
637
  $results = $this->odb_get_revisions_keep_revisions();
638
  $max_revisions = $odb_class->odb_rvg_options['nr_of_revisions'];
639
 
640
+ for($i=0; $i<count($results); $i++) {
641
+ $nr_to_delete = $results[$i]['cnt'] - $max_revisions;
642
  $total_deleted += $nr_to_delete;
643
 
644
+ if (!$scheduler) {
 
645
  ?>
646
  <tr>
647
  <td align="right" valign="top"><?php echo $nr?>.</td>
660
 
661
  $results_get_posts = $wpdb->get_results($sql_get_posts);
662
 
663
+ for($j=0; $j<$nr_to_delete; $j++) {
664
+ if(!$scheduler) echo $results_get_posts[$j]->post_modified.'<br />';
665
+
666
+ $sql_delete = sprintf ("
667
+ DELETE FROM %sposts
668
+ WHERE `ID` = %d
669
+ ", $results[$i]['site'], $results_get_posts[$j]->ID);
670
+
671
+ $wpdb->get_results($sql_delete);
 
 
 
 
672
  } // for($j=0; $j<$nr_to_delete; $j++)
673
 
674
  $nr++;
675
+ if(!$scheduler) {
 
676
  ?></td>
677
  <td align="right" valign="top" class="odb-bold"><?php echo $nr_to_delete?> <?php _e('of', $odb_class->odb_txt_domain)?> <?php echo $results[$i]['cnt'];?></td>
678
  </tr>
688
  /********************************************************************************************
689
  * CHECK IF POST IS EXCLUDED BY A CUSTOM FIELD ('keep_revisions')
690
  ********************************************************************************************/
691
+ function odb_post_is_excluded($parent_id) {
 
692
  $keep_revisions = get_post_meta($parent_id, 'keep_revisions', true);
693
  return ($keep_revisions === 'Y');
694
  } // odb_post_is_exclude()
697
  /********************************************************************************************
698
  * GET TRASHED POSTS / PAGES AND COMMENTS
699
  ********************************************************************************************/
700
+ function odb_get_trash() {
 
701
  global $wpdb, $odb_class;
702
 
703
  $res_arr = array();
704
 
705
  $index = 0;
706
  // LOOP TROUGH SITES
707
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
708
  $sql = sprintf ("
709
  SELECT `ID` AS id, 'post' AS post_type, `post_title` AS title, `post_modified` AS modified
710
  FROM %sposts
717
  ", $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i]);
718
  $res = $wpdb->get_results($sql, ARRAY_A);
719
 
720
+ if($res != null) {
721
+ $res_arr[$index] = $res[0];
722
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
723
  $index++;
724
+ } // if($res != null)
725
+ } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
726
 
727
  return $res_arr;
728
  } // odb_get_trash()
731
  /********************************************************************************************
732
  * DELETE TRASHED POSTS AND PAGES
733
  ********************************************************************************************/
734
+ function odb_delete_trash($results, $scheduler) {
 
735
  global $wpdb;
736
 
737
  $nr = 1;
738
  $total_deleted = count($results);
739
 
740
+ for($i=0; $i<$total_deleted; $i++) {
741
+ if(!$scheduler) {
 
742
  ?>
743
  <tr>
744
  <td align="right" valign="top"><?php echo $nr; ?></td>
750
  <?php
751
  } // if(!$scheduler)
752
 
753
+ if($results[$i]['post_type'] == 'comment') {
754
+ // DELETE META DATA (IF ANY...)
755
  $sql_delete = sprintf ("
756
  DELETE FROM %scommentmeta
757
  WHERE `comment_id` = %d
758
  ", $results[$i]['site'], $results[$i]['id']);
759
  $wpdb->get_results($sql_delete);
760
+ } // if($results[$i]['post_type'] == 'comment')
761
 
762
  // DELETE TRASHED POSTS / PAGES
763
  $sql_delete = sprintf ("
783
  /********************************************************************************************
784
  * GET SPAMMED COMMENTS
785
  ********************************************************************************************/
786
+ function odb_get_spam() {
 
787
  global $wpdb, $odb_class;
788
 
789
  $res_arr = array();
790
 
791
  $index = 0;
792
  // LOOP THROUGH SITES
793
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
794
  $sql = sprintf ("
795
  SELECT `comment_ID`, `comment_author`, `comment_author_email`, `comment_date`
796
  FROM %scomments
799
  ", $odb_class->odb_ms_prefixes[$i]);
800
  $res = $wpdb->get_results($sql, ARRAY_A);
801
 
802
+ if($res != null) {
803
+ $res_arr[$index] = $res[0];
804
  $res_arr[$index]['site'] = $odb_class->odb_ms_prefixes[$i];
805
  $index++;
806
+ } // if($res != null)
807
+ } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
808
 
809
  return $res_arr;
 
810
  } // odb_get_spam()
811
 
812
 
819
 
820
  $nr = 1;
821
  $total_deleted = count($results);
822
+ for($i=0; $i<count($results); $i++) {
823
+ if (!$scheduler) {
 
824
  ?>
825
  <tr>
826
  <td align="right" valign="top"><?php echo $nr; ?></td>
848
  } // for($i=0; $i<count($results); $i++)
849
 
850
  return $total_deleted;
 
851
  } // odb_delete_spam()
852
 
853
 
854
  /********************************************************************************************
855
  * DELETE UNUSED TAGS
856
  ********************************************************************************************/
857
+ function odb_delete_tags() {
 
858
  global $wpdb, $odb_class;
859
 
860
  $total_deleted = 0;
861
 
862
  // LOOP THROUGH THE NETWORK
863
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
864
  $sql = sprintf ("
865
  SELECT a.term_id AS term_id, a.name AS name
866
  FROM `%sterms` a, `%sterm_taxonomy` b
873
  ", $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i]);
874
 
875
  $res = $wpdb->get_results($sql);
876
+ for($j=0; $j<count($res); $j++) {
877
+ if(!$this->odb_delete_tags_is_scheduled($res[$j]->term_id, $odb_class->odb_ms_prefixes[$i])) {
878
+ // TAG NOT USED IN SCHEDULED POSTS: CAN BE DELETED
879
  $total_deleted++;
880
 
881
  $sql_del = sprintf ("
900
  /********************************************************************************************
901
  * IS THE UNUSED TAG USED IN ONE OR MORE SCHEDULED POSTS?
902
  ********************************************************************************************/
903
+ function odb_delete_tags_is_scheduled($term_id, $odb_prefix) {
 
904
  global $wpdb;
905
 
906
  $sql_get_posts = sprintf ("
915
  if($results_get_posts[$i]->post_status == 'future') return true;
916
 
917
  return false;
 
918
  } // odb_delete_tags_is_scheduled()
919
 
920
 
921
  /********************************************************************************************
922
  * DELETE EXPIRED TRANSIENTS
923
  ********************************************************************************************/
924
+ function odb_delete_transients() {
 
925
  global $wpdb, $odb_class;
926
 
927
  $delay = time() - 60; // ONE MINUTE DELAY
929
  $total_deleted = 0;
930
 
931
  // LOOP THROUGH THE NETWORK
932
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
933
  // FIND EXPIRED TRANSIENTS
934
  $sql = "
935
  SELECT `option_name`
945
  $total_deleted += count($results);
946
 
947
  // LOOP THROUGH THE RESULTS
948
+ for($j=0; $j<count($results); $j++) {
949
+ if(substr($results[$j]->option_name, 0, 19) == '_transient_timeout_') {
950
+ // _transient_timeout_%
 
951
  $transient = substr($results[$j]->option_name, 19);
952
  // DELETE THE TRANSIENT
953
  delete_transient($transient);
954
+ } else {
955
+ // _site_transient_timeout_%
 
956
  $transient = substr($results[$j]->option_name, 24);
957
  // DELETE THE TRANSIENT
958
  delete_site_transient($transient);
959
+ } // if(substr($results[$j]->option_name, 0, 19) == '_transient_timeout_')
960
  } // for($j=0; $j<count($results); $j++)
 
961
  } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
962
+
963
  return $total_deleted;
964
  } // odb_delete_transients()
965
 
967
  /********************************************************************************************
968
  * DELETE PINGBACKS AND TRACKBACKS
969
  ********************************************************************************************/
970
+ function odb_delete_pingbacks() {
 
971
  global $wpdb, $odb_class;
972
 
973
  $total_deleted = 0;
974
 
975
  // LOOP THROUGH THE NETWORK
976
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
977
  $sql = sprintf ("
978
  SELECT `comment_ID`
979
  FROM %scomments
986
  $results = $wpdb->get_results($sql);
987
  $total_deleted = count($results);
988
 
989
+ for($j=0; $j<count($results); $j++) {
990
+ // DELETE METADATA FOR THIS COMMENT (IF ANY)
991
  $sql_delete_meta = sprintf ("
992
  DELETE FROM %scommentmeta
993
  WHERE `comment_id` = %d
1013
  /********************************************************************************************
1014
  * DELETE ORPHAN POSTMETA AND MEDIA RECORDS
1015
  ********************************************************************************************/
1016
+ function odb_delete_orphans() {
 
1017
  global $wpdb, $odb_class;
1018
 
1019
  $meta_orphans = 0;
1021
  $media_orphans = 0; // v4.1.7
1022
 
1023
  // LOOP THROUGH THE NETWORK
1024
+ for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++) {
 
1025
  // DELETE POST ORPHANS (AUTO DRAFTS)
1026
  $sql_delete = sprintf ("
1027
  SELECT COUNT(*) cnt
1034
 
1035
  $post_orphans = $results[0]->cnt;
1036
 
1037
+ if($post_orphans > 0) {
1038
+ $sql_delete = sprintf ("
1039
  DELETE FROM %sposts
1040
  WHERE ID NOT IN (SELECT post_id FROM %spostmeta)
1041
  AND post_status = 'auto-draft'
1054
 
1055
  $meta_orphans = $results[0]->cnt;
1056
 
1057
+ if($meta_orphans > 0) {
1058
+ $sql_delete = sprintf ("
1059
  DELETE FROM %spostmeta
1060
  WHERE post_id NOT IN (SELECT ID FROM %sposts)
1061
  ", $odb_class->odb_ms_prefixes[$i], $odb_class->odb_ms_prefixes[$i]);
1087
  */
1088
 
1089
  } // for($i=0; $i<count($odb_class->odb_ms_prefixes); $i++)
1090
+
1091
  return ($meta_orphans + $post_orphans);
1092
  } // odb_delete_orphans()
1093
 
1095
  /********************************************************************************************
1096
  * OPTIMIZE DATABASE TABLES
1097
  ********************************************************************************************/
1098
+ function odb_optimize_tables($scheduler) {
 
1099
  global $odb_class, $wpdb;
1100
 
1101
  $cnt = 0;
1102
+ for ($i=0; $i<count($odb_class->odb_tables); $i++) {
1103
+ if(!isset($odb_class->odb_rvg_excluded_tabs[$odb_class->odb_tables[$i][0]])) {
1104
+ # TABLE NOT EXCLUDED
 
1105
  $cnt++;
1106
 
1107
  $sql = sprintf ("
1112
  ", DB_NAME, $odb_class->odb_tables[$i][0]);
1113
  $table_info = $wpdb->get_results($sql);
1114
 
1115
+ if($odb_class->odb_rvg_options["optimize_innodb"] == 'N' && strtolower($table_info[0]->engine) == 'innodb') {
1116
+ // SKIP InnoDB tables
1117
  $msg = __('InnoDB table: skipped...', 'rvg-optimize-database');
1118
+ } else {
1119
+ $query = "OPTIMIZE TABLE ".$odb_class->odb_tables[$i][0];
 
1120
  $result = $wpdb->get_results($query);
1121
  $msg = $result[0]->Msg_text;
1122
  $msg = str_replace('OK', __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database'), $msg);
classes/odb-displayer.php CHANGED
@@ -6,20 +6,17 @@
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
- class ODB_Displayer
10
- {
11
  /********************************************************************************************
12
  * CONSTRUCTOR
13
  ********************************************************************************************/
14
- function __construct()
15
- {
16
  } // __construct()
17
 
18
  /********************************************************************************************
19
  * DISPLAY THE PAGE HEADER
20
  ********************************************************************************************/
21
- function display_header()
22
- {
23
  global $odb_class;
24
 
25
  // V4.1.9: RUNNING INDICATOR ADDED
@@ -50,8 +47,7 @@ class ODB_Displayer
50
  /********************************************************************************************
51
  * DISPLAY THE CURRENT SETTINGS
52
  ********************************************************************************************/
53
- function display_current_settings()
54
- {
55
  global $odb_class;
56
 
57
  $current_hour = Date('H:i');
@@ -59,7 +55,7 @@ class ODB_Displayer
59
  $y = __('YES', $odb_class->odb_txt_domain);
60
  $n = __('NO', $odb_class->odb_txt_domain);
61
 
62
- // CURRENT SETTINGS
63
  $trash = ($odb_class->odb_rvg_options['clear_trash'] == 'Y') ? $y : $n;
64
  $spam = ($odb_class->odb_rvg_options['clear_spam'] == 'Y') ? $y : $n;
65
  $tag = ($odb_class->odb_rvg_options['clear_tags'] == 'Y') ? $y : $n;
@@ -89,12 +85,21 @@ class ODB_Displayer
89
  </div>
90
  <br><br>
91
  ';
 
 
 
 
 
 
 
 
92
 
93
- if($odb_class->odb_rvg_options['delete_older'] == 'Y')
94
- { echo '<span class="odb-bold">'.__('Delete revisions older than', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['older_than'].' '.__("days", $odb_class->odb_txt_domain).'</span><br />';
95
  }
96
- if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y')
97
- { echo '<span class="odb-bold">'.__('Maximum number of - most recent - revisions to keep per post / page', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['nr_of_revisions'].'</span><br />';
 
98
  }
99
 
100
  echo '
@@ -110,8 +115,8 @@ class ODB_Displayer
110
  <span class="odb-bold">'.__('Scheduler', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$schedule.'</span><br />
111
  ';
112
 
113
- if($odb_class->odb_rvg_options['schedule_type'] != '')
114
- { $timestamp = wp_next_scheduled('odb_scheduler');
115
  $nextrun = Date('M j, Y @ H:i', $timestamp);
116
  echo '
117
  <span class="odb-bold">'.__('Next scheduled run',$odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$nextrun.' '.__('hrs', $odb_class->odb_txt_domain).' ('.__('current server time', $odb_class->odb_txt_domain).': '.$current_hour.' '.__('hrs', $odb_class->odb_txt_domain).')</span><br>
@@ -128,20 +133,18 @@ class ODB_Displayer
128
  /********************************************************************************************
129
  * DISPLAY THE START BUTTONS
130
  ********************************************************************************************/
131
- function display_start_buttons($action)
132
- {
133
  global $odb_class;
134
 
135
- if(!defined('RUN_OPTIMIZE_DATABASE'))
136
- {
137
  echo '
138
  <div id="odb-start-buttons" class="odb-padding-left">
139
  <p>
140
  <input class="button odb-normal" type="button" name="change_options" value="'.__('Change Settings', $odb_class->odb_txt_domain).'" onclick="self.location=\'options-general.php?page=odb_settings_page\'">
141
  ';
142
 
143
- if(file_exists($odb_class->odb_plugin_path.'logs/rvg-optimize-db-log.html'))
144
- { // THERE IS A LOG FILE
145
  echo '
146
  &nbsp;
147
  <input class="button odb-normal" type="button" name="view_log" value="'.__('View Log File', $odb_class->odb_txt_domain).'" onclick="window.open(\''.$odb_class->odb_logfile_url.'\')">
@@ -150,8 +153,8 @@ class ODB_Displayer
150
  ';
151
  } // if(file_exists($this->odb_plugin_path.'logs/rvg-optimize-db-log.html'))
152
 
153
- if($action != 'run')
154
- { // NOT RUNNING: SHOW START BUTTON
155
  echo '
156
  &nbsp;<input class="button-primary button-large" type="button" name="start_optimization" value="'.__('Start Optimization', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=run\'" class="odb-bold" />
157
  ';
@@ -161,8 +164,8 @@ class ODB_Displayer
161
  </p>
162
  </div><!-- /odb-start-buttons -->
163
  ';
164
- } else if (RUN_OPTIMIZE_DATABASE)
165
- { echo 'Database optimized!';
166
  } // if(!defined('RUN_OPTIMIZE_DATABASE'))
167
  } // display_start_buttons()
168
  } // ODB_Displayer
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
+ class ODB_Displayer {
 
10
  /********************************************************************************************
11
  * CONSTRUCTOR
12
  ********************************************************************************************/
13
+ function __construct() {
 
14
  } // __construct()
15
 
16
  /********************************************************************************************
17
  * DISPLAY THE PAGE HEADER
18
  ********************************************************************************************/
19
+ function display_header() {
 
20
  global $odb_class;
21
 
22
  // V4.1.9: RUNNING INDICATOR ADDED
47
  /********************************************************************************************
48
  * DISPLAY THE CURRENT SETTINGS
49
  ********************************************************************************************/
50
+ function display_current_settings() {
 
51
  global $odb_class;
52
 
53
  $current_hour = Date('H:i');
55
  $y = __('YES', $odb_class->odb_txt_domain);
56
  $n = __('NO', $odb_class->odb_txt_domain);
57
 
58
+ // CURRENT SETTINGS
59
  $trash = ($odb_class->odb_rvg_options['clear_trash'] == 'Y') ? $y : $n;
60
  $spam = ($odb_class->odb_rvg_options['clear_spam'] == 'Y') ? $y : $n;
61
  $tag = ($odb_class->odb_rvg_options['clear_tags'] == 'Y') ? $y : $n;
85
  </div>
86
  <br><br>
87
  ';
88
+
89
+ if ($odb_class->odb_rvg_options['rev_post_type'] == 'post')
90
+ $rpt = __("POSTS only", $odb_class->odb_txt_domain);
91
+ else if ($odb_class->odb_rvg_options['rev_post_type'] == 'page')
92
+ $rpt = __("PAGES only", $odb_class->odb_txt_domain);
93
+ else
94
+ $rpt = __("POSTS and PAGES", $odb_class->odb_txt_domain);
95
+ echo '<span class="odb-bold">'.__('Delete revisions of', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$rpt.'</span><br />';
96
 
97
+ if($odb_class->odb_rvg_options['delete_older'] == 'Y') {
98
+ echo '<span class="odb-bold">'.__('Delete revisions older than', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['older_than'].' '.__("days", $odb_class->odb_txt_domain).'</span><br />';
99
  }
100
+
101
+ if($odb_class->odb_rvg_options['rvg_revisions'] == 'Y') {
102
+ echo '<span class="odb-bold">'.__('Maximum number of - most recent - revisions to keep per post / page', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$odb_class->odb_rvg_options['nr_of_revisions'].'</span><br />';
103
  }
104
 
105
  echo '
115
  <span class="odb-bold">'.__('Scheduler', $odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$schedule.'</span><br />
116
  ';
117
 
118
+ if($odb_class->odb_rvg_options['schedule_type'] != '') {
119
+ $timestamp = wp_next_scheduled('odb_scheduler');
120
  $nextrun = Date('M j, Y @ H:i', $timestamp);
121
  echo '
122
  <span class="odb-bold">'.__('Next scheduled run',$odb_class->odb_txt_domain).':</span> <span class="odb-bold odb-blue">'.$nextrun.' '.__('hrs', $odb_class->odb_txt_domain).' ('.__('current server time', $odb_class->odb_txt_domain).': '.$current_hour.' '.__('hrs', $odb_class->odb_txt_domain).')</span><br>
133
  /********************************************************************************************
134
  * DISPLAY THE START BUTTONS
135
  ********************************************************************************************/
136
+ function display_start_buttons($action) {
 
137
  global $odb_class;
138
 
139
+ if(!defined('RUN_OPTIMIZE_DATABASE')) {
 
140
  echo '
141
  <div id="odb-start-buttons" class="odb-padding-left">
142
  <p>
143
  <input class="button odb-normal" type="button" name="change_options" value="'.__('Change Settings', $odb_class->odb_txt_domain).'" onclick="self.location=\'options-general.php?page=odb_settings_page\'">
144
  ';
145
 
146
+ if(file_exists($odb_class->odb_plugin_path.'logs/rvg-optimize-db-log.html')) {
147
+ // THERE IS A LOG FILE
148
  echo '
149
  &nbsp;
150
  <input class="button odb-normal" type="button" name="view_log" value="'.__('View Log File', $odb_class->odb_txt_domain).'" onclick="window.open(\''.$odb_class->odb_logfile_url.'\')">
153
  ';
154
  } // if(file_exists($this->odb_plugin_path.'logs/rvg-optimize-db-log.html'))
155
 
156
+ if($action != 'run') {
157
+ // NOT RUNNING: SHOW START BUTTON
158
  echo '
159
  &nbsp;<input class="button-primary button-large" type="button" name="start_optimization" value="'.__('Start Optimization', $odb_class->odb_txt_domain).'" onclick="self.location=\'tools.php?page=rvg-optimize-database&action=run\'" class="odb-bold" />
160
  ';
164
  </p>
165
  </div><!-- /odb-start-buttons -->
166
  ';
167
+ } else if (RUN_OPTIMIZE_DATABASE) {
168
+ echo 'Database optimized!';
169
  } // if(!defined('RUN_OPTIMIZE_DATABASE'))
170
  } // display_start_buttons()
171
  } // ODB_Displayer
classes/odb-logger.php CHANGED
@@ -1,25 +1,22 @@
1
  <?php
2
- class ODB_Logger
3
- {
4
  /********************************************************************************************
5
  * CONSTRUCTOR
6
  ********************************************************************************************/
7
- function __construct()
8
- {
9
  } // __construct()
10
 
11
 
12
  /********************************************************************************************
13
  * WRITE RESULTS TO LOG FILE
14
  ********************************************************************************************/
15
- function write_log()
16
- {
17
  global $odb_class;
18
 
19
- if($odb_class->odb_rvg_options['logging_on'] == "Y")
20
- { $file = $odb_class->odb_logfile_path;
21
- if(!file_exists($file))
22
- { // NEW LOG FILE
23
  $html = '
24
  <!doctype html>
25
  <html>
@@ -100,16 +97,14 @@ td {
100
  /********************************************************************************************
101
  * ADD A MESSAGE TO THE DEBUG LOG FILE
102
  ********************************************************************************************/
103
- function write_debug_log($msg)
104
- {
105
  global $odb_class;
106
 
107
- if (defined('WP_DEBUG') && WP_DEBUG)
108
- { // ONLY USE THIS LOG IN DEBUG MODE
109
  $file = $odb_class->odb_logfile_debug_path;
110
  $txt = Date('Y/m/d H:i:s').' '.$msg."\n";
111
  file_put_contents($file, $txt, FILE_APPEND);
112
  }
113
  } // write_debug_log()
114
-
115
  } // ODB_Logger
1
  <?php
2
+ class ODB_Logger {
 
3
  /********************************************************************************************
4
  * CONSTRUCTOR
5
  ********************************************************************************************/
6
+ function __construct() {
 
7
  } // __construct()
8
 
9
 
10
  /********************************************************************************************
11
  * WRITE RESULTS TO LOG FILE
12
  ********************************************************************************************/
13
+ function write_log() {
 
14
  global $odb_class;
15
 
16
+ if($odb_class->odb_rvg_options['logging_on'] == "Y") {
17
+ $file = $odb_class->odb_logfile_path;
18
+ if(!file_exists($file)) {
19
+ // NEW LOG FILE
20
  $html = '
21
  <!doctype html>
22
  <html>
97
  /********************************************************************************************
98
  * ADD A MESSAGE TO THE DEBUG LOG FILE
99
  ********************************************************************************************/
100
+ function write_debug_log($msg) {
 
101
  global $odb_class;
102
 
103
+ if (defined('WP_DEBUG') && WP_DEBUG) {
104
+ // ONLY USE THIS LOG IN DEBUG MODE
105
  $file = $odb_class->odb_logfile_debug_path;
106
  $txt = Date('Y/m/d H:i:s').' '.$msg."\n";
107
  file_put_contents($file, $txt, FILE_APPEND);
108
  }
109
  } // write_debug_log()
 
110
  } // ODB_Logger
classes/odb-multisite.php CHANGED
@@ -6,28 +6,25 @@
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
- class ODB_MultiSite
10
- {
11
  /********************************************************************************************
12
  * CONSTRUCTOR
13
  ********************************************************************************************/
14
- function __construct()
15
- {
16
  } // __construct()
17
 
18
 
19
  /********************************************************************************************
20
  * GET MULTI-SITE NETWORK INFORMATION
21
  ********************************************************************************************/
22
- function odb_ms_network_info()
23
- {
24
  global $wpdb, $odb_class;
25
 
26
  $blogids = array();
27
 
28
  $odb_class->odb_ms_prefixes [0] = $wpdb->base_prefix;
29
- if (function_exists('is_multisite') && is_multisite())
30
- { $blogids = $wpdb->get_col("SELECT blog_id FROM ".$wpdb->base_prefix."blogs");
31
  // FOR INSTANCE: mywp_2_, mywp_3_ etc.
32
  for($i=1; $i<count($blogids); $i++)
33
  $odb_class->odb_ms_prefixes [$i] = $wpdb->base_prefix.$blogids[$i].'_';
@@ -38,8 +35,7 @@ class ODB_MultiSite
38
  /********************************************************************************************
39
  * GET AN OPTION FROM THE ROOT SITE OPTION TABLE
40
  ********************************************************************************************/
41
- function odb_ms_get_option($option, $default = false)
42
- {
43
  global $odb_class;
44
 
45
  /* v4.1.3
@@ -55,8 +51,7 @@ class ODB_MultiSite
55
  /********************************************************************************************
56
  * SAVE AN OPTION TO THE ROOT SITE OPTION TABLE
57
  ********************************************************************************************/
58
- function odb_ms_update_option($option, $value)
59
- {
60
  // v4.0.2
61
  global $odb_class;
62
 
@@ -73,8 +68,7 @@ class ODB_MultiSite
73
  /********************************************************************************************
74
  * DELETE AN OPTION TO THE ROOT SITE OPTION TABLE
75
  ********************************************************************************************/
76
- function odb_ms_delete_option($option)
77
- {
78
  // v4.0.2
79
  global $odb_class;
80
 
@@ -86,5 +80,4 @@ class ODB_MultiSite
86
  else*/
87
  return delete_option($option);
88
  } // odb_ms_delete_option()
89
-
90
  } // ODB_MultiSite
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
+ class ODB_MultiSite {
 
10
  /********************************************************************************************
11
  * CONSTRUCTOR
12
  ********************************************************************************************/
13
+ function __construct() {
 
14
  } // __construct()
15
 
16
 
17
  /********************************************************************************************
18
  * GET MULTI-SITE NETWORK INFORMATION
19
  ********************************************************************************************/
20
+ function odb_ms_network_info() {
 
21
  global $wpdb, $odb_class;
22
 
23
  $blogids = array();
24
 
25
  $odb_class->odb_ms_prefixes [0] = $wpdb->base_prefix;
26
+ if (function_exists('is_multisite') && is_multisite()) {
27
+ $blogids = $wpdb->get_col("SELECT blog_id FROM ".$wpdb->base_prefix."blogs");
28
  // FOR INSTANCE: mywp_2_, mywp_3_ etc.
29
  for($i=1; $i<count($blogids); $i++)
30
  $odb_class->odb_ms_prefixes [$i] = $wpdb->base_prefix.$blogids[$i].'_';
35
  /********************************************************************************************
36
  * GET AN OPTION FROM THE ROOT SITE OPTION TABLE
37
  ********************************************************************************************/
38
+ function odb_ms_get_option($option, $default = false) {
 
39
  global $odb_class;
40
 
41
  /* v4.1.3
51
  /********************************************************************************************
52
  * SAVE AN OPTION TO THE ROOT SITE OPTION TABLE
53
  ********************************************************************************************/
54
+ function odb_ms_update_option($option, $value) {
 
55
  // v4.0.2
56
  global $odb_class;
57
 
68
  /********************************************************************************************
69
  * DELETE AN OPTION TO THE ROOT SITE OPTION TABLE
70
  ********************************************************************************************/
71
+ function odb_ms_delete_option($option) {
 
72
  // v4.0.2
73
  global $odb_class;
74
 
80
  else*/
81
  return delete_option($option);
82
  } // odb_ms_delete_option()
 
83
  } // ODB_MultiSite
classes/odb-scheduler.php CHANGED
@@ -6,13 +6,11 @@
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
- class ODB_Scheduler
10
- {
11
  /********************************************************************************************
12
  * CONSTRUCTOR
13
  ********************************************************************************************/
14
- function __construct()
15
- {
16
  global $odb_class;
17
 
18
  // ADD EXTRA CRON SCHEDULES
@@ -31,8 +29,7 @@ class ODB_Scheduler
31
  * v4.0.3 ($schedules) added as a parameter
32
  * v4.2.0 Added monthly
33
  *******************************************************************************/
34
- function odb_extra_cron_schedules($schedules)
35
- {
36
  global $odb_class;
37
 
38
  $schedules['weekly'] = array(
@@ -55,23 +52,20 @@ class ODB_Scheduler
55
  /*******************************************************************************
56
  * UPDATE SCHEDULER (IF NEEDED)
57
  *******************************************************************************/
58
- function odb_update_scheduler()
59
- {
60
  global $odb_class;
61
 
62
- if($odb_class->odb_rvg_options['schedule_type'] == '')
63
- { // SHOULDN'T BE SCHEDULED
64
  wp_clear_scheduled_hook('odb_scheduler');
65
  $odb_class->odb_rvg_options['schedule_hour'] = '';
66
  $odb_class->odb_multisite_obj->odb_ms_update_option('odb_rvg_options', $odb_class->odb_rvg_options);
67
- }
68
- else
69
- { // JOB SHOULD BE SCHEDULED: SCHEDULE IT
70
  if($odb_class->odb_rvg_options['schedule_type'] != 'daily' &&
71
  $odb_class->odb_rvg_options['schedule_type'] != 'weekly' &&
72
  $odb_class->odb_rvg_options['schedule_type'] != 'monthly'
73
- )
74
- {
75
  $odb_class->odb_rvg_options['schedule_hour'] = '';
76
  $odb_class->odb_multisite_obj->odb_ms_update_option('odb_rvg_options', $odb_class->odb_rvg_options);
77
  }
@@ -85,8 +79,7 @@ class ODB_Scheduler
85
  /*******************************************************************************
86
  * SCHEDULE CHANGED ON SETTINGS PAGE: RESCHEDULE
87
  *******************************************************************************/
88
- function odb_reschedule()
89
- {
90
  global $odb_class;
91
 
92
  wp_clear_scheduled_hook('odb_scheduler');
@@ -97,15 +90,13 @@ class ODB_Scheduler
97
  /*******************************************************************************
98
  * CALCULATE SCHEDULE TIME
99
  *******************************************************************************/
100
- function odb_calculate_time()
101
- {
102
  global $odb_class;
103
 
104
  if ($odb_class->odb_rvg_options['schedule_type'] == 'daily' ||
105
  $odb_class->odb_rvg_options['schedule_type'] == 'weekly' ||
106
  $odb_class->odb_rvg_options['schedule_type'] == 'monthly'
107
- )
108
- {
109
  // 'daily' OR 'weekly'
110
  $current_datetime = Date('YmdHis');
111
  $current_date = substr($current_datetime, 0, 8);
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
+ class ODB_Scheduler {
 
10
  /********************************************************************************************
11
  * CONSTRUCTOR
12
  ********************************************************************************************/
13
+ function __construct() {
 
14
  global $odb_class;
15
 
16
  // ADD EXTRA CRON SCHEDULES
29
  * v4.0.3 ($schedules) added as a parameter
30
  * v4.2.0 Added monthly
31
  *******************************************************************************/
32
+ function odb_extra_cron_schedules($schedules) {
 
33
  global $odb_class;
34
 
35
  $schedules['weekly'] = array(
52
  /*******************************************************************************
53
  * UPDATE SCHEDULER (IF NEEDED)
54
  *******************************************************************************/
55
+ function odb_update_scheduler() {
 
56
  global $odb_class;
57
 
58
+ if($odb_class->odb_rvg_options['schedule_type'] == '') {
59
+ // SHOULDN'T BE SCHEDULED
60
  wp_clear_scheduled_hook('odb_scheduler');
61
  $odb_class->odb_rvg_options['schedule_hour'] = '';
62
  $odb_class->odb_multisite_obj->odb_ms_update_option('odb_rvg_options', $odb_class->odb_rvg_options);
63
+ } else {
64
+ // JOB SHOULD BE SCHEDULED: SCHEDULE IT
 
65
  if($odb_class->odb_rvg_options['schedule_type'] != 'daily' &&
66
  $odb_class->odb_rvg_options['schedule_type'] != 'weekly' &&
67
  $odb_class->odb_rvg_options['schedule_type'] != 'monthly'
68
+ ) {
 
69
  $odb_class->odb_rvg_options['schedule_hour'] = '';
70
  $odb_class->odb_multisite_obj->odb_ms_update_option('odb_rvg_options', $odb_class->odb_rvg_options);
71
  }
79
  /*******************************************************************************
80
  * SCHEDULE CHANGED ON SETTINGS PAGE: RESCHEDULE
81
  *******************************************************************************/
82
+ function odb_reschedule() {
 
83
  global $odb_class;
84
 
85
  wp_clear_scheduled_hook('odb_scheduler');
90
  /*******************************************************************************
91
  * CALCULATE SCHEDULE TIME
92
  *******************************************************************************/
93
+ function odb_calculate_time() {
 
94
  global $odb_class;
95
 
96
  if ($odb_class->odb_rvg_options['schedule_type'] == 'daily' ||
97
  $odb_class->odb_rvg_options['schedule_type'] == 'weekly' ||
98
  $odb_class->odb_rvg_options['schedule_type'] == 'monthly'
99
+ ) {
 
100
  // 'daily' OR 'weekly'
101
  $current_datetime = Date('YmdHis');
102
  $current_date = substr($current_datetime, 0, 8);
classes/odb-utilities.php CHANGED
@@ -6,21 +6,18 @@
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
- class ODB_Utilities
10
- {
11
  /********************************************************************************************
12
  * CONSTRUCTOR
13
  ********************************************************************************************/
14
- function __construct()
15
- {
16
  } // __construct()
17
 
18
 
19
  /********************************************************************************************
20
  * FORMAT SIZES FROM BYTES TO KB OR MB
21
  ********************************************************************************************/
22
- function odb_format_size($size, $precision=1)
23
- {
24
  if($size > 1024*1024) return (round($size/(1024*1024),$precision)).' MB';
25
 
26
  return (round($size/1024,$precision)).' KB';
@@ -30,8 +27,7 @@ class ODB_Utilities
30
  /********************************************************************************************
31
  * CALCULATE THE SIZE OF THE WORDPRESS DATABASE (IN BYTES)
32
  ********************************************************************************************/
33
- function odb_get_db_size()
34
- {
35
  global $wpdb;
36
 
37
  $sql = sprintf("
@@ -50,8 +46,7 @@ class ODB_Utilities
50
  /********************************************************************************************
51
  * GET DATABASE TABLES
52
  ********************************************************************************************/
53
- function odb_get_tables()
54
- {
55
  global $wpdb;
56
 
57
  $sql = sprintf("
@@ -63,5 +58,4 @@ class ODB_Utilities
63
  // GET THE DATABASE BASE TABLES
64
  return $wpdb->get_results($sql, ARRAY_N);
65
  } // odb_get_tables()
66
-
67
  } // ODB_Utilities
6
  ************************************************************************************************/
7
  ?>
8
  <?php
9
+ class ODB_Utilities {
 
10
  /********************************************************************************************
11
  * CONSTRUCTOR
12
  ********************************************************************************************/
13
+ function __construct() {
 
14
  } // __construct()
15
 
16
 
17
  /********************************************************************************************
18
  * FORMAT SIZES FROM BYTES TO KB OR MB
19
  ********************************************************************************************/
20
+ function odb_format_size($size, $precision=1) {
 
21
  if($size > 1024*1024) return (round($size/(1024*1024),$precision)).' MB';
22
 
23
  return (round($size/1024,$precision)).' KB';
27
  /********************************************************************************************
28
  * CALCULATE THE SIZE OF THE WORDPRESS DATABASE (IN BYTES)
29
  ********************************************************************************************/
30
+ function odb_get_db_size() {
 
31
  global $wpdb;
32
 
33
  $sql = sprintf("
46
  /********************************************************************************************
47
  * GET DATABASE TABLES
48
  ********************************************************************************************/
49
+ function odb_get_tables() {
 
50
  global $wpdb;
51
 
52
  $sql = sprintf("
58
  // GET THE DATABASE BASE TABLES
59
  return $wpdb->get_results($sql, ARRAY_N);
60
  } // odb_get_tables()
 
61
  } // ODB_Utilities
css/style.css CHANGED
@@ -88,6 +88,9 @@
88
  margin-bottom: 16px;
89
  color: #999;
90
  }
 
 
 
91
  .odb-schedule-select {
92
  font-size: inherit;
93
  padding: 0px;
88
  margin-bottom: 16px;
89
  color: #999;
90
  }
91
+ .odb-post-type-select {
92
+ font-size: inherit;
93
+ }
94
  .odb-schedule-select {
95
  font-size: inherit;
96
  padding: 0px;
css/style.min.css CHANGED
@@ -1 +1 @@
1
- @charset "utf-8";.odb-title-bar{width:96%;background-color:#0074a2;color:#FFF!important;display:inline-block;padding-left:16px;margin-top:30px}.odb-title-bar h2{color:#FFF}.odb-bold{font-weight:900}.odb-normal{font-weight:400}.odb-italic{font-style:italic}.odb-blue{color:#0074a2}#odb-running{background:rgba(0,0,0,.08)url(../images/running.gif) no-repeat 50% 50%;width:100%;height:100%;position:fixed;top:0;left:0;z-index:999}.odb-action{font-size:13px;font-weight:700;color:#000}.odb-wp-table{font-weight:700;color:#0074a2}.odb-padding-left{padding-left:8px}.odb-border-bottom{border-bottom:solid 1px #999}.odb-border-top{border-top:solid 1px #999}.odb-optimizing-table{margin-top:16px}.odb-optimized{color:#0074a2;font-weight:700}.odb-underline-red{text-decoration:underline;color:red}.odb-updated{position:relative;left:-15px}.odb-found{font-size:13px;font-weight:700;color:#000}.odb-found-number{margin-left:8px;margin-bottom:18px;font-size:13px;font-weight:700;color:#000}.odb-result-table{background-color:#E8E8E8;margin-bottom:20px}.odb-not-found{margin-left:8px;margin-bottom:16px;color:#999}.odb-schedule-select{font-size:inherit;padding:0;margin:0}.odb-schedulehour{display:none}.odb-schedulehour-select{font-size:inherit}.odb-table-excludes{margin-top:10px;border:solid 1px #CCC;padding:10px}.odb-table-excludes td{padding:3px}#odb-options-tables-container{text-align:center}#odb-options-tables-wrapper{width:97%;display:inline-block;margin-top:16px;margin-left:-16px;padding:8px 0}.odb-options-table{background-color:#f0f0f0;display:inline-block;height:17px;margin:3px;border:solid 1px #E0E0E0;overflow:hidden;padding:2px;text-align:left;white-space:nowrap;width:200px}
1
+ @charset "utf-8";.odb-title-bar{width:96%;background-color:#0074a2;color:#fff!important;display:inline-block;padding-left:16px;margin-top:30px}.odb-title-bar h2{color:#fff}.odb-bold{font-weight:900}.odb-normal{font-weight:400}.odb-italic{font-style:italic}.odb-blue{color:#0074a2}#odb-running{background:rgba(0,0,0,.08) url(../images/running.gif) no-repeat 50% 50%;width:100%;height:100%;position:fixed;top:0;left:0;z-index:999}.odb-action{font-size:13px;font-weight:700;color:#000}.odb-wp-table{font-weight:700;color:#0074a2}.odb-padding-left{padding-left:8px}.odb-border-bottom{border-bottom:solid 1px #999}.odb-border-top{border-top:solid 1px #999}.odb-optimizing-table{margin-top:16px}.odb-optimized{color:#0074a2;font-weight:700}.odb-underline-red{text-decoration:underline;color:red}.odb-updated{position:relative;left:-15px}.odb-found{font-size:13px;font-weight:700;color:#000}.odb-found-number{margin-left:8px;margin-bottom:18px;font-size:13px;font-weight:700;color:#000}.odb-result-table{background-color:#e8e8e8;margin-bottom:20px}.odb-not-found{margin-left:8px;margin-bottom:16px;color:#999}.odb-post-type-select{font-size:inherit}.odb-schedule-select{font-size:inherit;padding:0;margin:0}.odb-schedulehour{display:none}.odb-schedulehour-select{font-size:inherit}.odb-table-excludes{margin-top:10px;border:solid 1px #ccc;padding:10px}.odb-table-excludes td{padding:3px}#odb-options-tables-container{text-align:center}#odb-options-tables-wrapper{width:97%;display:inline-block;margin-top:16px;margin-left:-16px;padding:8px 0 8px 0}.odb-options-table{background-color:#f0f0f0;display:inline-block;height:17px;margin:3px;border:solid 1px #e0e0e0;overflow:hidden;padding:2px;text-align:left;white-space:nowrap;width:200px}
includes/settings-page.php CHANGED
@@ -9,18 +9,19 @@
9
  if(isset($_REQUEST['delete_log']))
10
  if($_REQUEST['delete_log'] == "Y") @unlink(dirname(__FILE__).'/rvg-optimize-db-log.html');
11
 
12
- if (isset($_POST['info_update']))
13
- { // SAVE SETTINGS
14
  check_admin_referer('odb_action', 'odb_nonce');
15
 
16
- // var_dump($_POST);
17
-
18
  $current_datetime = Date('YmdHis');
19
  $current_date = substr($current_datetime, 0, 8);
20
  $current_hour = substr($current_datetime, 8, 2);
21
 
22
  // var_dump($_POST);
23
 
 
 
 
24
  if(isset($_POST['rvg_odb_delete_older'])) $this->odb_rvg_options['delete_older'] = sanitize_text_field($_POST['rvg_odb_delete_older']);
25
  else $this->odb_rvg_options['delete_older'] = 'N';
26
 
@@ -53,8 +54,7 @@ if (isset($_POST['info_update']))
53
  if(isset($_POST['rvg_odb_logging_on'])) $this->odb_rvg_options['logging_on'] = sanitize_text_field($_POST['rvg_odb_logging_on']);
54
  else $this->odb_rvg_options['logging_on'] = 'N';
55
 
56
- if(isset($_POST['rvg_odb_schedule']))
57
- {
58
  $type_old = $this->odb_rvg_options['schedule_type'];
59
  $hour_old = $this->odb_rvg_options['schedule_hour'];
60
 
@@ -66,8 +66,8 @@ if (isset($_POST['info_update']))
66
  $hour = '';
67
  if(isset($_POST['rvg_odb_schedulehour'])) $hour = sanitize_text_field($_POST['rvg_odb_schedulehour']);
68
 
69
- if($type_old != sanitize_text_field($_POST['rvg_odb_schedule']) || $hour_old != $hour)
70
- { // SCHEDULE CHANGED
71
  $this->odb_rvg_options['schedule_type'] = sanitize_text_field($_POST['rvg_odb_schedule']);
72
  $this->odb_rvg_options['schedule_hour'] = $hour;
73
  if($this->odb_rvg_options['schedule_type'] == '')
@@ -76,7 +76,7 @@ if (isset($_POST['info_update']))
76
  else
77
  // RE-SCHEDULE
78
  $this->odb_scheduler_obj->odb_reschedule();
79
- }
80
  } // if(isset($_POST['rvg_odb_schedule']))
81
 
82
  if(isset($_POST['rvg_odb_adminbar'])) $this->odb_rvg_options['adminbar'] = sanitize_text_field($_POST['rvg_odb_adminbar']);
@@ -110,86 +110,84 @@ if (isset($_POST['info_update']))
110
  } // if (isset($_POST['info_update']))
111
  ?>
112
  <script type="text/javascript">
113
- function rvg_odb_delete_older_changed()
114
- { if(!jQuery('input[name=rvg_odb_delete_older]:checked').val())
115
- {
116
  jQuery("#rvg_odb_older_than").prop('disabled', true);
117
  jQuery("#rvg_odb_older_than").val("");
 
 
118
  }
119
- else
120
- { jQuery("#rvg_odb_older_than").prop('disabled', false);
121
- }
122
- }
123
- function rvg_odb_keep_revisions_changed()
124
- { if(!jQuery('input[name=rvg_odb_keep_revisions]:checked').val())
125
- {
126
  jQuery("#rvg_odb_number").prop('disabled', true);
127
  jQuery("#rvg_odb_number").val("");
 
 
128
  }
129
- else
130
- { jQuery("#rvg_odb_number").prop('disabled', false);
131
- }
132
- }
133
- function schedule_changed()
134
- { if(jQuery("#rvg_odb_schedule").val() == "daily" || jQuery("#rvg_odb_schedule").val() == "weekly" || jQuery("#rvg_odb_schedule").val() == "monthly")
135
  jQuery("#schedulehour").show();
136
  else
137
  jQuery("#schedulehour").hide();
138
- }
 
139
  function rvg_odb_check_form()
140
  {
141
- if(jQuery('input[name=rvg_odb_delete_older]:checked').val())
142
- { if(jQuery("#rvg_odb_older_than").val() == '')
143
- { jQuery("#rvg_odb_older_than").focus();
144
  alert('<?php _e("You have to enter: ",$this->odb_txt_domain)?> <'+'<?php _e("Delete revisions older than",$this->odb_txt_domain)?>'+'>');
145
  return false;
146
  }
147
- if(!jQuery.isNumeric(jQuery("#rvg_odb_older_than").val()))
148
- { jQuery("#rvg_odb_older_than").focus();
149
  alert('<?php _e("<Delete revisions older than> should be a number", $this->odb_txt_domain)?>');
150
  return false;
151
  }
152
- }
153
 
154
- if(jQuery('input[name=rvg_odb_keep_revisions]:checked').val())
155
- { if(jQuery("#rvg_odb_number").val() == '')
156
- { jQuery("#rvg_odb_number").focus();
157
  alert('<?php _e("You have to enter the <Maximum number of revisions>", $this->odb_txt_domain)?>');
158
  return false;
159
  }
160
- if(!jQuery.isNumeric(jQuery("#rvg_odb_number").val()))
161
- { jQuery("#rvg_odb_number").focus();
162
  alert('<?php _e("<Maximum number of revisions> should be a number", $this->odb_txt_domain)?>');
163
  return false;
164
  }
165
- }
166
 
167
  return true;
168
- }
169
  </script>
170
  <?php
171
  // CHECKBOXES
172
  $c = ' checked';
173
  $d = ' disabled';
174
 
175
- if($this->odb_rvg_options['delete_older'] == "Y")
176
- { // CHECKED
177
  $cb_delete_older = $c;
178
  $cb_disabled1 = '';
179
- }
180
- else
181
- { // UNCHECKED
182
  $cb_delete_older = '';
183
  $this->odb_rvg_options['older_than'] = '';
184
  $cb_disabled1 = $d;
185
  }
186
- if($this->odb_rvg_options['rvg_revisions'] == "Y")
187
- { // CHECKED
 
188
  $cb_keep_revisions = $c;
189
  $cb_disabled2 = '';
190
- }
191
- else
192
- { // UNCHECED
193
  $cb_keep_revisions = '';
194
  $this->odb_rvg_options['nr_of_revisions'] = '';
195
  $cb_disabled2 = $d;
@@ -224,6 +222,24 @@ echo '
224
  <h2>'.__('Settings',$this->odb_txt_domain).'</h2>
225
  </div>
226
  <table border="0" cellspacing="2" cellpadding="5" class="editform" align="center">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
227
  <tr>
228
  <td width="50%" align="right"><span class="odb-bold">'. __('Delete revisions older than',$this->odb_txt_domain).'</span></td>
229
  <td width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="3">
@@ -335,8 +351,8 @@ echo '
335
  <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour" class="odb-schedulehour-select">
336
  ';
337
 
338
- for($i=0; $i<=23; $i++)
339
- { if($i<10) $i = '0'.$i;
340
  ?>
341
  <option value="<?php echo $i?>"><?php echo $i.':00 '.__('hrs',$this->odb_txt_domain)?></option>
342
  <?php
@@ -398,8 +414,8 @@ echo '
398
  <div id="odb-options-tables-wrapper">
399
  ';
400
 
401
- for ($i=0; $i<count($this->odb_tables); $i++)
402
- { $class = '';
403
  for($j=0; $j<count($this->odb_ms_prefixes); $j++)
404
  if(substr($this->odb_tables[$i][0], 0, strlen($this->odb_ms_prefixes[$j])) == $this->odb_ms_prefixes[$j]) $class = ' odb-wp-table';
405
  $cb_checked = '';
9
  if(isset($_REQUEST['delete_log']))
10
  if($_REQUEST['delete_log'] == "Y") @unlink(dirname(__FILE__).'/rvg-optimize-db-log.html');
11
 
12
+ if (isset($_POST['info_update'])) {
13
+ // SAVE SETTINGS
14
  check_admin_referer('odb_action', 'odb_nonce');
15
 
 
 
16
  $current_datetime = Date('YmdHis');
17
  $current_date = substr($current_datetime, 0, 8);
18
  $current_hour = substr($current_datetime, 8, 2);
19
 
20
  // var_dump($_POST);
21
 
22
+ if(isset($_POST['rvg_odb_rev_post_type'])) $this->odb_rvg_options['rev_post_type'] = sanitize_text_field($_POST['rvg_odb_rev_post_type']);
23
+ else $this->odb_rvg_options['rev_post_type'] = '';
24
+
25
  if(isset($_POST['rvg_odb_delete_older'])) $this->odb_rvg_options['delete_older'] = sanitize_text_field($_POST['rvg_odb_delete_older']);
26
  else $this->odb_rvg_options['delete_older'] = 'N';
27
 
54
  if(isset($_POST['rvg_odb_logging_on'])) $this->odb_rvg_options['logging_on'] = sanitize_text_field($_POST['rvg_odb_logging_on']);
55
  else $this->odb_rvg_options['logging_on'] = 'N';
56
 
57
+ if(isset($_POST['rvg_odb_schedule'])) {
 
58
  $type_old = $this->odb_rvg_options['schedule_type'];
59
  $hour_old = $this->odb_rvg_options['schedule_hour'];
60
 
66
  $hour = '';
67
  if(isset($_POST['rvg_odb_schedulehour'])) $hour = sanitize_text_field($_POST['rvg_odb_schedulehour']);
68
 
69
+ if($type_old != sanitize_text_field($_POST['rvg_odb_schedule']) || $hour_old != $hour) {
70
+ // SCHEDULE CHANGED
71
  $this->odb_rvg_options['schedule_type'] = sanitize_text_field($_POST['rvg_odb_schedule']);
72
  $this->odb_rvg_options['schedule_hour'] = $hour;
73
  if($this->odb_rvg_options['schedule_type'] == '')
76
  else
77
  // RE-SCHEDULE
78
  $this->odb_scheduler_obj->odb_reschedule();
79
+ } // if($type_old != sanitize_text_field($_POST['rvg_odb_schedule']) || $hour_old != $hour)
80
  } // if(isset($_POST['rvg_odb_schedule']))
81
 
82
  if(isset($_POST['rvg_odb_adminbar'])) $this->odb_rvg_options['adminbar'] = sanitize_text_field($_POST['rvg_odb_adminbar']);
110
  } // if (isset($_POST['info_update']))
111
  ?>
112
  <script type="text/javascript">
113
+ function rvg_odb_delete_older_changed() {
114
+ if(!jQuery('input[name=rvg_odb_delete_older]:checked').val()) {
 
115
  jQuery("#rvg_odb_older_than").prop('disabled', true);
116
  jQuery("#rvg_odb_older_than").val("");
117
+ } else {
118
+ jQuery("#rvg_odb_older_than").prop('disabled', false);
119
  }
120
+ } // rvg_odb_delete_older_changed()
121
+
122
+ function rvg_odb_keep_revisions_changed() {
123
+ if(!jQuery('input[name=rvg_odb_keep_revisions]:checked').val()) {
 
 
 
124
  jQuery("#rvg_odb_number").prop('disabled', true);
125
  jQuery("#rvg_odb_number").val("");
126
+ } else {
127
+ jQuery("#rvg_odb_number").prop('disabled', false);
128
  }
129
+ } // rvg_odb_keep_revisions_changed()
130
+
131
+ function schedule_changed() {
132
+ if(jQuery("#rvg_odb_schedule").val() == "daily" || jQuery("#rvg_odb_schedule").val() == "weekly" || jQuery("#rvg_odb_schedule").val() == "monthly")
 
 
133
  jQuery("#schedulehour").show();
134
  else
135
  jQuery("#schedulehour").hide();
136
+ } // schedule_changed()
137
+
138
  function rvg_odb_check_form()
139
  {
140
+ if(jQuery('input[name=rvg_odb_delete_older]:checked').val()) {
141
+ if(jQuery("#rvg_odb_older_than").val() == '') {
142
+ jQuery("#rvg_odb_older_than").focus();
143
  alert('<?php _e("You have to enter: ",$this->odb_txt_domain)?> <'+'<?php _e("Delete revisions older than",$this->odb_txt_domain)?>'+'>');
144
  return false;
145
  }
146
+ if(!jQuery.isNumeric(jQuery("#rvg_odb_older_than").val())) {
147
+ jQuery("#rvg_odb_older_than").focus();
148
  alert('<?php _e("<Delete revisions older than> should be a number", $this->odb_txt_domain)?>');
149
  return false;
150
  }
151
+ } // if(jQuery('input[name=rvg_odb_delete_older]:checked').val())
152
 
153
+ if(jQuery('input[name=rvg_odb_keep_revisions]:checked').val()) {
154
+ if(jQuery("#rvg_odb_number").val() == '') {
155
+ jQuery("#rvg_odb_number").focus();
156
  alert('<?php _e("You have to enter the <Maximum number of revisions>", $this->odb_txt_domain)?>');
157
  return false;
158
  }
159
+ if(!jQuery.isNumeric(jQuery("#rvg_odb_number").val())) {
160
+ jQuery("#rvg_odb_number").focus();
161
  alert('<?php _e("<Maximum number of revisions> should be a number", $this->odb_txt_domain)?>');
162
  return false;
163
  }
164
+ } // if(jQuery('input[name=rvg_odb_keep_revisions]:checked').val())
165
 
166
  return true;
167
+ } // function rvg_odb_check_form()
168
  </script>
169
  <?php
170
  // CHECKBOXES
171
  $c = ' checked';
172
  $d = ' disabled';
173
 
174
+ if($this->odb_rvg_options['delete_older'] == "Y") {
175
+ // CHECKED
176
  $cb_delete_older = $c;
177
  $cb_disabled1 = '';
178
+ } else {
179
+ // UNCHECKED
 
180
  $cb_delete_older = '';
181
  $this->odb_rvg_options['older_than'] = '';
182
  $cb_disabled1 = $d;
183
  }
184
+
185
+ if($this->odb_rvg_options['rvg_revisions'] == "Y") {
186
+ // CHECKED
187
  $cb_keep_revisions = $c;
188
  $cb_disabled2 = '';
189
+ } else {
190
+ // UNCHECED
 
191
  $cb_keep_revisions = '';
192
  $this->odb_rvg_options['nr_of_revisions'] = '';
193
  $cb_disabled2 = $d;
222
  <h2>'.__('Settings',$this->odb_txt_domain).'</h2>
223
  </div>
224
  <table border="0" cellspacing="2" cellpadding="5" class="editform" align="center">
225
+ <tr>
226
+ <td width="50%" align="right"><span class="odb-bold">'. __('Delete revisions of',$this->odb_txt_domain).'</span></td>
227
+ <td width="50%" valign="top"><select name="rvg_odb_rev_post_type" id="rvg_odb_rev_post_type" class="odb-post-type-select">
228
+ <option selected="selected" value="">
229
+ '.__('POSTS and PAGES',$this->odb_txt_domain).'
230
+ </option>
231
+ <option value="post">
232
+ '.__('POSTS only',$this->odb_txt_domain).'
233
+ </option>
234
+ <option value="page">
235
+ '.__('PAGES only',$this->odb_txt_domain).'
236
+ </option>
237
+ </select>
238
+ <script type="text/javascript">
239
+ jQuery("#rvg_odb_rev_post_type").val("'.$this->odb_rvg_options['rev_post_type'].'");
240
+ </script>
241
+ </td>
242
+ </tr>
243
  <tr>
244
  <td width="50%" align="right"><span class="odb-bold">'. __('Delete revisions older than',$this->odb_txt_domain).'</span></td>
245
  <td width="50%" valign="top"><table border="0" cellspacing="0" cellpadding="3">
351
  <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour" class="odb-schedulehour-select">
352
  ';
353
 
354
+ for($i=0; $i<=23; $i++) {
355
+ if($i < 10) $i = '0'.$i;
356
  ?>
357
  <option value="<?php echo $i?>"><?php echo $i.':00 '.__('hrs',$this->odb_txt_domain)?></option>
358
  <?php
414
  <div id="odb-options-tables-wrapper">
415
  ';
416
 
417
+ for ($i=0; $i<count($this->odb_tables); $i++) {
418
+ $class = '';
419
  for($j=0; $j<count($this->odb_ms_prefixes); $j++)
420
  if(substr($this->odb_tables[$i][0], 0, strlen($this->odb_ms_prefixes[$j])) == $this->odb_ms_prefixes[$j]) $class = ' odb-wp-table';
421
  $cb_checked = '';
language/rvg-optimize-database-nl_NL.mo CHANGED
Binary file
language/rvg-optimize-database-nl_NL.po CHANGED
@@ -1,9 +1,9 @@
1
  msgid ""
2
  msgstr ""
3
- "Project-Id-Version: Optimize Database after Deleting Revisions v2.8.3\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2016-01-16 15:55+0100\n"
6
- "PO-Revision-Date: 2016-01-16 15:55+0100\n"
7
  "Last-Translator: Rolf van Gelder <info@cagewebdev.com>\n"
8
  "Language-Team: CAGE <info@cagewebdev.com>\n"
9
  "Language: nl_NL\n"
@@ -11,7 +11,7 @@ msgstr ""
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
- "X-Generator: Poedit 1.7.4\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
@@ -19,425 +19,450 @@ msgstr ""
19
  "X-Textdomain-Support: yes\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
 
22
- #: classes/odb-cleaner.php:35
23
  msgid "Cleaning Database"
24
  msgstr "Opschonen Database"
25
 
26
- #: classes/odb-cleaner.php:87
27
  msgid "DELETED REVISIONS"
28
  msgstr "VERWIJDERDE REVISIES"
29
 
30
- #: classes/odb-cleaner.php:92 classes/odb-cleaner.php:152
31
- #: classes/odb-cleaner.php:213
32
  msgid "prefix"
33
  msgstr "prefix"
34
 
35
- #: classes/odb-cleaner.php:93
36
  msgid "post / page"
37
  msgstr "bericht / pagina"
38
 
39
- #: classes/odb-cleaner.php:94
40
  msgid "revision date"
41
  msgstr "revisiedatum"
42
 
43
- #: classes/odb-cleaner.php:95
44
  msgid "revisions deleted"
45
  msgstr "revisies verwijderd"
46
 
47
- #: classes/odb-cleaner.php:107
48
  msgid "total number of revisions deleted"
49
  msgstr "totaal aantal verwijderde revisies"
50
 
51
- #: classes/odb-cleaner.php:119
52
  msgid "No REVISIONS found to delete"
53
  msgstr "Geen REVISIES gevonden om te verwijderen"
54
 
55
- #: classes/odb-cleaner.php:147
56
  msgid "DELETED TRASHED ITEMS"
57
  msgstr "VERWIJDERDE TRASHED ITEMS"
58
 
59
- #: classes/odb-cleaner.php:153
60
  msgid "type"
61
  msgstr "type"
62
 
63
- #: classes/odb-cleaner.php:154
64
  msgid "IP address / title"
65
  msgstr "IP adres / titel"
66
 
67
- #: classes/odb-cleaner.php:155
68
  msgid "date"
69
  msgstr "datum"
70
 
71
- #: classes/odb-cleaner.php:167
72
  msgid "total number of trashed items deleted"
73
  msgstr "totaal aantal verwijderede trashed items"
74
 
75
- #: classes/odb-cleaner.php:180
76
  msgid "No TRASHED ITEMS found to delete"
77
  msgstr "Geen PRULLENBAK ITEMS gevonden om te verwijderen"
78
 
79
- #: classes/odb-cleaner.php:208
80
  msgid "DELETEED SPAMMED ITEMS"
81
  msgstr "VERWIJDERDE SPAMMEND ITEMS"
82
 
83
- #: classes/odb-cleaner.php:214
84
  msgid "comment author"
85
  msgstr "plaatser van de reactie"
86
 
87
- #: classes/odb-cleaner.php:215
88
  msgid "comment author email"
89
  msgstr "email van de plaatser van de reactie"
90
 
91
- #: classes/odb-cleaner.php:216
92
  msgid "comment date"
93
  msgstr "datum van de reactie"
94
 
95
- #: classes/odb-cleaner.php:228
96
  msgid "total number of spammed items deleted"
97
  msgstr "totaal aantal verwijderde spammed items"
98
 
99
- #: classes/odb-cleaner.php:241
100
  msgid "No SPAMMED ITEMS found to delete"
101
  msgstr "Geen SPAM gevonden om te verwijderen"
102
 
103
- #: classes/odb-cleaner.php:266
104
  msgid "NUMBER OF UNUSED TAGS DELETED"
105
  msgstr "AANTAL VERWIJDERDE ONGEBRUIKTE TAGS"
106
 
107
- #: classes/odb-cleaner.php:276
108
  msgid "No UNUSED TAGS found to delete"
109
  msgstr "Geen ONGEBRUIKTE TAGS gevonden om te verwijderen"
110
 
111
- #: classes/odb-cleaner.php:300
112
  msgid "NUMBER OF EXPIRED TRANSIENTS DELETED"
113
  msgstr "AANTAL VERWIJDERDE VERLOPEN TRANSIËNTS"
114
 
115
- #: classes/odb-cleaner.php:310
116
  msgid "No EXPIRED TRANSIENTS found to delete"
117
  msgstr "Geen VERLOPEN TRANSIËNTS gevonden om te verwijderen"
118
 
119
- #: classes/odb-cleaner.php:334
120
  msgid "NUMBER OF PINGBACKS AND TRACKBACKS DELETED"
121
  msgstr "AANTAL VERWIJDERDE PINGBACKS EN TRACKBACKS"
122
 
123
- #: classes/odb-cleaner.php:344
124
  msgid "No PINGBACKS nor TRACKBACKS found to delete"
125
  msgstr "Geen PINGBACKS en TRACKBACKS gevonden om te verwijderen"
126
 
127
- #: classes/odb-cleaner.php:365
128
  msgid "NUMBER OF POSTMETA ORPHANS DELETED"
129
  msgstr "AANTAL VERWIJDERDE POSTMETA WEZEN"
130
 
131
- #: classes/odb-cleaner.php:375
132
  msgid "No POSTMETA ORPHANS found to delete"
133
  msgstr "Geen POSTMETA WEZEN gevonden om te verwijderen"
134
 
135
- #: classes/odb-cleaner.php:403
136
  msgid "Optimizing Database Tables"
137
  msgstr "Optimaliseren van Databasetabellen"
138
 
139
- #: classes/odb-cleaner.php:410
140
  msgid "table name"
141
  msgstr "tabelnaam"
142
 
143
- #: classes/odb-cleaner.php:411
144
  msgid "optimization result"
145
  msgstr "resultaat optimalisatie"
146
 
147
- #: classes/odb-cleaner.php:412
148
  msgid "engine"
149
  msgstr "engine"
150
 
151
- #: classes/odb-cleaner.php:413
152
  msgid "table rows"
153
  msgstr "tabelrijen"
154
 
155
- #: classes/odb-cleaner.php:414
156
  msgid "table size"
157
  msgstr "tabelgrootte"
158
 
159
- #: classes/odb-cleaner.php:462
160
  msgid "Savings"
161
  msgstr "Besparingen"
162
 
163
- #: classes/odb-cleaner.php:469
164
  msgid "size of the database"
165
  msgstr "grootte van de database"
166
 
167
- #: classes/odb-cleaner.php:472
168
  msgid "BEFORE optimization"
169
  msgstr "VOOR de optimalisatie"
170
 
171
- #: classes/odb-cleaner.php:476
172
  msgid "AFTER optimization"
173
  msgstr "NA de optimalisatie"
174
 
175
- #: classes/odb-cleaner.php:480
176
  msgid "SAVINGS THIS TIME"
177
  msgstr "DIT KEER BESPAARD"
178
 
179
- #: classes/odb-cleaner.php:484
180
  msgid "TOTAL SAVINGS SINCE THE FIRST RUN"
181
  msgstr "TOTALE BESPARING SINDS DE EERSTE UITVOERING"
182
 
183
- #: classes/odb-cleaner.php:511
184
  msgid "DONE!"
185
  msgstr "KLAAR!"
186
 
187
- #: classes/odb-cleaner.php:516
188
  msgid "Optimization took"
189
  msgstr "Optimalizatie duurde"
190
 
191
- #: classes/odb-cleaner.php:516
192
  msgid "seconds"
193
  msgstr "seconden"
194
 
195
- #: classes/odb-cleaner.php:524 classes/odb-displayer.php:142
196
  msgid "View Log File"
197
  msgstr "Bekijk Logbestand"
198
 
199
- #: classes/odb-cleaner.php:526 classes/odb-displayer.php:144
200
  msgid "Delete Log File"
201
  msgstr "Verwijder Logbestand"
202
 
203
- #: classes/odb-cleaner.php:711
204
  msgid "of"
205
  msgstr "van"
206
 
207
- #: classes/odb-cleaner.php:1139
208
  msgid "InnoDB table: skipped..."
209
  msgstr "InnoDB tabel overgeslagen..."
210
 
211
- #: classes/odb-cleaner.php:1145 classes/odb-cleaner.php:1147
212
  msgid "<span class=\"odb-optimized\">TABLE OPTIMIZED</span>"
213
  msgstr "<span class=\"odb-optimized\">TABEL GEOPTIMALISEERD</span>"
214
 
215
- #: classes/odb-cleaner.php:1146
216
  msgid "Table is already up to date"
217
  msgstr "Tabel is al optimaal"
218
 
219
  #: classes/odb-displayer.php:28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
220
  msgid "YES"
221
  msgstr "JA"
222
 
223
- #: classes/odb-displayer.php:29
224
  msgid "NO"
225
  msgstr "NEE"
226
 
227
- #: classes/odb-displayer.php:41
228
  msgid "EVERY FIVE MINUTES"
229
  msgstr "IEDERE VIJF MINUTEN"
230
 
231
- #: classes/odb-displayer.php:43
232
  msgid "ONCE HOURLY"
233
  msgstr "ELK UUR"
234
 
235
- #: classes/odb-displayer.php:45
236
  msgid "TWICE DAILY"
237
  msgstr "TWEEMAAL DAAGS"
238
 
239
- #: classes/odb-displayer.php:47
240
  msgid "ONCE DAILY"
241
  msgstr "DAGELIJKS"
242
 
243
- #: classes/odb-displayer.php:49
244
  msgid "ONCE WEEKLY"
245
  msgstr "WEKELIJKS"
246
 
247
- #: classes/odb-displayer.php:50 includes/settings-page.php:280
 
 
 
 
248
  msgid "NOT SCHEDULED"
249
  msgstr "NIET GEPLAND"
250
 
251
- #: classes/odb-displayer.php:55
252
  msgid "Current settings"
253
  msgstr "Huidige instellingen"
254
 
255
- #: classes/odb-displayer.php:61 includes/settings-page.php:140
256
- #: includes/settings-page.php:201
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
257
  msgid "Delete revisions older than"
258
  msgstr "Verwijder revisies ouder dan"
259
 
260
- #: classes/odb-displayer.php:61
261
  msgid "days"
262
  msgstr "dagen"
263
 
264
- #: classes/odb-displayer.php:64
265
  msgid "Maximum number of - most recent - revisions to keep per post / page"
266
  msgstr ""
267
  "Maximaal aantal (meest recente) revisies die bewaard worden per bericht / "
268
  "pagina"
269
 
270
- #: classes/odb-displayer.php:68 includes/settings-page.php:234
271
  msgid "Delete trashed items"
272
  msgstr "Verwijder trashed items"
273
 
274
- #: classes/odb-displayer.php:69 includes/settings-page.php:240
275
  msgid "Delete spammed items"
276
  msgstr "Verwijder spammed items"
277
 
278
- #: classes/odb-displayer.php:70 includes/settings-page.php:246
279
  msgid "Delete unused tags"
280
  msgstr "Verwijder ongebruikte tags"
281
 
282
- #: classes/odb-displayer.php:71 includes/settings-page.php:252
283
  msgid "Delete expired transients"
284
  msgstr "Verwijder verlopen transiënts"
285
 
286
- #: classes/odb-displayer.php:72 includes/settings-page.php:258
287
  msgid "Delete pingbacks and trackbacks"
288
  msgstr "Verwijder pingback en trackbacks"
289
 
290
- #: classes/odb-displayer.php:73 includes/settings-page.php:270
291
  msgid "Keep a log"
292
  msgstr "Gebruik een logbestand"
293
 
294
- #: classes/odb-displayer.php:74
295
  msgid "Optimize InnoDB tables"
296
  msgstr "Optimaliseer InnoDB tabellen"
297
 
298
- #: classes/odb-displayer.php:75
299
  msgid "Last run"
300
  msgstr "Laatste uitvoering"
301
 
302
- #: classes/odb-displayer.php:75 classes/odb-displayer.php:84
303
- #: includes/settings-page.php:311
304
  msgid "hrs"
305
  msgstr "uur"
306
 
307
- #: classes/odb-displayer.php:76
308
  msgid "Number of excluded tables"
309
  msgstr "Aantal uitgesloten tabellen"
310
 
311
- #: classes/odb-displayer.php:77 includes/settings-page.php:276
312
  msgid "Scheduler"
313
  msgstr "Planner"
314
 
315
- #: classes/odb-displayer.php:84
316
  msgid "Next scheduled run"
317
  msgstr "Volgende geplande uitvoering"
318
 
319
- #: classes/odb-displayer.php:84
320
  msgid "current server time"
321
  msgstr "huidige systeemtijd"
322
 
323
- #: classes/odb-displayer.php:89
324
  msgid "Total savings since the first run"
325
  msgstr "Totale besparing sinds de eerste uitvoering"
326
 
327
- #: classes/odb-displayer.php:106
328
- msgid "Optimize Database after Deleting Revisions"
329
- msgstr "Optimize Database after Deleting Revisions"
330
-
331
- #: classes/odb-displayer.php:109
332
- msgid ""
333
- "A popular 'one-click' plugin to clean and optimize your WordPress database."
334
- msgstr ""
335
- "Een populaire 'one-click' plugin om de WordPress database op te schonen en "
336
- "te optimaliseren."
337
-
338
- #: classes/odb-displayer.php:112
339
- msgid "Plugin version"
340
- msgstr "Plugin versie"
341
-
342
- #: classes/odb-displayer.php:113
343
- msgid "Plugin page"
344
- msgstr "Pluginpagina"
345
-
346
- #: classes/odb-displayer.php:114
347
- msgid "Download page"
348
- msgstr "Downloadpagina"
349
-
350
- #: classes/odb-displayer.php:115
351
- msgid "Author"
352
- msgstr "Auteur"
353
-
354
- #: classes/odb-displayer.php:116
355
- msgid "Company"
356
- msgstr "Bedrijf"
357
-
358
- #: classes/odb-displayer.php:117
359
- msgid "Donation page"
360
- msgstr "Donatiepagina"
361
-
362
- #: classes/odb-displayer.php:135
363
  msgid "Change Settings"
364
  msgstr "Wijzig instellingen"
365
 
366
- #: classes/odb-displayer.php:151
367
  msgid "Start Optimization"
368
  msgstr "Start Optimalisatie"
369
 
370
- #: classes/odb-logger.php:55
371
  msgid "A WordPress Plugin by"
372
  msgstr "Een WordPress Plugin door"
373
 
374
- #: classes/odb-logger.php:55
375
  msgid "The Netherlands"
376
  msgstr "Nederland"
377
 
378
- #: classes/odb-logger.php:59
379
  msgid "time"
380
  msgstr "tijd"
381
 
382
- #: classes/odb-logger.php:60
383
  msgid "deleted<br />revisions"
384
  msgstr "verw.<br />revisies"
385
 
386
- #: classes/odb-logger.php:61
387
  msgid "deleted<br />trash"
388
  msgstr "verw.<br />prullenbak items"
389
 
390
- #: classes/odb-logger.php:62
391
  msgid "deleted<br />spam"
392
  msgstr "verw.<br />spamitems"
393
 
394
- #: classes/odb-logger.php:63
395
  msgid "deleted<br />tags"
396
  msgstr "verw.<br /> tags"
397
 
398
- #: classes/odb-logger.php:64
399
  msgid "deleted<br />transients"
400
  msgstr "verw.<br />transiënts"
401
 
402
- #: classes/odb-logger.php:65
403
  msgid "deleted<br />pingbacks<br />trackbacks"
404
  msgstr "verwijderde<br />pingbacks<br />trackbacks"
405
 
406
- #: classes/odb-logger.php:66
407
  msgid "deleted<br />orphans"
408
  msgstr "verw.<br />wezen"
409
 
410
  # @ rvg-optimize-database
411
- #: classes/odb-logger.php:67
412
  msgid "nr of optimized tables"
413
  msgstr "aantal geoptima-<br />liseerde tabellen"
414
 
415
- #: classes/odb-logger.php:68
416
  msgid "database size BEFORE"
417
  msgstr "database<br />grootte<br />VOOR"
418
 
419
- #: classes/odb-logger.php:69
420
  msgid "database size AFTER"
421
  msgstr "database<br />grootte<br />NA"
422
 
423
- #: classes/odb-logger.php:70
424
  msgid "SAVINGS"
425
  msgstr "BESPARINGEN"
426
 
427
  # @ default
428
- #: classes/odb-scheduler.php:39
429
  msgid "Once Weekly"
430
  msgstr "Eenmaal per week"
431
 
432
- #: classes/odb-scheduler.php:44
 
 
 
 
 
433
  msgid "Every Five Minutes"
434
  msgstr "Iedere vijf minuten"
435
 
436
- #: includes/settings-page.php:102
437
  msgid "Optimize Database after Deleting Revisions SETTINGS UPDATED"
438
  msgstr "Optimize Database after Deleting Revisions INSTELLINGEN AANGEPAST"
439
 
440
- #: includes/settings-page.php:104
441
  msgid ""
442
  "Click <a href=\"tools.php?page=rvg-optimize-database\" class=\"odb-bold"
443
  "\">HERE</a> to run the optimization"
@@ -445,76 +470,88 @@ msgstr ""
445
  "Klik <a href=\"tools.php?page=rvg-optimize-database\" class=\"odb-bold"
446
  "\">HIER</a> om de optimalisatie te starten"
447
 
448
- #: includes/settings-page.php:140
449
  msgid "You have to enter: "
450
  msgstr "Je moet invullen:"
451
 
452
- #: includes/settings-page.php:145
453
  msgid "<Delete revisions older than> should be a number"
454
  msgstr "<Verwijder revisites ouder dan> moet een getal zijn"
455
 
456
- #: includes/settings-page.php:153
457
  msgid "You have to enter the <Maximum number of revisions>"
458
  msgstr "Je moet het <Maximaal aantal revisies> invullen"
459
 
460
- #: includes/settings-page.php:158
461
  msgid "<Maximum number of revisions> should be a number"
462
  msgstr "<Maximaal aantal revisies> moet een getal zijn"
463
 
464
- #: includes/settings-page.php:197 rvg-optimize-database.php:395
465
  msgid "Settings"
466
  msgstr "Instellingen"
467
 
468
- #: includes/settings-page.php:206
469
  msgid "day(s)"
470
  msgstr "dag(en)"
471
 
472
- #: includes/settings-page.php:218
473
  msgid "Maximum number of - most recent - revisions<br>to keep per post / page"
474
  msgstr ""
475
  "Maximaal aantal - meest recente - revisies<br>om te bewaren per post/pagina"
476
 
477
- #: includes/settings-page.php:224
478
  msgid "('0' means: delete <u>ALL</u> revisions)"
479
  msgstr "('0' betekent: verwijder <u>ALLE</u> revisies)"
480
 
481
- #: includes/settings-page.php:264
482
  msgid "Optimize InnoDB tables too"
483
  msgstr "Optimiliseer ook InnoDB tabellen"
484
 
485
- #: includes/settings-page.php:283
486
  msgid "run optimization HOURLY"
487
  msgstr "voer de optimalisatie ELK UUR uit"
488
 
489
- #: includes/settings-page.php:286
490
  msgid "run optimization TWICE A DAY"
491
  msgstr "voer de optimalisatie TWEE KEER PER DAG uit"
492
 
493
- #: includes/settings-page.php:289
494
  msgid "run optimization DAILY"
495
  msgstr "voer de optimalisatie DAGELIJKS uit"
496
 
497
- #: includes/settings-page.php:292
498
  msgid "run optimization WEEKLY"
499
  msgstr "voer de optimalisatie WEKELIJKS uit"
500
 
501
- #: includes/settings-page.php:302
 
 
 
 
502
  msgid "Time"
503
  msgstr "Tijd"
504
 
505
- #: includes/settings-page.php:326
506
  msgid "Show '1-click' link in Admin Bar"
507
  msgstr "Toon de '1-klik' link in de Admin Balk"
508
 
509
- #: includes/settings-page.php:332
510
  msgid "Show an icon in the Admin Menu"
511
  msgstr "Toon een icon in het Admin Menu"
512
 
513
- #: includes/settings-page.php:337
514
  msgid "change will be visible after loading the next page"
515
  msgstr "wijziging wordt pas zichtbaar na het laden van de volgende pagina"
516
 
517
- #: includes/settings-page.php:341
 
 
 
 
 
 
 
 
518
  msgid ""
519
  "EXCLUDE DATABASE TABLES FROM OPTIMIZATION:<br><span class=\"odb-underline-red"
520
  "\">CHECKED</span> TABLES <span class=\"odb-underline-red\">WON'T</span> BE "
@@ -524,40 +561,32 @@ msgstr ""
524
  "underline-red\">AANGEVINKTE</span> TABELLEN ZULLEN <span class=\"odb-"
525
  "underline-red\">NIET</span> GEOPTIMALISEERD WORDEN!</span>"
526
 
527
- #: includes/settings-page.php:347
528
  msgid "check all tables"
529
  msgstr "vink alle tabellen aan"
530
 
531
- #: includes/settings-page.php:349
532
  msgid "uncheck all tables"
533
  msgstr "vink alle tabellen uit"
534
 
535
- #: includes/settings-page.php:351
536
  msgid "check all NON-WordPress tables"
537
  msgstr "vink alle NIET-WordPress tabellen aan"
538
 
539
- #: includes/settings-page.php:378
540
- msgid "Save Settings"
541
- msgstr "Bewaar instellingen"
542
-
543
- #: includes/settings-page.php:380
544
- msgid "Go To Optimizer"
545
- msgstr "Ga naar Optimalisatie"
546
-
547
  # @ rvg-optimize-database
548
- #: rvg-optimize-database.php:367 rvg-optimize-database.php:368
549
- #: rvg-optimize-database.php:382 rvg-optimize-database.php:383
550
- #: rvg-optimize-database.php:425 rvg-optimize-database.php:426
551
- #: rvg-optimize-database.php:444 rvg-optimize-database.php:445
552
  msgid "Optimize Database"
553
  msgstr "Optimaliseer Database"
554
 
555
  # @ optimize_db
556
- #: rvg-optimize-database.php:412
557
  msgid "Optimize DB (1 click)"
558
  msgstr "Optimaliseer DB (1 klik)"
559
 
560
- #: rvg-optimize-database.php:545
561
  msgid "Optimize Database after Deleting Revisions LOG FILE HAS BEEN DELETED"
562
  msgstr "Optimize Database after Deleting Revisions LOGBESTAND VERWIJDERD"
563
 
1
  msgid ""
2
  msgstr ""
3
+ "Project-Id-Version: Optimize Database after Deleting Revisions v4.3\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2017-07-24 13:59+0200\n"
6
+ "PO-Revision-Date: 2017-07-24 14:02+0200\n"
7
  "Last-Translator: Rolf van Gelder <info@cagewebdev.com>\n"
8
  "Language-Team: CAGE <info@cagewebdev.com>\n"
9
  "Language: nl_NL\n"
11
  "Content-Type: text/plain; charset=UTF-8\n"
12
  "Content-Transfer-Encoding: 8bit\n"
13
  "Plural-Forms: nplurals=2; plural=n != 1;\n"
14
+ "X-Generator: Poedit 2.0.3\n"
15
  "X-Poedit-SourceCharset: UTF-8\n"
16
  "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
17
  "_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
19
  "X-Textdomain-Support: yes\n"
20
  "X-Poedit-SearchPath-0: .\n"
21
 
22
+ #: classes/odb-cleaner.php:31
23
  msgid "Cleaning Database"
24
  msgstr "Opschonen Database"
25
 
26
+ #: classes/odb-cleaner.php:81
27
  msgid "DELETED REVISIONS"
28
  msgstr "VERWIJDERDE REVISIES"
29
 
30
+ #: classes/odb-cleaner.php:86 classes/odb-cleaner.php:141
31
+ #: classes/odb-cleaner.php:196
32
  msgid "prefix"
33
  msgstr "prefix"
34
 
35
+ #: classes/odb-cleaner.php:87
36
  msgid "post / page"
37
  msgstr "bericht / pagina"
38
 
39
+ #: classes/odb-cleaner.php:88
40
  msgid "revision date"
41
  msgstr "revisiedatum"
42
 
43
+ #: classes/odb-cleaner.php:89
44
  msgid "revisions deleted"
45
  msgstr "revisies verwijderd"
46
 
47
+ #: classes/odb-cleaner.php:100
48
  msgid "total number of revisions deleted"
49
  msgstr "totaal aantal verwijderde revisies"
50
 
51
+ #: classes/odb-cleaner.php:110
52
  msgid "No REVISIONS found to delete"
53
  msgstr "Geen REVISIES gevonden om te verwijderen"
54
 
55
+ #: classes/odb-cleaner.php:136
56
  msgid "DELETED TRASHED ITEMS"
57
  msgstr "VERWIJDERDE TRASHED ITEMS"
58
 
59
+ #: classes/odb-cleaner.php:142
60
  msgid "type"
61
  msgstr "type"
62
 
63
+ #: classes/odb-cleaner.php:143
64
  msgid "IP address / title"
65
  msgstr "IP adres / titel"
66
 
67
+ #: classes/odb-cleaner.php:144
68
  msgid "date"
69
  msgstr "datum"
70
 
71
+ #: classes/odb-cleaner.php:155
72
  msgid "total number of trashed items deleted"
73
  msgstr "totaal aantal verwijderede trashed items"
74
 
75
+ #: classes/odb-cleaner.php:165
76
  msgid "No TRASHED ITEMS found to delete"
77
  msgstr "Geen PRULLENBAK ITEMS gevonden om te verwijderen"
78
 
79
+ #: classes/odb-cleaner.php:191
80
  msgid "DELETEED SPAMMED ITEMS"
81
  msgstr "VERWIJDERDE SPAMMEND ITEMS"
82
 
83
+ #: classes/odb-cleaner.php:197
84
  msgid "comment author"
85
  msgstr "plaatser van de reactie"
86
 
87
+ #: classes/odb-cleaner.php:198
88
  msgid "comment author email"
89
  msgstr "email van de plaatser van de reactie"
90
 
91
+ #: classes/odb-cleaner.php:199
92
  msgid "comment date"
93
  msgstr "datum van de reactie"
94
 
95
+ #: classes/odb-cleaner.php:210
96
  msgid "total number of spammed items deleted"
97
  msgstr "totaal aantal verwijderde spammed items"
98
 
99
+ #: classes/odb-cleaner.php:220
100
  msgid "No SPAMMED ITEMS found to delete"
101
  msgstr "Geen SPAM gevonden om te verwijderen"
102
 
103
+ #: classes/odb-cleaner.php:242
104
  msgid "NUMBER OF UNUSED TAGS DELETED"
105
  msgstr "AANTAL VERWIJDERDE ONGEBRUIKTE TAGS"
106
 
107
+ #: classes/odb-cleaner.php:249
108
  msgid "No UNUSED TAGS found to delete"
109
  msgstr "Geen ONGEBRUIKTE TAGS gevonden om te verwijderen"
110
 
111
+ #: classes/odb-cleaner.php:271
112
  msgid "NUMBER OF EXPIRED TRANSIENTS DELETED"
113
  msgstr "AANTAL VERWIJDERDE VERLOPEN TRANSIËNTS"
114
 
115
+ #: classes/odb-cleaner.php:278
116
  msgid "No EXPIRED TRANSIENTS found to delete"
117
  msgstr "Geen VERLOPEN TRANSIËNTS gevonden om te verwijderen"
118
 
119
+ #: classes/odb-cleaner.php:300
120
  msgid "NUMBER OF PINGBACKS AND TRACKBACKS DELETED"
121
  msgstr "AANTAL VERWIJDERDE PINGBACKS EN TRACKBACKS"
122
 
123
+ #: classes/odb-cleaner.php:307
124
  msgid "No PINGBACKS nor TRACKBACKS found to delete"
125
  msgstr "Geen PINGBACKS en TRACKBACKS gevonden om te verwijderen"
126
 
127
+ #: classes/odb-cleaner.php:326
128
  msgid "NUMBER OF POSTMETA ORPHANS DELETED"
129
  msgstr "AANTAL VERWIJDERDE POSTMETA WEZEN"
130
 
131
+ #: classes/odb-cleaner.php:333
132
  msgid "No POSTMETA ORPHANS found to delete"
133
  msgstr "Geen POSTMETA WEZEN gevonden om te verwijderen"
134
 
135
+ #: classes/odb-cleaner.php:359
136
  msgid "Optimizing Database Tables"
137
  msgstr "Optimaliseren van Databasetabellen"
138
 
139
+ #: classes/odb-cleaner.php:366
140
  msgid "table name"
141
  msgstr "tabelnaam"
142
 
143
+ #: classes/odb-cleaner.php:367
144
  msgid "optimization result"
145
  msgstr "resultaat optimalisatie"
146
 
147
+ #: classes/odb-cleaner.php:368
148
  msgid "engine"
149
  msgstr "engine"
150
 
151
+ #: classes/odb-cleaner.php:369
152
  msgid "table rows"
153
  msgstr "tabelrijen"
154
 
155
+ #: classes/odb-cleaner.php:370
156
  msgid "table size"
157
  msgstr "tabelgrootte"
158
 
159
+ #: classes/odb-cleaner.php:416
160
  msgid "Savings"
161
  msgstr "Besparingen"
162
 
163
+ #: classes/odb-cleaner.php:423
164
  msgid "size of the database"
165
  msgstr "grootte van de database"
166
 
167
+ #: classes/odb-cleaner.php:426
168
  msgid "BEFORE optimization"
169
  msgstr "VOOR de optimalisatie"
170
 
171
+ #: classes/odb-cleaner.php:430
172
  msgid "AFTER optimization"
173
  msgstr "NA de optimalisatie"
174
 
175
+ #: classes/odb-cleaner.php:434
176
  msgid "SAVINGS THIS TIME"
177
  msgstr "DIT KEER BESPAARD"
178
 
179
+ #: classes/odb-cleaner.php:438
180
  msgid "TOTAL SAVINGS SINCE THE FIRST RUN"
181
  msgstr "TOTALE BESPARING SINDS DE EERSTE UITVOERING"
182
 
183
+ #: classes/odb-cleaner.php:464
184
  msgid "DONE!"
185
  msgstr "KLAAR!"
186
 
187
+ #: classes/odb-cleaner.php:469
188
  msgid "Optimization took"
189
  msgstr "Optimalizatie duurde"
190
 
191
+ #: classes/odb-cleaner.php:469
192
  msgid "seconds"
193
  msgstr "seconden"
194
 
195
+ #: classes/odb-cleaner.php:477 classes/odb-displayer.php:150
196
  msgid "View Log File"
197
  msgstr "Bekijk Logbestand"
198
 
199
+ #: classes/odb-cleaner.php:479 classes/odb-displayer.php:152
200
  msgid "Delete Log File"
201
  msgstr "Verwijder Logbestand"
202
 
203
+ #: classes/odb-cleaner.php:677
204
  msgid "of"
205
  msgstr "van"
206
 
207
+ #: classes/odb-cleaner.php:1117
208
  msgid "InnoDB table: skipped..."
209
  msgstr "InnoDB tabel overgeslagen..."
210
 
211
+ #: classes/odb-cleaner.php:1122 classes/odb-cleaner.php:1124
212
  msgid "<span class=\"odb-optimized\">TABLE OPTIMIZED</span>"
213
  msgstr "<span class=\"odb-optimized\">TABEL GEOPTIMALISEERD</span>"
214
 
215
+ #: classes/odb-cleaner.php:1123
216
  msgid "Table is already up to date"
217
  msgstr "Tabel is al optimaal"
218
 
219
  #: classes/odb-displayer.php:28
220
+ msgid "Optimize Database after Deleting Revisions"
221
+ msgstr "Optimize Database after Deleting Revisions"
222
+
223
+ #: classes/odb-displayer.php:31
224
+ msgid ""
225
+ "A popular 'one-click' plugin to clean and optimize your WordPress database."
226
+ msgstr ""
227
+ "Een populaire 'one-click' plugin om de WordPress database op te schonen en "
228
+ "te optimaliseren."
229
+
230
+ #: classes/odb-displayer.php:34
231
+ msgid "Plugin version"
232
+ msgstr "Plugin versie"
233
+
234
+ #: classes/odb-displayer.php:35
235
+ msgid "Plugin page"
236
+ msgstr "Pluginpagina"
237
+
238
+ #: classes/odb-displayer.php:36
239
+ msgid "Download page"
240
+ msgstr "Downloadpagina"
241
+
242
+ #: classes/odb-displayer.php:37
243
+ msgid "Author"
244
+ msgstr "Auteur"
245
+
246
+ #: classes/odb-displayer.php:38
247
+ msgid "Company"
248
+ msgstr "Bedrijf"
249
+
250
+ #: classes/odb-displayer.php:39
251
+ msgid "Donation page"
252
+ msgstr "Donatiepagina"
253
+
254
+ #: classes/odb-displayer.php:55
255
  msgid "YES"
256
  msgstr "JA"
257
 
258
+ #: classes/odb-displayer.php:56
259
  msgid "NO"
260
  msgstr "NEE"
261
 
262
+ #: classes/odb-displayer.php:68
263
  msgid "EVERY FIVE MINUTES"
264
  msgstr "IEDERE VIJF MINUTEN"
265
 
266
+ #: classes/odb-displayer.php:70
267
  msgid "ONCE HOURLY"
268
  msgstr "ELK UUR"
269
 
270
+ #: classes/odb-displayer.php:72
271
  msgid "TWICE DAILY"
272
  msgstr "TWEEMAAL DAAGS"
273
 
274
+ #: classes/odb-displayer.php:74
275
  msgid "ONCE DAILY"
276
  msgstr "DAGELIJKS"
277
 
278
+ #: classes/odb-displayer.php:76
279
  msgid "ONCE WEEKLY"
280
  msgstr "WEKELIJKS"
281
 
282
+ #: classes/odb-displayer.php:78
283
+ msgid "ONCE MONTHLY"
284
+ msgstr "MAANDELIJKS"
285
+
286
+ #: classes/odb-displayer.php:79 includes/settings-page.php:323
287
  msgid "NOT SCHEDULED"
288
  msgstr "NIET GEPLAND"
289
 
290
+ #: classes/odb-displayer.php:84
291
  msgid "Current settings"
292
  msgstr "Huidige instellingen"
293
 
294
+ #: classes/odb-displayer.php:90 includes/settings-page.php:232
295
+ msgid "POSTS only"
296
+ msgstr "BERICHTEN alleen"
297
+
298
+ #: classes/odb-displayer.php:92 includes/settings-page.php:235
299
+ msgid "PAGES only"
300
+ msgstr "PAGINA'S alleen"
301
+
302
+ #: classes/odb-displayer.php:94 includes/settings-page.php:229
303
+ msgid "POSTS and PAGES"
304
+ msgstr "BERICHTEN en PAGINA'S"
305
+
306
+ #: classes/odb-displayer.php:95 includes/settings-page.php:226
307
+ msgid "Delete revisions of"
308
+ msgstr "Verwijder revisies van"
309
+
310
+ #: classes/odb-displayer.php:98 includes/settings-page.php:143
311
+ #: includes/settings-page.php:244
312
  msgid "Delete revisions older than"
313
  msgstr "Verwijder revisies ouder dan"
314
 
315
+ #: classes/odb-displayer.php:98
316
  msgid "days"
317
  msgstr "dagen"
318
 
319
+ #: classes/odb-displayer.php:102
320
  msgid "Maximum number of - most recent - revisions to keep per post / page"
321
  msgstr ""
322
  "Maximaal aantal (meest recente) revisies die bewaard worden per bericht / "
323
  "pagina"
324
 
325
+ #: classes/odb-displayer.php:106 includes/settings-page.php:277
326
  msgid "Delete trashed items"
327
  msgstr "Verwijder trashed items"
328
 
329
+ #: classes/odb-displayer.php:107 includes/settings-page.php:283
330
  msgid "Delete spammed items"
331
  msgstr "Verwijder spammed items"
332
 
333
+ #: classes/odb-displayer.php:108 includes/settings-page.php:289
334
  msgid "Delete unused tags"
335
  msgstr "Verwijder ongebruikte tags"
336
 
337
+ #: classes/odb-displayer.php:109 includes/settings-page.php:295
338
  msgid "Delete expired transients"
339
  msgstr "Verwijder verlopen transiënts"
340
 
341
+ #: classes/odb-displayer.php:110 includes/settings-page.php:301
342
  msgid "Delete pingbacks and trackbacks"
343
  msgstr "Verwijder pingback en trackbacks"
344
 
345
+ #: classes/odb-displayer.php:111 includes/settings-page.php:313
346
  msgid "Keep a log"
347
  msgstr "Gebruik een logbestand"
348
 
349
+ #: classes/odb-displayer.php:112
350
  msgid "Optimize InnoDB tables"
351
  msgstr "Optimaliseer InnoDB tabellen"
352
 
353
+ #: classes/odb-displayer.php:113
354
  msgid "Last run"
355
  msgstr "Laatste uitvoering"
356
 
357
+ #: classes/odb-displayer.php:113 classes/odb-displayer.php:122
358
+ #: includes/settings-page.php:357
359
  msgid "hrs"
360
  msgstr "uur"
361
 
362
+ #: classes/odb-displayer.php:114
363
  msgid "Number of excluded tables"
364
  msgstr "Aantal uitgesloten tabellen"
365
 
366
+ #: classes/odb-displayer.php:115 includes/settings-page.php:319
367
  msgid "Scheduler"
368
  msgstr "Planner"
369
 
370
+ #: classes/odb-displayer.php:122
371
  msgid "Next scheduled run"
372
  msgstr "Volgende geplande uitvoering"
373
 
374
+ #: classes/odb-displayer.php:122
375
  msgid "current server time"
376
  msgstr "huidige systeemtijd"
377
 
378
+ #: classes/odb-displayer.php:127
379
  msgid "Total savings since the first run"
380
  msgstr "Totale besparing sinds de eerste uitvoering"
381
 
382
+ #: classes/odb-displayer.php:143
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
383
  msgid "Change Settings"
384
  msgstr "Wijzig instellingen"
385
 
386
+ #: classes/odb-displayer.php:159
387
  msgid "Start Optimization"
388
  msgstr "Start Optimalisatie"
389
 
390
+ #: classes/odb-logger.php:52
391
  msgid "A WordPress Plugin by"
392
  msgstr "Een WordPress Plugin door"
393
 
394
+ #: classes/odb-logger.php:52
395
  msgid "The Netherlands"
396
  msgstr "Nederland"
397
 
398
+ #: classes/odb-logger.php:56
399
  msgid "time"
400
  msgstr "tijd"
401
 
402
+ #: classes/odb-logger.php:57
403
  msgid "deleted<br />revisions"
404
  msgstr "verw.<br />revisies"
405
 
406
+ #: classes/odb-logger.php:58
407
  msgid "deleted<br />trash"
408
  msgstr "verw.<br />prullenbak items"
409
 
410
+ #: classes/odb-logger.php:59
411
  msgid "deleted<br />spam"
412
  msgstr "verw.<br />spamitems"
413
 
414
+ #: classes/odb-logger.php:60
415
  msgid "deleted<br />tags"
416
  msgstr "verw.<br /> tags"
417
 
418
+ #: classes/odb-logger.php:61
419
  msgid "deleted<br />transients"
420
  msgstr "verw.<br />transiënts"
421
 
422
+ #: classes/odb-logger.php:62
423
  msgid "deleted<br />pingbacks<br />trackbacks"
424
  msgstr "verwijderde<br />pingbacks<br />trackbacks"
425
 
426
+ #: classes/odb-logger.php:63
427
  msgid "deleted<br />orphans"
428
  msgstr "verw.<br />wezen"
429
 
430
  # @ rvg-optimize-database
431
+ #: classes/odb-logger.php:64
432
  msgid "nr of optimized tables"
433
  msgstr "aantal geoptima-<br />liseerde tabellen"
434
 
435
+ #: classes/odb-logger.php:65
436
  msgid "database size BEFORE"
437
  msgstr "database<br />grootte<br />VOOR"
438
 
439
+ #: classes/odb-logger.php:66
440
  msgid "database size AFTER"
441
  msgstr "database<br />grootte<br />NA"
442
 
443
+ #: classes/odb-logger.php:67
444
  msgid "SAVINGS"
445
  msgstr "BESPARINGEN"
446
 
447
  # @ default
448
+ #: classes/odb-scheduler.php:37
449
  msgid "Once Weekly"
450
  msgstr "Eenmaal per week"
451
 
452
+ # @ default
453
+ #: classes/odb-scheduler.php:41
454
+ msgid "Once Monthly"
455
+ msgstr "Maandelijks"
456
+
457
+ #: classes/odb-scheduler.php:46
458
  msgid "Every Five Minutes"
459
  msgstr "Iedere vijf minuten"
460
 
461
+ #: includes/settings-page.php:106
462
  msgid "Optimize Database after Deleting Revisions SETTINGS UPDATED"
463
  msgstr "Optimize Database after Deleting Revisions INSTELLINGEN AANGEPAST"
464
 
465
+ #: includes/settings-page.php:108
466
  msgid ""
467
  "Click <a href=\"tools.php?page=rvg-optimize-database\" class=\"odb-bold"
468
  "\">HERE</a> to run the optimization"
470
  "Klik <a href=\"tools.php?page=rvg-optimize-database\" class=\"odb-bold"
471
  "\">HIER</a> om de optimalisatie te starten"
472
 
473
+ #: includes/settings-page.php:143
474
  msgid "You have to enter: "
475
  msgstr "Je moet invullen:"
476
 
477
+ #: includes/settings-page.php:148
478
  msgid "<Delete revisions older than> should be a number"
479
  msgstr "<Verwijder revisites ouder dan> moet een getal zijn"
480
 
481
+ #: includes/settings-page.php:156
482
  msgid "You have to enter the <Maximum number of revisions>"
483
  msgstr "Je moet het <Maximaal aantal revisies> invullen"
484
 
485
+ #: includes/settings-page.php:161
486
  msgid "<Maximum number of revisions> should be a number"
487
  msgstr "<Maximaal aantal revisies> moet een getal zijn"
488
 
489
+ #: includes/settings-page.php:222 rvg-optimize-database.php:389
490
  msgid "Settings"
491
  msgstr "Instellingen"
492
 
493
+ #: includes/settings-page.php:249
494
  msgid "day(s)"
495
  msgstr "dag(en)"
496
 
497
+ #: includes/settings-page.php:261
498
  msgid "Maximum number of - most recent - revisions<br>to keep per post / page"
499
  msgstr ""
500
  "Maximaal aantal - meest recente - revisies<br>om te bewaren per post/pagina"
501
 
502
+ #: includes/settings-page.php:267
503
  msgid "('0' means: delete <u>ALL</u> revisions)"
504
  msgstr "('0' betekent: verwijder <u>ALLE</u> revisies)"
505
 
506
+ #: includes/settings-page.php:307
507
  msgid "Optimize InnoDB tables too"
508
  msgstr "Optimiliseer ook InnoDB tabellen"
509
 
510
+ #: includes/settings-page.php:326
511
  msgid "run optimization HOURLY"
512
  msgstr "voer de optimalisatie ELK UUR uit"
513
 
514
+ #: includes/settings-page.php:329
515
  msgid "run optimization TWICE A DAY"
516
  msgstr "voer de optimalisatie TWEE KEER PER DAG uit"
517
 
518
+ #: includes/settings-page.php:332
519
  msgid "run optimization DAILY"
520
  msgstr "voer de optimalisatie DAGELIJKS uit"
521
 
522
+ #: includes/settings-page.php:335
523
  msgid "run optimization WEEKLY"
524
  msgstr "voer de optimalisatie WEKELIJKS uit"
525
 
526
+ #: includes/settings-page.php:338
527
+ msgid "run optimization MONTHLY"
528
+ msgstr "voer de optimalisatie MAANDELIJKS uit"
529
+
530
+ #: includes/settings-page.php:348
531
  msgid "Time"
532
  msgstr "Tijd"
533
 
534
+ #: includes/settings-page.php:372
535
  msgid "Show '1-click' link in Admin Bar"
536
  msgstr "Toon de '1-klik' link in de Admin Balk"
537
 
538
+ #: includes/settings-page.php:378
539
  msgid "Show an icon in the Admin Menu"
540
  msgstr "Toon een icon in het Admin Menu"
541
 
542
+ #: includes/settings-page.php:383
543
  msgid "change will be visible after loading the next page"
544
  msgstr "wijziging wordt pas zichtbaar na het laden van de volgende pagina"
545
 
546
+ #: includes/settings-page.php:388 includes/settings-page.php:434
547
+ msgid "Save Settings"
548
+ msgstr "Bewaar instellingen"
549
+
550
+ #: includes/settings-page.php:390 includes/settings-page.php:436
551
+ msgid "Go To Optimizer"
552
+ msgstr "Ga naar Optimalisatie"
553
+
554
+ #: includes/settings-page.php:397
555
  msgid ""
556
  "EXCLUDE DATABASE TABLES FROM OPTIMIZATION:<br><span class=\"odb-underline-red"
557
  "\">CHECKED</span> TABLES <span class=\"odb-underline-red\">WON'T</span> BE "
561
  "underline-red\">AANGEVINKTE</span> TABELLEN ZULLEN <span class=\"odb-"
562
  "underline-red\">NIET</span> GEOPTIMALISEERD WORDEN!</span>"
563
 
564
+ #: includes/settings-page.php:403
565
  msgid "check all tables"
566
  msgstr "vink alle tabellen aan"
567
 
568
+ #: includes/settings-page.php:405
569
  msgid "uncheck all tables"
570
  msgstr "vink alle tabellen uit"
571
 
572
+ #: includes/settings-page.php:407
573
  msgid "check all NON-WordPress tables"
574
  msgstr "vink alle NIET-WordPress tabellen aan"
575
 
 
 
 
 
 
 
 
 
576
  # @ rvg-optimize-database
577
+ #: rvg-optimize-database.php:361 rvg-optimize-database.php:362
578
+ #: rvg-optimize-database.php:376 rvg-optimize-database.php:377
579
+ #: rvg-optimize-database.php:417 rvg-optimize-database.php:418
580
+ #: rvg-optimize-database.php:435 rvg-optimize-database.php:436
581
  msgid "Optimize Database"
582
  msgstr "Optimaliseer Database"
583
 
584
  # @ optimize_db
585
+ #: rvg-optimize-database.php:406
586
  msgid "Optimize DB (1 click)"
587
  msgstr "Optimaliseer DB (1 klik)"
588
 
589
+ #: rvg-optimize-database.php:533
590
  msgid "Optimize Database after Deleting Revisions LOG FILE HAS BEEN DELETED"
591
  msgstr "Optimize Database after Deleting Revisions LOGBESTAND VERWIJDERD"
592
 
readme.txt CHANGED
@@ -8,8 +8,8 @@ Author URI: http://cagewebdev.com
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.8
10
  Tested up to: 4.8
11
- Stable tag: 4.2.3
12
- Version: 4.2.3
13
  License: GPLv2 or later
14
 
15
  == Description ==
@@ -102,6 +102,10 @@ http://cagewebdev.com/wordpress-plugins/
102
  * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
103
 
104
  == Changelog ==
 
 
 
 
105
  = 4.2.3 [07/05/2017] =
106
  * CHANGE: Extra save button added to the settings page
107
 
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.8
10
  Tested up to: 4.8
11
+ Stable tag: 4.3
12
+ Version: 4.3
13
  License: GPLv2 or later
14
 
15
  == Description ==
102
  * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
103
 
104
  == Changelog ==
105
+ = 4.3 [07/24/2017] =
106
+ * NEW: New setting added: Delete revisions of (POSTS and PAGES, POSTS only or PAGES only)
107
+ * CHANGE: Some code clean-up and minor changes
108
+
109
  = 4.2.3 [07/05/2017] =
110
  * CHANGE: Extra save button added to the settings page
111
 
rvg-optimize-database.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
- * @version 4.2.3
5
  */
6
  /*
7
  Plugin Name: Optimize Database after Deleting Revisions
@@ -10,7 +10,7 @@ Description: Optimizes the Wordpress Database after Cleaning it out
10
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
11
  Author URI: http://cagewebdev.com
12
  Network: True
13
- Version: 4.2.3
14
  */
15
 
16
  /********************************************************************************************
@@ -22,11 +22,10 @@ Version: 4.2.3
22
  global $odb_class;
23
  $odb_class = new OptimizeDatabase();
24
 
25
- class OptimizeDatabase
26
- {
27
  // VERSION
28
- var $odb_version = '4.2.3';
29
- var $odb_release_date = '07/05/2017';
30
 
31
  // PLUGIN OPTIONS
32
  var $odb_rvg_options = array();
@@ -72,8 +71,7 @@ class OptimizeDatabase
72
  /*******************************************************************************
73
  * CONSTRUCTOR
74
  *******************************************************************************/
75
- function __construct()
76
- {
77
  // INITIALIZE PLUGIN
78
  add_action('init', array(&$this, 'odb_init'));
79
  } // __construct()
@@ -82,8 +80,7 @@ class OptimizeDatabase
82
  /*******************************************************************************
83
  * INITIALIZE PLUGIN
84
  *******************************************************************************/
85
- function odb_init()
86
- {
87
  // LOAD CLASSES
88
  $this->odb_classes();
89
 
@@ -124,8 +121,7 @@ class OptimizeDatabase
124
  /*******************************************************************************
125
  * LOAD AND INITIALIZE CLASSES
126
  *******************************************************************************/
127
- function odb_classes()
128
- {
129
  // LOAD CLASSES
130
  include_once('classes/odb-cleaner.php');
131
  include_once('classes/odb-displayer.php');
@@ -147,8 +143,7 @@ class OptimizeDatabase
147
  /*******************************************************************************
148
  * INITIALIZE URLS AND DIRECTORIES
149
  *******************************************************************************/
150
- function odb_urls_dirs()
151
- {
152
  $this->odb_plugin_url = plugins_url( '/', __FILE__ );
153
  $this->odb_plugin_path = plugin_dir_path(__FILE__);
154
  $this->odb_logfile_url = $this->odb_plugin_url.'logs/rvg-optimize-db-log.html';
@@ -160,8 +155,7 @@ class OptimizeDatabase
160
  /*******************************************************************************
161
  * LOAD OPTIONS
162
  *******************************************************************************/
163
- function odb_load_options()
164
- {
165
  // GET OPTIONS
166
  $this->odb_rvg_options = $this->odb_multisite_obj->odb_ms_get_option('odb_rvg_options');
167
 
@@ -219,40 +213,39 @@ class OptimizeDatabase
219
  /*******************************************************************************
220
  * COPY AND DELETE OPTIONS FROM PREVIOUS VERSIONS (BEFORE 4.0)
221
  *******************************************************************************/
222
- function odb_convert_options()
223
- {
224
  global $wpdb;
225
 
226
  // STOP OLD SCHEDULER
227
  wp_clear_scheduled_hook('rvg_optimize_database');
228
 
229
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_total_savings');
230
- if($setting)
231
- { $this->odb_rvg_options['total_savings'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_total_savings');
232
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_total_savings');
233
  }
234
 
235
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_pingbacks');
236
- if($setting)
237
- { $this->odb_rvg_options['clear_pingbacks'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_pingbacks');
238
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_pingbacks');
239
  }
240
 
241
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_spam');
242
- if($setting)
243
- { $this->odb_rvg_options['clear_spam'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_spam');
244
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_spam');
245
  }
246
 
247
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_tags');
248
- if($setting)
249
- { $this->odb_rvg_options['clear_tags'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_tags');
250
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_tags');
251
  }
252
 
253
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_transients');
254
- if($setting)
255
- { $this->odb_rvg_options['clear_transients'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_transients');
256
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_transients');
257
  }
258
 
@@ -263,20 +256,20 @@ class OptimizeDatabase
263
  }
264
 
265
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminbar');
266
- if($setting)
267
- { $this->odb_rvg_options['adminbar'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminbar');
268
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_adminbar');
269
  }
270
 
271
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminmenu');
272
- if($setting)
273
- { $this->odb_rvg_options['adminmenu'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminmenu');
274
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_adminmenu');
275
  }
276
 
277
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_logging_on');
278
- if($setting)
279
- { $this->odb_rvg_options['logging_on'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_logging_on');
280
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_logging_on');
281
  }
282
 
@@ -296,8 +289,7 @@ class OptimizeDatabase
296
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_schedulehour');
297
 
298
  // COPY EXCLUDED TABLES
299
- for($i=0; $i<count($this->odb_ms_prefixes); $i++)
300
- {
301
  $sql = "
302
  SELECT `option_name`
303
  FROM ".$this->odb_ms_prefixes[$i]."options
@@ -305,13 +297,13 @@ class OptimizeDatabase
305
  ";
306
 
307
  $res = $wpdb->get_results($sql, ARRAY_A);
308
- for($j=0; $j<count($res); $j++)
309
- { $option_name = $res[$j]['option_name'];
310
  $option_name_new = substr($option_name, 7);
311
  $this->odb_rvg_excluded_tabs[$option_name_new] = 'Y';
312
  $this->odb_multisite_obj->odb_ms_delete_option($option_name);
313
- }
314
- }
315
 
316
  // UPDATE EXCLUDED TABLES
317
  $this->odb_multisite_obj->odb_ms_update_option('odb_rvg_excluded_tabs', $this->odb_rvg_excluded_tabs);
@@ -321,8 +313,7 @@ class OptimizeDatabase
321
  /*******************************************************************************
322
  * INITIALIZE WORDPRESS HOOKS
323
  *******************************************************************************/
324
- function odb_init_hooks()
325
- {
326
  global $blog_id;
327
 
328
  // ON DE-ACTIVATION
@@ -332,22 +323,20 @@ class OptimizeDatabase
332
  register_uninstall_hook(__FILE__, array('OptimizeDatabase', 'odb_uninstallation_handler'));
333
 
334
  // ADD ENTRY TO ADMIN TOOLS MENU
335
- if (is_multisite())
336
- { if ($blog_id == 1)
337
- { // v4.1: PLUGIN ONLY CAN BE USED ON THE MAIN SITE (NOT ON THE SUB SITES)
338
  add_action('admin_menu', array(&$this, 'odb_admin_tools'));
339
  add_action('admin_menu', array(&$this, 'odb_admin_settings'));
340
- }
341
- }
342
- else
343
- {
344
  add_action('admin_menu', array(&$this, 'odb_admin_tools'));
345
  add_action('admin_menu', array(&$this, 'odb_admin_settings'));
346
- }
347
 
348
  // ICON MODE: ADD ICON TO ADMIN MENU
349
- if ($this->odb_rvg_options['adminmenu'] == "Y")
350
- { add_action('admin_menu', array(&$this, 'odb_admin_icon'));
351
  add_action('admin_menu', array(&$this, 'odb_register_options'));
352
  }
353
 
@@ -366,9 +355,9 @@ class OptimizeDatabase
366
  /*******************************************************************************
367
  * ADD ENTRY TO THE ADMIN TOOLS MENU
368
  *******************************************************************************/
369
- function odb_admin_tools()
370
- { if (function_exists('add_management_page'))
371
- { add_management_page(
372
  __('Optimize Database',$this->odb_txt_domain), // page title
373
  __('Optimize Database',$this->odb_txt_domain), // menu title
374
  'manage_options', // capability
@@ -381,8 +370,8 @@ class OptimizeDatabase
381
  /*******************************************************************************
382
  * ADD ENTRY TO THE ADMIN SETTINGS MENU
383
  *******************************************************************************/
384
- function odb_admin_settings()
385
- { if (function_exists('add_options_page'))
386
  add_options_page(
387
  __('Optimize Database', $this->odb_txt_domain), // page title
388
  __('Optimize Database', $this->odb_txt_domain), // menu title
@@ -396,8 +385,8 @@ class OptimizeDatabase
396
  /*******************************************************************************
397
  * ADD 'SETTINGS' LINK TO THE MAIN PLUGIN PAGE
398
  *******************************************************************************/
399
- function odb_settings_link($links)
400
- { array_unshift($links, '<a href="options-general.php?page=odb_settings_page">'.__('Settings', $this->odb_txt_domain).'</a>');
401
  return $links;
402
  } // odb_settings_link()
403
 
@@ -405,8 +394,8 @@ class OptimizeDatabase
405
  /********************************************************************************************
406
  * ADD THE '1 CLICK OPTIMIZE DATABASE' ITEM TO THE ADMIN BAR (IF ACTIVATED)
407
  ********************************************************************************************/
408
- function odb_admin_bar()
409
- { global $wp_admin_bar;
410
 
411
  if (!is_super_admin() || !is_admin_bar_showing()) return;
412
 
@@ -422,10 +411,8 @@ class OptimizeDatabase
422
  /********************************************************************************************
423
  * 'ICON MODE': ADD A LINK TO THE ADMIN MENU
424
  ********************************************************************************************/
425
- function odb_admin_icon()
426
- {
427
- if (function_exists('add_menu_page'))
428
- {
429
  add_menu_page(
430
  __('Optimize Database', $this->odb_txt_domain), // page title
431
  __('Optimize Database', $this->odb_txt_domain), // menu title
@@ -441,10 +428,9 @@ class OptimizeDatabase
441
  /********************************************************************************************
442
  * 'ICON MODE': REGISTER OPTION PAGE BUT HIDE IT FROM THE ADMIN MENU
443
  ********************************************************************************************/
444
- function odb_register_options()
445
- {
446
- if (function_exists('add_submenu_page'))
447
- { add_submenu_page(
448
  null, // parent slug (NULL is hide from menu)
449
  __('Optimize Database', $this->odb_txt_domain), // page title
450
  __('Optimize Database', $this->odb_txt_domain), // menu title
@@ -459,8 +445,7 @@ class OptimizeDatabase
459
  /*******************************************************************************
460
  * LOAD TEXT DOMAIN
461
  *******************************************************************************/
462
- function odb_i18n()
463
- {
464
  load_plugin_textdomain(
465
  $this->odb_txt_domain, // domain
466
  false, // abs rel path
@@ -473,8 +458,7 @@ class OptimizeDatabase
473
  * ARE WE ON A, FOR THIS PLUGIN, RELEVANT PAGE?
474
  * Since v4.0.3
475
  *******************************************************************************/
476
- function odb_is_relevant_page()
477
- {
478
  $this_page = '';
479
  if(isset($_GET['page'])) $this_page = $_GET['page'];
480
  return ($this_page == 'odb_settings_page' || $this_page == 'rvg-optimize-database');
@@ -484,8 +468,8 @@ class OptimizeDatabase
484
  /*******************************************************************************
485
  * PLUGIN DE-ACTIVATION
486
  *******************************************************************************/
487
- public static function odb_deactivation_handler()
488
- { // STOP SCHEDULER
489
  wp_clear_scheduled_hook('odb_scheduler');
490
  } // odb_deactivation_handler()
491
 
@@ -493,8 +477,8 @@ class OptimizeDatabase
493
  /*******************************************************************************
494
  * PLUGIN UN-INSTALLATION
495
  *******************************************************************************/
496
- public static function odb_uninstallation_handler()
497
- { // STOP SCHEDULER
498
  wp_clear_scheduled_hook('odb_scheduler');
499
  } // odb_uninstallation_handler()
500
 
@@ -502,8 +486,8 @@ class OptimizeDatabase
502
  /*******************************************************************************
503
  * LOAD SETTINGS (OPTIONS) PAGE
504
  *******************************************************************************/
505
- function odb_settings_page()
506
- { global $wpdb, $odb_rvg_excluded_tabs, $odb_ms_prefixes;
507
 
508
  include_once(trailingslashit(dirname(__FILE__)).'/includes/settings-page.php');
509
  } // odb_settings_page()
@@ -512,8 +496,7 @@ class OptimizeDatabase
512
  /*******************************************************************************
513
  * START CLEANING / OPTIMIZATION (INITIATED BY THE USER, NOT FROM WP-CRON)
514
  *******************************************************************************/
515
- function odb_start_manually()
516
- {
517
  $this->odb_start(false);
518
  } // odb_start_manually()
519
 
@@ -521,8 +504,7 @@ class OptimizeDatabase
521
  /*******************************************************************************
522
  * START CLEANING / OPTIMIZATION (FROM WP-CRON)
523
  *******************************************************************************/
524
- function odb_start_scheduler()
525
- {
526
  $this->odb_start(true);
527
  } // odb_start_scheduler()
528
 
@@ -530,8 +512,7 @@ class OptimizeDatabase
530
  /*******************************************************************************
531
  * MAIN METHOD FOR CLEANING / OPTIMIZING
532
  *******************************************************************************/
533
- function odb_start($scheduler)
534
- {
535
  // PAGE LOAD TIMER
536
  $time = microtime();
537
  $time = explode(' ', $time);
@@ -539,10 +520,10 @@ class OptimizeDatabase
539
  $this->odb_start_time = $time;
540
 
541
  $action = '';
542
- if(isset($_REQUEST['action']))
543
- { $action = $_REQUEST['action'];
544
- if($action == "delete_log")
545
- { // DELETE LOG FILE
546
  @unlink($this->odb_plugin_path.'logs/rvg-optimize-db-log.html');
547
 
548
  // UPDATED MESSAGE
@@ -554,8 +535,8 @@ class OptimizeDatabase
554
  }
555
  } // if(isset($_REQUEST['action']))
556
 
557
- if(!$scheduler)
558
- { // SHOW PAGE HEADER
559
  $this->odb_displayer_obj->display_header();
560
  // v4.1.9: STARTING: SHOW RUNNING INDICATOR
561
  echo "<script>jQuery('#odb-running').show();</script>";
@@ -563,14 +544,13 @@ class OptimizeDatabase
563
  $this->odb_displayer_obj->display_current_settings();
564
  } // if(!$scheduler)
565
 
566
- if ($action != 'run' && !$scheduler)
567
- { /****************************************************************************************
568
  * START SCREEN (SHOW SETTINGS + BUTTONS)
569
  ****************************************************************************************/
570
  $this->odb_displayer_obj->display_start_buttons($action);
571
- }
572
- else
573
- { /****************************************************************************************
574
  * RUN CLEANING AND OPTIMIZATION
575
  ****************************************************************************************/
576
  $this->odb_displayer_obj->display_start_buttons($action);
1
  <?php
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
+ * @version 4.3
5
  */
6
  /*
7
  Plugin Name: Optimize Database after Deleting Revisions
10
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
11
  Author URI: http://cagewebdev.com
12
  Network: True
13
+ Version: 4.3
14
  */
15
 
16
  /********************************************************************************************
22
  global $odb_class;
23
  $odb_class = new OptimizeDatabase();
24
 
25
+ class OptimizeDatabase {
 
26
  // VERSION
27
+ var $odb_version = '4.3';
28
+ var $odb_release_date = '07/24/2017';
29
 
30
  // PLUGIN OPTIONS
31
  var $odb_rvg_options = array();
71
  /*******************************************************************************
72
  * CONSTRUCTOR
73
  *******************************************************************************/
74
+ function __construct() {
 
75
  // INITIALIZE PLUGIN
76
  add_action('init', array(&$this, 'odb_init'));
77
  } // __construct()
80
  /*******************************************************************************
81
  * INITIALIZE PLUGIN
82
  *******************************************************************************/
83
+ function odb_init() {
 
84
  // LOAD CLASSES
85
  $this->odb_classes();
86
 
121
  /*******************************************************************************
122
  * LOAD AND INITIALIZE CLASSES
123
  *******************************************************************************/
124
+ function odb_classes() {
 
125
  // LOAD CLASSES
126
  include_once('classes/odb-cleaner.php');
127
  include_once('classes/odb-displayer.php');
143
  /*******************************************************************************
144
  * INITIALIZE URLS AND DIRECTORIES
145
  *******************************************************************************/
146
+ function odb_urls_dirs() {
 
147
  $this->odb_plugin_url = plugins_url( '/', __FILE__ );
148
  $this->odb_plugin_path = plugin_dir_path(__FILE__);
149
  $this->odb_logfile_url = $this->odb_plugin_url.'logs/rvg-optimize-db-log.html';
155
  /*******************************************************************************
156
  * LOAD OPTIONS
157
  *******************************************************************************/
158
+ function odb_load_options() {
 
159
  // GET OPTIONS
160
  $this->odb_rvg_options = $this->odb_multisite_obj->odb_ms_get_option('odb_rvg_options');
161
 
213
  /*******************************************************************************
214
  * COPY AND DELETE OPTIONS FROM PREVIOUS VERSIONS (BEFORE 4.0)
215
  *******************************************************************************/
216
+ function odb_convert_options() {
 
217
  global $wpdb;
218
 
219
  // STOP OLD SCHEDULER
220
  wp_clear_scheduled_hook('rvg_optimize_database');
221
 
222
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_total_savings');
223
+ if($setting) {
224
+ $this->odb_rvg_options['total_savings'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_total_savings');
225
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_total_savings');
226
  }
227
 
228
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_pingbacks');
229
+ if($setting) {
230
+ $this->odb_rvg_options['clear_pingbacks'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_pingbacks');
231
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_pingbacks');
232
  }
233
 
234
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_spam');
235
+ if($setting) {
236
+ $this->odb_rvg_options['clear_spam'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_spam');
237
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_spam');
238
  }
239
 
240
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_tags');
241
+ if($setting) {
242
+ $this->odb_rvg_options['clear_tags'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_tags');
243
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_tags');
244
  }
245
 
246
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_transients');
247
+ if($setting) {
248
+ $this->odb_rvg_options['clear_transients'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_clear_transients');
249
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_clear_transients');
250
  }
251
 
256
  }
257
 
258
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminbar');
259
+ if($setting) {
260
+ $this->odb_rvg_options['adminbar'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminbar');
261
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_adminbar');
262
  }
263
 
264
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminmenu');
265
+ if($setting) {
266
+ $this->odb_rvg_options['adminmenu'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_adminmenu');
267
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_adminmenu');
268
  }
269
 
270
  $setting = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_logging_on');
271
+ if($setting) {
272
+ $this->odb_rvg_options['logging_on'] = $this->odb_multisite_obj->odb_ms_get_option('rvg_odb_logging_on');
273
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_logging_on');
274
  }
275
 
289
  $this->odb_multisite_obj->odb_ms_delete_option('rvg_odb_schedulehour');
290
 
291
  // COPY EXCLUDED TABLES
292
+ for($i=0; $i<count($this->odb_ms_prefixes); $i++) {
 
293
  $sql = "
294
  SELECT `option_name`
295
  FROM ".$this->odb_ms_prefixes[$i]."options
297
  ";
298
 
299
  $res = $wpdb->get_results($sql, ARRAY_A);
300
+ for($j=0; $j<count($res); $j++) {
301
+ $option_name = $res[$j]['option_name'];
302
  $option_name_new = substr($option_name, 7);
303
  $this->odb_rvg_excluded_tabs[$option_name_new] = 'Y';
304
  $this->odb_multisite_obj->odb_ms_delete_option($option_name);
305
+ } // for($j=0; $j<count($res); $j++)
306
+ } // for($i=0; $i<count($this->odb_ms_prefixes); $i++)
307
 
308
  // UPDATE EXCLUDED TABLES
309
  $this->odb_multisite_obj->odb_ms_update_option('odb_rvg_excluded_tabs', $this->odb_rvg_excluded_tabs);
313
  /*******************************************************************************
314
  * INITIALIZE WORDPRESS HOOKS
315
  *******************************************************************************/
316
+ function odb_init_hooks() {
 
317
  global $blog_id;
318
 
319
  // ON DE-ACTIVATION
323
  register_uninstall_hook(__FILE__, array('OptimizeDatabase', 'odb_uninstallation_handler'));
324
 
325
  // ADD ENTRY TO ADMIN TOOLS MENU
326
+ if (is_multisite()) {
327
+ if ($blog_id == 1) {
328
+ // v4.1: PLUGIN ONLY CAN BE USED ON THE MAIN SITE (NOT ON THE SUB SITES)
329
  add_action('admin_menu', array(&$this, 'odb_admin_tools'));
330
  add_action('admin_menu', array(&$this, 'odb_admin_settings'));
331
+ } // if ($blog_id == 1)
332
+ } else {
 
 
333
  add_action('admin_menu', array(&$this, 'odb_admin_tools'));
334
  add_action('admin_menu', array(&$this, 'odb_admin_settings'));
335
+ } // if (is_multisite())
336
 
337
  // ICON MODE: ADD ICON TO ADMIN MENU
338
+ if ($this->odb_rvg_options['adminmenu'] == "Y") {
339
+ add_action('admin_menu', array(&$this, 'odb_admin_icon'));
340
  add_action('admin_menu', array(&$this, 'odb_register_options'));
341
  }
342
 
355
  /*******************************************************************************
356
  * ADD ENTRY TO THE ADMIN TOOLS MENU
357
  *******************************************************************************/
358
+ function odb_admin_tools() {
359
+ if (function_exists('add_management_page')) {
360
+ add_management_page(
361
  __('Optimize Database',$this->odb_txt_domain), // page title
362
  __('Optimize Database',$this->odb_txt_domain), // menu title
363
  'manage_options', // capability
370
  /*******************************************************************************
371
  * ADD ENTRY TO THE ADMIN SETTINGS MENU
372
  *******************************************************************************/
373
+ function odb_admin_settings() {
374
+ if (function_exists('add_options_page'))
375
  add_options_page(
376
  __('Optimize Database', $this->odb_txt_domain), // page title
377
  __('Optimize Database', $this->odb_txt_domain), // menu title
385
  /*******************************************************************************
386
  * ADD 'SETTINGS' LINK TO THE MAIN PLUGIN PAGE
387
  *******************************************************************************/
388
+ function odb_settings_link($links) {
389
+ array_unshift($links, '<a href="options-general.php?page=odb_settings_page">'.__('Settings', $this->odb_txt_domain).'</a>');
390
  return $links;
391
  } // odb_settings_link()
392
 
394
  /********************************************************************************************
395
  * ADD THE '1 CLICK OPTIMIZE DATABASE' ITEM TO THE ADMIN BAR (IF ACTIVATED)
396
  ********************************************************************************************/
397
+ function odb_admin_bar() {
398
+ global $wp_admin_bar;
399
 
400
  if (!is_super_admin() || !is_admin_bar_showing()) return;
401
 
411
  /********************************************************************************************
412
  * 'ICON MODE': ADD A LINK TO THE ADMIN MENU
413
  ********************************************************************************************/
414
+ function odb_admin_icon() {
415
+ if (function_exists('add_menu_page')) {
 
 
416
  add_menu_page(
417
  __('Optimize Database', $this->odb_txt_domain), // page title
418
  __('Optimize Database', $this->odb_txt_domain), // menu title
428
  /********************************************************************************************
429
  * 'ICON MODE': REGISTER OPTION PAGE BUT HIDE IT FROM THE ADMIN MENU
430
  ********************************************************************************************/
431
+ function odb_register_options() {
432
+ if (function_exists('add_submenu_page')) {
433
+ add_submenu_page(
 
434
  null, // parent slug (NULL is hide from menu)
435
  __('Optimize Database', $this->odb_txt_domain), // page title
436
  __('Optimize Database', $this->odb_txt_domain), // menu title
445
  /*******************************************************************************
446
  * LOAD TEXT DOMAIN
447
  *******************************************************************************/
448
+ function odb_i18n() {
 
449
  load_plugin_textdomain(
450
  $this->odb_txt_domain, // domain
451
  false, // abs rel path
458
  * ARE WE ON A, FOR THIS PLUGIN, RELEVANT PAGE?
459
  * Since v4.0.3
460
  *******************************************************************************/
461
+ function odb_is_relevant_page() {
 
462
  $this_page = '';
463
  if(isset($_GET['page'])) $this_page = $_GET['page'];
464
  return ($this_page == 'odb_settings_page' || $this_page == 'rvg-optimize-database');
468
  /*******************************************************************************
469
  * PLUGIN DE-ACTIVATION
470
  *******************************************************************************/
471
+ public static function odb_deactivation_handler() {
472
+ // STOP SCHEDULER
473
  wp_clear_scheduled_hook('odb_scheduler');
474
  } // odb_deactivation_handler()
475
 
477
  /*******************************************************************************
478
  * PLUGIN UN-INSTALLATION
479
  *******************************************************************************/
480
+ public static function odb_uninstallation_handler() {
481
+ // STOP SCHEDULER
482
  wp_clear_scheduled_hook('odb_scheduler');
483
  } // odb_uninstallation_handler()
484
 
486
  /*******************************************************************************
487
  * LOAD SETTINGS (OPTIONS) PAGE
488
  *******************************************************************************/
489
+ function odb_settings_page() {
490
+ global $wpdb, $odb_rvg_excluded_tabs, $odb_ms_prefixes;
491
 
492
  include_once(trailingslashit(dirname(__FILE__)).'/includes/settings-page.php');
493
  } // odb_settings_page()
496
  /*******************************************************************************
497
  * START CLEANING / OPTIMIZATION (INITIATED BY THE USER, NOT FROM WP-CRON)
498
  *******************************************************************************/
499
+ function odb_start_manually() {
 
500
  $this->odb_start(false);
501
  } // odb_start_manually()
502
 
504
  /*******************************************************************************
505
  * START CLEANING / OPTIMIZATION (FROM WP-CRON)
506
  *******************************************************************************/
507
+ function odb_start_scheduler() {
 
508
  $this->odb_start(true);
509
  } // odb_start_scheduler()
510
 
512
  /*******************************************************************************
513
  * MAIN METHOD FOR CLEANING / OPTIMIZING
514
  *******************************************************************************/
515
+ function odb_start($scheduler) {
 
516
  // PAGE LOAD TIMER
517
  $time = microtime();
518
  $time = explode(' ', $time);
520
  $this->odb_start_time = $time;
521
 
522
  $action = '';
523
+ if(isset($_REQUEST['action'])) {
524
+ $action = $_REQUEST['action'];
525
+ if($action == "delete_log") {
526
+ // DELETE LOG FILE
527
  @unlink($this->odb_plugin_path.'logs/rvg-optimize-db-log.html');
528
 
529
  // UPDATED MESSAGE
535
  }
536
  } // if(isset($_REQUEST['action']))
537
 
538
+ if(!$scheduler) {
539
+ // SHOW PAGE HEADER
540
  $this->odb_displayer_obj->display_header();
541
  // v4.1.9: STARTING: SHOW RUNNING INDICATOR
542
  echo "<script>jQuery('#odb-running').show();</script>";
544
  $this->odb_displayer_obj->display_current_settings();
545
  } // if(!$scheduler)
546
 
547
+ if ($action != 'run' && !$scheduler) {
548
+ /****************************************************************************************
549
  * START SCREEN (SHOW SETTINGS + BUTTONS)
550
  ****************************************************************************************/
551
  $this->odb_displayer_obj->display_start_buttons($action);
552
+ } else {
553
+ /****************************************************************************************
 
554
  * RUN CLEANING AND OPTIMIZATION
555
  ****************************************************************************************/
556
  $this->odb_displayer_obj->display_start_buttons($action);