Optimize Database after Deleting Revisions - Version 3.3

Version Description

[03/27/2015] = * NEW: MULTISITE support added (second try ;-)) * CHANGE: various minor improvements * BUG FIX: sub-sites are accessible again (in the admin panel)

Download this release

Release Info

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

Code changes from version 3.2.1 to 3.3

css/style.css CHANGED
@@ -37,6 +37,10 @@
37
  .odb-optimizing-table {
38
  margin-top: 16px;
39
  }
 
 
 
 
40
  .odb-underline-red {
41
  text-decoration: underline;
42
  color: #F00;
@@ -53,3 +57,22 @@
53
  font-weight: bold;
54
  color: #21759B;
55
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  .odb-optimizing-table {
38
  margin-top: 16px;
39
  }
40
+ .odb-optimized {
41
+ color: #00F;
42
+ font-weight: bold;
43
+ }
44
  .odb-underline-red {
45
  text-decoration: underline;
46
  color: #F00;
57
  font-weight: bold;
58
  color: #21759B;
59
  }
60
+ .odb-schedule-select {
61
+ font-size: inherit;
62
+ padding: 0px;
63
+ margin: 0px;
64
+ }
65
+ .odb-schedulehour {
66
+ display: none;
67
+ }
68
+ .odb-schedulehour-select {
69
+ font-size: inherit;
70
+ }
71
+ .odb-table-excludes {
72
+ margin-top: 10px;
73
+ border: solid 1px #CCC;
74
+ padding: 10px;
75
+ }
76
+ .odb-table-excludes td {
77
+ padding: 3px;
78
+ }
language/rvg-optimize-database-nl_NL.mo CHANGED
Binary file
language/rvg-optimize-database-nl_NL.po CHANGED
@@ -2,8 +2,8 @@ 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: 2015-03-01 14:55+0100\n"
6
- "PO-Revision-Date: 2015-03-01 14:56+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"
@@ -12,42 +12,42 @@ msgstr ""
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"
18
- "X-Poedit-Basepath: C:/Users/rvgelder.KC15435/Documents/My Dropbox/cagewebdev/"
19
- "wp-content/plugins/rvg-optimize-database\n"
20
  "X-Textdomain-Support: yes\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
 
23
  # @ rvg-optimize-database
24
- #: rvg-optimize-db.php:39 rvg-optimize-db.php:40 rvg-optimize-db.php:59
25
- #: rvg-optimize-db.php:60 rvg-optimize-db.php:80 rvg-optimize-db.php:81
26
- #: rvg-optimize-db.php:100 rvg-optimize-db.php:101
27
  msgid "Optimize Database"
28
  msgstr "Optimaliseer Database"
29
 
30
  # @ optimize_db
31
- #: rvg-optimize-db.php:136
32
  msgid "Optimize DB (1 click)"
33
  msgstr "Optimaliseer DB (1 klik)"
34
 
35
  # @ default
36
- #: rvg-optimize-db.php:165
37
  msgid "Once Weekly"
38
  msgstr "Eenmaal per week"
39
 
40
  # @ default
41
- #: rvg-optimize-db.php:201
42
  msgctxt "timezone date format"
43
  msgid "YmdGis"
44
  msgstr ""
45
 
46
- #: rvg-optimize-db.php:318
47
  msgid "Optimize Database after Deleting Revisions SETTINGS UPDATED"
48
  msgstr "Optimize Database after Deleting Revisions INSTELLINGEN AANGEPAST"
49
 
50
- #: rvg-optimize-db.php:320
51
  msgid ""
52
  "Click <a href=\"tools.php?page=rvg-optimize-db.php\" class=\"odb-bold"
53
  "\">HERE</a> to run the optimization"
@@ -55,119 +55,119 @@ msgstr ""
55
  "Klik <a href=\"tools.php?page=rvg-optimize-db.php\" class=\"odb-bold\">HIER</"
56
  "a. om de optimalisatie te starten"
57
 
58
- #: rvg-optimize-db.php:372
59
  msgid "Using Optimize Database after Deleting Revisions"
60
  msgstr "Het gebruik van Optimize Database after Deleting Revisions"
61
 
62
- #: rvg-optimize-db.php:374
63
  msgid "is an one-click plugin to clean and optimize your WordPress database"
64
  msgstr ""
65
  "is een één-klik plugin om de WordPress database op te schonen en te "
66
  "optimaliseren"
67
 
68
- #: rvg-optimize-db.php:375
69
  msgid "Plugin version:"
70
  msgstr "Plugin versie:"
71
 
72
- #: rvg-optimize-db.php:377
73
  msgid "Author"
74
  msgstr "Auteur"
75
 
76
- #: rvg-optimize-db.php:378 rvg-optimize-db.php:656 rvg-optimize-db.php:1736
77
  msgid "The Netherlands"
78
  msgstr "Nederland"
79
 
80
- #: rvg-optimize-db.php:379
81
  msgid "Plugin URL:"
82
  msgstr "Plugin URL:"
83
 
84
- #: rvg-optimize-db.php:381
85
  msgid "Download URL:"
86
  msgstr "Download URL:"
87
 
88
- #: rvg-optimize-db.php:385
89
  msgid "Optimize Database after Deleting Revisions - Settings"
90
  msgstr "Optimize Database after Deleting Revisions - Instellingen"
91
 
92
- #: rvg-optimize-db.php:403 rvg-optimize-db.php:658
93
  msgid "Maximum number of - most recent - revisions to keep per post / page"
94
  msgstr ""
95
  "Maximaal aantal (meest recente) revisies die bewaard worden per bericht / "
96
  "pagina"
97
 
98
- #: rvg-optimize-db.php:404
99
  msgid "('0' means: delete <u>ALL</u> revisions)"
100
  msgstr "('0' betekent: verwijder <u>ALLE</u> revisies)"
101
 
102
- #: rvg-optimize-db.php:408 rvg-optimize-db.php:659
103
  msgid "Delete all trashed items"
104
  msgstr "Maak de prullenbak leeg"
105
 
106
- #: rvg-optimize-db.php:412 rvg-optimize-db.php:660
107
  msgid "Delete all spammed items"
108
  msgstr "Verwijder alle spam reacties"
109
 
110
- #: rvg-optimize-db.php:416 rvg-optimize-db.php:661
111
  msgid "Delete unused tags"
112
  msgstr "Verwijder ongebruikte tags"
113
 
114
- #: rvg-optimize-db.php:420 rvg-optimize-db.php:662
115
  msgid "Delete expired transients"
116
  msgstr "Verwijder verlopen transiënts"
117
 
118
- #: rvg-optimize-db.php:424 rvg-optimize-db.php:663
119
  msgid "Delete pingbacks and trackbacks"
120
  msgstr "Verwijder pingback en trackbacks"
121
 
122
- #: rvg-optimize-db.php:428 rvg-optimize-db.php:664
123
  msgid "Keep a log"
124
  msgstr "Gebruik een logbestand"
125
 
126
- #: rvg-optimize-db.php:432 rvg-optimize-db.php:666
127
  msgid "Scheduler"
128
  msgstr "Planner"
129
 
130
- #: rvg-optimize-db.php:434 rvg-optimize-db.php:630
131
  msgid "NOT SCHEDULED"
132
  msgstr "NIET GEPLAND"
133
 
134
- #: rvg-optimize-db.php:435
135
  msgid "run optimization HOURLY"
136
  msgstr "voer de optimalisatie ELK UUR uit"
137
 
138
- #: rvg-optimize-db.php:436
139
  msgid "run optimization TWICE A DAY"
140
  msgstr "voer de optimalisatie TWEE KEER PER DAG uit"
141
 
142
- #: rvg-optimize-db.php:437
143
  msgid "run optimization DAILY"
144
  msgstr "voer de optimalisatie DAGELIJKS uit"
145
 
146
- #: rvg-optimize-db.php:438
147
  msgid "run optimization WEEKLY"
148
  msgstr "voer de optimalisatie WEKELIJKS uit"
149
 
150
- #: rvg-optimize-db.php:444
151
  msgid "Time"
152
  msgstr "Tijd"
153
 
154
- #: rvg-optimize-db.php:450
155
  msgid "hrs"
156
  msgstr "uur"
157
 
158
- #: rvg-optimize-db.php:462
159
  msgid "Show '1-click' link in Admin Bar"
160
  msgstr "Toon de '1-klik' link in de Admin Balk"
161
 
162
- #: rvg-optimize-db.php:464 rvg-optimize-db.php:469
163
  msgid "(change will be visible after loading the next page)"
164
  msgstr "(wijziging wordt zichtbaar na het laden van de volgende pagina)"
165
 
166
- #: rvg-optimize-db.php:467
167
  msgid "Show an icon in the Admin Menu"
168
  msgstr "Toon een icon in het Admin Menu"
169
 
170
- #: rvg-optimize-db.php:481
171
  msgid ""
172
  "EXCLUDE DATABASE TABLES FROM OPTIMIZATION: <span class=\"odb-underline-red"
173
  "\">CHECKED</span> TABLES <span class=\"odb-underline-red\">WON'T</span> BE "
@@ -177,322 +177,332 @@ msgstr ""
177
  "underline-red\">AANGEVINKTE</span> TABELLEN ZULLEN <span class=\"odb-"
178
  "underline-red\">NIET</span> GEOPTIMALISEERD WORDEN!</span>"
179
 
180
- #: rvg-optimize-db.php:482
181
  msgid "check all tables"
182
  msgstr "vink alle tabellen aan"
183
 
184
- #: rvg-optimize-db.php:482
185
  msgid "uncheck all tables"
186
  msgstr "vink alle tabellen uit"
187
 
188
- #: rvg-optimize-db.php:482
189
  msgid "check all NON-WordPress tables"
190
  msgstr "vink alle NIET-WordPress tabellen aan"
191
 
192
- #: rvg-optimize-db.php:520
193
  msgid "Save Settings"
194
  msgstr "Bewaar instellingen"
195
 
196
- #: rvg-optimize-db.php:522
197
  msgid "Go To Optimizer"
198
  msgstr "Ga naar Optimalisatie"
199
 
200
  # @ default
201
- #: rvg-optimize-db.php:548
202
  msgctxt "timezone date format"
203
  msgid "G:i"
204
  msgstr ""
205
 
206
- #: rvg-optimize-db.php:573 rvg-optimize-db.php:580 rvg-optimize-db.php:587
207
- #: rvg-optimize-db.php:594 rvg-optimize-db.php:602 rvg-optimize-db.php:609
208
  msgid "NO"
209
  msgstr "NEE"
210
 
211
- #: rvg-optimize-db.php:573 rvg-optimize-db.php:580 rvg-optimize-db.php:587
212
- #: rvg-optimize-db.php:594 rvg-optimize-db.php:602 rvg-optimize-db.php:609
213
  msgid "YES"
214
  msgstr "JA"
215
 
216
- #: rvg-optimize-db.php:618
217
  msgid "ONCE HOURLY"
218
  msgstr "ELK UUR"
219
 
220
- #: rvg-optimize-db.php:620
221
  msgid "TWICE DAILY"
222
  msgstr "TWEEMAAL DAAGS"
223
 
224
- #: rvg-optimize-db.php:622
225
  msgid "ONCE DAILY"
226
  msgstr "DAGELIJKS"
227
 
228
- #: rvg-optimize-db.php:624
229
  msgid "ONCE WEEKLY"
230
  msgstr "WEKELIJKS"
231
 
232
  # @ rvg-optimize-database
233
- #: rvg-optimize-db.php:650
234
  msgid "Optimize your WordPress Database"
235
  msgstr "Optimaliseer uw WordPress Database"
236
 
237
- #: rvg-optimize-db.php:656 rvg-optimize-db.php:1736
238
  msgid "A WordPress Plugin by"
239
  msgstr "Een WordPress Plugin door"
240
 
241
- #: rvg-optimize-db.php:657
242
  msgid "Current settings"
243
  msgstr "Huidige instellingen"
244
 
245
- #: rvg-optimize-db.php:665
246
  msgid "Number of excluded tables"
247
  msgstr "Aantal uitgesloten tabellen"
248
 
249
- #: rvg-optimize-db.php:672
250
  msgid "Next scheduled run"
251
  msgstr "Volgende geplande uitvoering"
252
 
253
- #: rvg-optimize-db.php:679
254
  msgid "Total savings since the first run"
255
  msgstr "Totale besparing sinds de eerste uitvoering"
256
 
257
- #: rvg-optimize-db.php:684
258
  msgid "Change Settings"
259
  msgstr "Wijzig instellingen"
260
 
261
- #: rvg-optimize-db.php:690 rvg-optimize-db.php:1093
262
  msgid "View Log File"
263
  msgstr "Bekijk Logbestand"
264
 
265
- #: rvg-optimize-db.php:692 rvg-optimize-db.php:1095
266
  msgid "Delete Log File"
267
  msgstr "Verwijder Logbestand"
268
 
269
- #: rvg-optimize-db.php:701
270
  msgid "Start Optimization"
271
  msgstr "Start Optimalisatie"
272
 
273
- #: rvg-optimize-db.php:712
274
  msgid "Starting Optimization"
275
  msgstr "Aan het optimaliseren"
276
 
277
  # @ default
278
- #: rvg-optimize-db.php:718
279
  msgctxt "timezone date format"
280
  msgid "m/d/YH:i:s"
281
  msgstr ""
282
 
283
- #: rvg-optimize-db.php:731
284
  msgid "DELETING REVISIONS"
285
  msgstr "REVISIES AAN HET VERWIJDEREN"
286
 
287
- #: rvg-optimize-db.php:735
 
 
 
 
288
  msgid "post / page"
289
  msgstr "bericht / pagina"
290
 
291
- #: rvg-optimize-db.php:736
292
  msgid "revision date"
293
  msgstr "revisiedatum"
294
 
295
- #: rvg-optimize-db.php:737
296
  msgid "revisions deleted"
297
  msgstr "revisies verwijderd"
298
 
299
- #: rvg-optimize-db.php:744
300
  msgid "total number of revisions deleted"
301
  msgstr "totaal aantal verwijderde revisies"
302
 
303
- #: rvg-optimize-db.php:755
304
  msgid "No REVISIONS found to delete"
305
  msgstr "Geen REVISIES gevonden om te verwijderen"
306
 
307
- #: rvg-optimize-db.php:781
308
  msgid "DELETING TRASHED ITEMS"
309
  msgstr "PRULLENBAK AAN HET LEEGMAKEN"
310
 
311
- #: rvg-optimize-db.php:785
312
  msgid "type"
313
  msgstr "type"
314
 
315
- #: rvg-optimize-db.php:786
316
  msgid "IP address / title"
317
  msgstr "IP adres / titel"
318
 
319
- #: rvg-optimize-db.php:787
320
  msgid "date"
321
  msgstr "datum"
322
 
323
- #: rvg-optimize-db.php:802
324
  msgid "No TRASHED ITEMS found to delete"
325
  msgstr "Geen PRULLENBAK ITEMS gevonden om te verwijderen"
326
 
327
- #: rvg-optimize-db.php:830
328
  msgid "DELETING SPAMMED ITEMS"
329
  msgstr "SPAM ITEMS AAN HET VERWIJDEREN"
330
 
331
- #: rvg-optimize-db.php:834
332
  msgid "comment author"
333
  msgstr "plaatser van de reactie"
334
 
335
- #: rvg-optimize-db.php:835
336
  msgid "comment author email"
337
  msgstr "email van de plaatser van de reactie"
338
 
339
- #: rvg-optimize-db.php:836
340
  msgid "comment date"
341
  msgstr "datum van de reactie"
342
 
343
- #: rvg-optimize-db.php:851
344
  msgid "No SPAMMED ITEMS found to delete"
345
  msgstr "Geen SPAM gevonden om te verwijderen"
346
 
347
- #: rvg-optimize-db.php:878
348
  msgid "NUMBER OF UNUSED TAGS DELETED"
349
  msgstr "AANTAL VERWIJDERDE ONGEBRUIKTE TAGS"
350
 
351
- #: rvg-optimize-db.php:889
352
  msgid "No UNUSED TAGS found to delete"
353
  msgstr "Geen ONGEBRUIKTE TAGS gevonden om te verwijderen"
354
 
355
- #: rvg-optimize-db.php:916
356
  msgid "NUMBER OF EXPIRED TRANSIENTS DELETED"
357
  msgstr "AANTAL VERWIJDERDE VERLOPEN TRANSIËNTS"
358
 
359
- #: rvg-optimize-db.php:927
360
  msgid "No EXPIRED TRANSIENTS found to delete"
361
  msgstr "Geen VERLOPEN TRANSIËNTS gevonden om te verwijderen"
362
 
363
- #: rvg-optimize-db.php:954
364
  msgid "NUMBER OF PINGBACKS AND TRACKBACKS DELETED"
365
  msgstr "AANTAL VERWIJDERDE PINGBACKS EN TRACKBACKS"
366
 
367
- #: rvg-optimize-db.php:965
368
  msgid "No PINGBACKS nor TRACKBACKS found to delete"
369
  msgstr "Geen PINGBACKS en TRACKBACKS gevonden om te verwijderen"
370
 
371
- #: rvg-optimize-db.php:989
372
  msgid "NUMBER OF POSTMETA ORPHANS DELETED"
373
  msgstr "AANTAL VERWIJDERDE POSTMETA WEZEN"
374
 
375
- #: rvg-optimize-db.php:1000
376
  msgid "No POSTMETA ORPHANS found to delete"
377
  msgstr "Geen POSTMETA WEZEN gevonden om te verwijderen"
378
 
379
- #: rvg-optimize-db.php:1018
380
  msgid "OPTIMIZING DATABASE TABLES"
381
  msgstr "DATABASETABELLEN AAN HET OPTIMALISEREN"
382
 
383
- #: rvg-optimize-db.php:1022
384
  msgid "table name"
385
  msgstr "tabelnaam"
386
 
387
- #: rvg-optimize-db.php:1023
388
  msgid "optimization result"
389
  msgstr "resultaat optimalisatie"
390
 
391
- #: rvg-optimize-db.php:1024
392
  msgid "engine"
393
  msgstr "engine"
394
 
395
- #: rvg-optimize-db.php:1025
396
  msgid "table rows"
397
  msgstr "tabelrijen"
398
 
399
- #: rvg-optimize-db.php:1026
400
  msgid "table size"
401
  msgstr "tabelgrootte"
402
 
403
- #: rvg-optimize-db.php:1051 rvg-optimize-db.php:1751
404
  msgid "SAVINGS"
405
  msgstr "BESPARINGEN"
406
 
407
- #: rvg-optimize-db.php:1055
408
  msgid "size of the database"
409
  msgstr "grootte van de database"
410
 
411
- #: rvg-optimize-db.php:1058
412
  msgid "BEFORE optimization"
413
  msgstr "VOOR de optimalisatie"
414
 
415
- #: rvg-optimize-db.php:1062
416
  msgid "AFTER optimization"
417
  msgstr "NA de optimalisatie"
418
 
419
- #: rvg-optimize-db.php:1066
420
  msgid "SAVINGS THIS TIME"
421
  msgstr "DIT KEER BESPAARD"
422
 
423
- #: rvg-optimize-db.php:1070
424
  msgid "TOTAL SAVINGS SINCE THE FIRST RUN"
425
  msgstr "TOTALE BESPARING SINDS DE EERSTE UITVOERING"
426
 
427
- #: rvg-optimize-db.php:1083
428
  msgid "DONE"
429
  msgstr "KLAAR"
430
 
431
- #: rvg-optimize-db.php:1085
432
  msgid "Optimization took"
433
  msgstr "Optimalizatie duurde"
434
 
435
- #: rvg-optimize-db.php:1085
436
  msgid "seconds"
437
  msgstr "seconden"
438
 
439
- #: rvg-optimize-db.php:1654
440
  msgid "InnoDB table: skipped..."
441
  msgstr "InnoDB tabel overgeslagen..."
442
 
443
- #: rvg-optimize-db.php:1660
444
- msgid "TABLE OPTIMIZED"
445
- msgstr "TABEL GEOPTIMALISEERD"
446
 
447
- #: rvg-optimize-db.php:1661
448
  msgid "Table is already up to date"
449
  msgstr "Tabel is al optimaal"
450
 
451
- #: rvg-optimize-db.php:1740
452
  msgid "time"
453
  msgstr "tijd"
454
 
455
- #: rvg-optimize-db.php:1741
456
  msgid "deleted<br />revisions"
457
  msgstr "verw.<br />revisies"
458
 
459
- #: rvg-optimize-db.php:1742
460
  msgid "deleted<br />trash"
461
  msgstr "verw.<br />prullenbak items"
462
 
463
- #: rvg-optimize-db.php:1743
464
  msgid "deleted<br />spam"
465
  msgstr "verw.<br />spamitems"
466
 
467
- #: rvg-optimize-db.php:1744
468
  msgid "deleted<br />tags"
469
  msgstr "verw.<br /> tags"
470
 
471
- #: rvg-optimize-db.php:1745
472
  msgid "deleted<br />transients"
473
  msgstr "verw.<br />transiënts"
474
 
475
- #: rvg-optimize-db.php:1746
476
  msgid "deleted<br />pingbacks<br />trackbacks"
477
  msgstr "verwijderde<br />pingbacks<br />trackbacks"
478
 
479
- #: rvg-optimize-db.php:1747
480
  msgid "deleted<br />orphans"
481
  msgstr "verw.<br />wezen"
482
 
483
  # @ rvg-optimize-database
484
- #: rvg-optimize-db.php:1748
485
  msgid "nr of optimized tables"
486
  msgstr "aantal geoptima-<br />liseerde tabellen"
487
 
488
- #: rvg-optimize-db.php:1749
489
  msgid "database size BEFORE"
490
  msgstr "database<br />grootte<br />VOOR"
491
 
492
- #: rvg-optimize-db.php:1750
493
  msgid "database size AFTER"
494
  msgstr "database<br />grootte<br />NA"
495
 
 
 
 
 
 
 
496
  #~ msgid "TABLE OPTIMIZED!"
497
  #~ msgstr "TABEL GEOPTIMALISEERD!"
498
 
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: 2015-03-20 15:00+0100\n"
6
+ "PO-Revision-Date: 2015-03-20 15:00+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"
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"
18
+ "X-Poedit-Basepath: C:\\Rolf\\wpmulti\\wp-content\\plugins\\rvg-optimize-"
19
+ "database\n"
20
  "X-Textdomain-Support: yes\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
 
23
  # @ rvg-optimize-database
24
+ #: rvg-optimize-db.php:46 rvg-optimize-db.php:47 rvg-optimize-db.php:68
25
+ #: rvg-optimize-db.php:69 rvg-optimize-db.php:91 rvg-optimize-db.php:92
26
+ #: rvg-optimize-db.php:111 rvg-optimize-db.php:112
27
  msgid "Optimize Database"
28
  msgstr "Optimaliseer Database"
29
 
30
  # @ optimize_db
31
+ #: rvg-optimize-db.php:150
32
  msgid "Optimize DB (1 click)"
33
  msgstr "Optimaliseer DB (1 klik)"
34
 
35
  # @ default
36
+ #: rvg-optimize-db.php:179
37
  msgid "Once Weekly"
38
  msgstr "Eenmaal per week"
39
 
40
  # @ default
41
+ #: rvg-optimize-db.php:309
42
  msgctxt "timezone date format"
43
  msgid "YmdGis"
44
  msgstr ""
45
 
46
+ #: rvg-optimize-db.php:426
47
  msgid "Optimize Database after Deleting Revisions SETTINGS UPDATED"
48
  msgstr "Optimize Database after Deleting Revisions INSTELLINGEN AANGEPAST"
49
 
50
+ #: rvg-optimize-db.php:428
51
  msgid ""
52
  "Click <a href=\"tools.php?page=rvg-optimize-db.php\" class=\"odb-bold"
53
  "\">HERE</a> to run the optimization"
55
  "Klik <a href=\"tools.php?page=rvg-optimize-db.php\" class=\"odb-bold\">HIER</"
56
  "a. om de optimalisatie te starten"
57
 
58
+ #: rvg-optimize-db.php:482
59
  msgid "Using Optimize Database after Deleting Revisions"
60
  msgstr "Het gebruik van Optimize Database after Deleting Revisions"
61
 
62
+ #: rvg-optimize-db.php:486
63
  msgid "is an one-click plugin to clean and optimize your WordPress database"
64
  msgstr ""
65
  "is een één-klik plugin om de WordPress database op te schonen en te "
66
  "optimaliseren"
67
 
68
+ #: rvg-optimize-db.php:489
69
  msgid "Plugin version:"
70
  msgstr "Plugin versie:"
71
 
72
+ #: rvg-optimize-db.php:493
73
  msgid "Author"
74
  msgstr "Auteur"
75
 
76
+ #: rvg-optimize-db.php:496 rvg-optimize-db.php:830 rvg-optimize-db.php:2025
77
  msgid "The Netherlands"
78
  msgstr "Nederland"
79
 
80
+ #: rvg-optimize-db.php:499
81
  msgid "Plugin URL:"
82
  msgstr "Plugin URL:"
83
 
84
+ #: rvg-optimize-db.php:503
85
  msgid "Download URL:"
86
  msgstr "Download URL:"
87
 
88
+ #: rvg-optimize-db.php:509
89
  msgid "Optimize Database after Deleting Revisions - Settings"
90
  msgstr "Optimize Database after Deleting Revisions - Instellingen"
91
 
92
+ #: rvg-optimize-db.php:529 rvg-optimize-db.php:836
93
  msgid "Maximum number of - most recent - revisions to keep per post / page"
94
  msgstr ""
95
  "Maximaal aantal (meest recente) revisies die bewaard worden per bericht / "
96
  "pagina"
97
 
98
+ #: rvg-optimize-db.php:531
99
  msgid "('0' means: delete <u>ALL</u> revisions)"
100
  msgstr "('0' betekent: verwijder <u>ALLE</u> revisies)"
101
 
102
+ #: rvg-optimize-db.php:537 rvg-optimize-db.php:839
103
  msgid "Delete all trashed items"
104
  msgstr "Maak de prullenbak leeg"
105
 
106
+ #: rvg-optimize-db.php:543 rvg-optimize-db.php:842
107
  msgid "Delete all spammed items"
108
  msgstr "Verwijder alle spam reacties"
109
 
110
+ #: rvg-optimize-db.php:549 rvg-optimize-db.php:845
111
  msgid "Delete unused tags"
112
  msgstr "Verwijder ongebruikte tags"
113
 
114
+ #: rvg-optimize-db.php:555 rvg-optimize-db.php:848
115
  msgid "Delete expired transients"
116
  msgstr "Verwijder verlopen transiënts"
117
 
118
+ #: rvg-optimize-db.php:561 rvg-optimize-db.php:851
119
  msgid "Delete pingbacks and trackbacks"
120
  msgstr "Verwijder pingback en trackbacks"
121
 
122
+ #: rvg-optimize-db.php:567 rvg-optimize-db.php:854
123
  msgid "Keep a log"
124
  msgstr "Gebruik een logbestand"
125
 
126
+ #: rvg-optimize-db.php:573 rvg-optimize-db.php:860
127
  msgid "Scheduler"
128
  msgstr "Planner"
129
 
130
+ #: rvg-optimize-db.php:577 rvg-optimize-db.php:799
131
  msgid "NOT SCHEDULED"
132
  msgstr "NIET GEPLAND"
133
 
134
+ #: rvg-optimize-db.php:580
135
  msgid "run optimization HOURLY"
136
  msgstr "voer de optimalisatie ELK UUR uit"
137
 
138
+ #: rvg-optimize-db.php:583
139
  msgid "run optimization TWICE A DAY"
140
  msgstr "voer de optimalisatie TWEE KEER PER DAG uit"
141
 
142
+ #: rvg-optimize-db.php:586
143
  msgid "run optimization DAILY"
144
  msgstr "voer de optimalisatie DAGELIJKS uit"
145
 
146
+ #: rvg-optimize-db.php:589
147
  msgid "run optimization WEEKLY"
148
  msgstr "voer de optimalisatie WEKELIJKS uit"
149
 
150
+ #: rvg-optimize-db.php:597
151
  msgid "Time"
152
  msgstr "Tijd"
153
 
154
+ #: rvg-optimize-db.php:604
155
  msgid "hrs"
156
  msgstr "uur"
157
 
158
+ #: rvg-optimize-db.php:617
159
  msgid "Show '1-click' link in Admin Bar"
160
  msgstr "Toon de '1-klik' link in de Admin Balk"
161
 
162
+ #: rvg-optimize-db.php:620 rvg-optimize-db.php:627
163
  msgid "(change will be visible after loading the next page)"
164
  msgstr "(wijziging wordt zichtbaar na het laden van de volgende pagina)"
165
 
166
+ #: rvg-optimize-db.php:624
167
  msgid "Show an icon in the Admin Menu"
168
  msgstr "Toon een icon in het Admin Menu"
169
 
170
+ #: rvg-optimize-db.php:640
171
  msgid ""
172
  "EXCLUDE DATABASE TABLES FROM OPTIMIZATION: <span class=\"odb-underline-red"
173
  "\">CHECKED</span> TABLES <span class=\"odb-underline-red\">WON'T</span> BE "
177
  "underline-red\">AANGEVINKTE</span> TABELLEN ZULLEN <span class=\"odb-"
178
  "underline-red\">NIET</span> GEOPTIMALISEERD WORDEN!</span>"
179
 
180
+ #: rvg-optimize-db.php:643
181
  msgid "check all tables"
182
  msgstr "vink alle tabellen aan"
183
 
184
+ #: rvg-optimize-db.php:645
185
  msgid "uncheck all tables"
186
  msgstr "vink alle tabellen uit"
187
 
188
+ #: rvg-optimize-db.php:647
189
  msgid "check all NON-WordPress tables"
190
  msgstr "vink alle NIET-WordPress tabellen aan"
191
 
192
+ #: rvg-optimize-db.php:686
193
  msgid "Save Settings"
194
  msgstr "Bewaar instellingen"
195
 
196
+ #: rvg-optimize-db.php:688
197
  msgid "Go To Optimizer"
198
  msgstr "Ga naar Optimalisatie"
199
 
200
  # @ default
201
+ #: rvg-optimize-db.php:717
202
  msgctxt "timezone date format"
203
  msgid "G:i"
204
  msgstr ""
205
 
206
+ #: rvg-optimize-db.php:742 rvg-optimize-db.php:749 rvg-optimize-db.php:756
207
+ #: rvg-optimize-db.php:763 rvg-optimize-db.php:771 rvg-optimize-db.php:778
208
  msgid "NO"
209
  msgstr "NEE"
210
 
211
+ #: rvg-optimize-db.php:742 rvg-optimize-db.php:749 rvg-optimize-db.php:756
212
+ #: rvg-optimize-db.php:763 rvg-optimize-db.php:771 rvg-optimize-db.php:778
213
  msgid "YES"
214
  msgstr "JA"
215
 
216
+ #: rvg-optimize-db.php:787
217
  msgid "ONCE HOURLY"
218
  msgstr "ELK UUR"
219
 
220
+ #: rvg-optimize-db.php:789
221
  msgid "TWICE DAILY"
222
  msgstr "TWEEMAAL DAAGS"
223
 
224
+ #: rvg-optimize-db.php:791
225
  msgid "ONCE DAILY"
226
  msgstr "DAGELIJKS"
227
 
228
+ #: rvg-optimize-db.php:793
229
  msgid "ONCE WEEKLY"
230
  msgstr "WEKELIJKS"
231
 
232
  # @ rvg-optimize-database
233
+ #: rvg-optimize-db.php:820
234
  msgid "Optimize your WordPress Database"
235
  msgstr "Optimaliseer uw WordPress Database"
236
 
237
+ #: rvg-optimize-db.php:828 rvg-optimize-db.php:2025
238
  msgid "A WordPress Plugin by"
239
  msgstr "Een WordPress Plugin door"
240
 
241
+ #: rvg-optimize-db.php:833
242
  msgid "Current settings"
243
  msgstr "Huidige instellingen"
244
 
245
+ #: rvg-optimize-db.php:857
246
  msgid "Number of excluded tables"
247
  msgstr "Aantal uitgesloten tabellen"
248
 
249
+ #: rvg-optimize-db.php:868
250
  msgid "Next scheduled run"
251
  msgstr "Volgende geplande uitvoering"
252
 
253
+ #: rvg-optimize-db.php:877
254
  msgid "Total savings since the first run"
255
  msgstr "Totale besparing sinds de eerste uitvoering"
256
 
257
+ #: rvg-optimize-db.php:883
258
  msgid "Change Settings"
259
  msgstr "Wijzig instellingen"
260
 
261
+ #: rvg-optimize-db.php:889 rvg-optimize-db.php:1328
262
  msgid "View Log File"
263
  msgstr "Bekijk Logbestand"
264
 
265
+ #: rvg-optimize-db.php:891 rvg-optimize-db.php:1330
266
  msgid "Delete Log File"
267
  msgstr "Verwijder Logbestand"
268
 
269
+ #: rvg-optimize-db.php:900
270
  msgid "Start Optimization"
271
  msgstr "Start Optimalisatie"
272
 
273
+ #: rvg-optimize-db.php:912
274
  msgid "Starting Optimization"
275
  msgstr "Aan het optimaliseren"
276
 
277
  # @ default
278
+ #: rvg-optimize-db.php:919
279
  msgctxt "timezone date format"
280
  msgid "m/d/YH:i:s"
281
  msgstr ""
282
 
283
+ #: rvg-optimize-db.php:932
284
  msgid "DELETING REVISIONS"
285
  msgstr "REVISIES AAN HET VERWIJDEREN"
286
 
287
+ #: rvg-optimize-db.php:937 rvg-optimize-db.php:991 rvg-optimize-db.php:1043
288
+ msgid "prefix"
289
+ msgstr "prefix"
290
+
291
+ #: rvg-optimize-db.php:938
292
  msgid "post / page"
293
  msgstr "bericht / pagina"
294
 
295
+ #: rvg-optimize-db.php:939
296
  msgid "revision date"
297
  msgstr "revisiedatum"
298
 
299
+ #: rvg-optimize-db.php:940
300
  msgid "revisions deleted"
301
  msgstr "revisies verwijderd"
302
 
303
+ #: rvg-optimize-db.php:947
304
  msgid "total number of revisions deleted"
305
  msgstr "totaal aantal verwijderde revisies"
306
 
307
+ #: rvg-optimize-db.php:958
308
  msgid "No REVISIONS found to delete"
309
  msgstr "Geen REVISIES gevonden om te verwijderen"
310
 
311
+ #: rvg-optimize-db.php:986
312
  msgid "DELETING TRASHED ITEMS"
313
  msgstr "PRULLENBAK AAN HET LEEGMAKEN"
314
 
315
+ #: rvg-optimize-db.php:992
316
  msgid "type"
317
  msgstr "type"
318
 
319
+ #: rvg-optimize-db.php:993
320
  msgid "IP address / title"
321
  msgstr "IP adres / titel"
322
 
323
+ #: rvg-optimize-db.php:994
324
  msgid "date"
325
  msgstr "datum"
326
 
327
+ #: rvg-optimize-db.php:1009
328
  msgid "No TRASHED ITEMS found to delete"
329
  msgstr "Geen PRULLENBAK ITEMS gevonden om te verwijderen"
330
 
331
+ #: rvg-optimize-db.php:1038
332
  msgid "DELETING SPAMMED ITEMS"
333
  msgstr "SPAM ITEMS AAN HET VERWIJDEREN"
334
 
335
+ #: rvg-optimize-db.php:1044
336
  msgid "comment author"
337
  msgstr "plaatser van de reactie"
338
 
339
+ #: rvg-optimize-db.php:1045
340
  msgid "comment author email"
341
  msgstr "email van de plaatser van de reactie"
342
 
343
+ #: rvg-optimize-db.php:1046
344
  msgid "comment date"
345
  msgstr "datum van de reactie"
346
 
347
+ #: rvg-optimize-db.php:1061
348
  msgid "No SPAMMED ITEMS found to delete"
349
  msgstr "Geen SPAM gevonden om te verwijderen"
350
 
351
+ #: rvg-optimize-db.php:1091
352
  msgid "NUMBER OF UNUSED TAGS DELETED"
353
  msgstr "AANTAL VERWIJDERDE ONGEBRUIKTE TAGS"
354
 
355
+ #: rvg-optimize-db.php:1103
356
  msgid "No UNUSED TAGS found to delete"
357
  msgstr "Geen ONGEBRUIKTE TAGS gevonden om te verwijderen"
358
 
359
+ #: rvg-optimize-db.php:1133
360
  msgid "NUMBER OF EXPIRED TRANSIENTS DELETED"
361
  msgstr "AANTAL VERWIJDERDE VERLOPEN TRANSIËNTS"
362
 
363
+ #: rvg-optimize-db.php:1145
364
  msgid "No EXPIRED TRANSIENTS found to delete"
365
  msgstr "Geen VERLOPEN TRANSIËNTS gevonden om te verwijderen"
366
 
367
+ #: rvg-optimize-db.php:1174
368
  msgid "NUMBER OF PINGBACKS AND TRACKBACKS DELETED"
369
  msgstr "AANTAL VERWIJDERDE PINGBACKS EN TRACKBACKS"
370
 
371
+ #: rvg-optimize-db.php:1186
372
  msgid "No PINGBACKS nor TRACKBACKS found to delete"
373
  msgstr "Geen PINGBACKS en TRACKBACKS gevonden om te verwijderen"
374
 
375
+ #: rvg-optimize-db.php:1212
376
  msgid "NUMBER OF POSTMETA ORPHANS DELETED"
377
  msgstr "AANTAL VERWIJDERDE POSTMETA WEZEN"
378
 
379
+ #: rvg-optimize-db.php:1224
380
  msgid "No POSTMETA ORPHANS found to delete"
381
  msgstr "Geen POSTMETA WEZEN gevonden om te verwijderen"
382
 
383
+ #: rvg-optimize-db.php:1243
384
  msgid "OPTIMIZING DATABASE TABLES"
385
  msgstr "DATABASETABELLEN AAN HET OPTIMALISEREN"
386
 
387
+ #: rvg-optimize-db.php:1248
388
  msgid "table name"
389
  msgstr "tabelnaam"
390
 
391
+ #: rvg-optimize-db.php:1249
392
  msgid "optimization result"
393
  msgstr "resultaat optimalisatie"
394
 
395
+ #: rvg-optimize-db.php:1250
396
  msgid "engine"
397
  msgstr "engine"
398
 
399
+ #: rvg-optimize-db.php:1251
400
  msgid "table rows"
401
  msgstr "tabelrijen"
402
 
403
+ #: rvg-optimize-db.php:1252
404
  msgid "table size"
405
  msgstr "tabelgrootte"
406
 
407
+ #: rvg-optimize-db.php:1278 rvg-optimize-db.php:2040
408
  msgid "SAVINGS"
409
  msgstr "BESPARINGEN"
410
 
411
+ #: rvg-optimize-db.php:1283
412
  msgid "size of the database"
413
  msgstr "grootte van de database"
414
 
415
+ #: rvg-optimize-db.php:1286
416
  msgid "BEFORE optimization"
417
  msgstr "VOOR de optimalisatie"
418
 
419
+ #: rvg-optimize-db.php:1290
420
  msgid "AFTER optimization"
421
  msgstr "NA de optimalisatie"
422
 
423
+ #: rvg-optimize-db.php:1294
424
  msgid "SAVINGS THIS TIME"
425
  msgstr "DIT KEER BESPAARD"
426
 
427
+ #: rvg-optimize-db.php:1298
428
  msgid "TOTAL SAVINGS SINCE THE FIRST RUN"
429
  msgstr "TOTALE BESPARING SINDS DE EERSTE UITVOERING"
430
 
431
+ #: rvg-optimize-db.php:1313
432
  msgid "DONE"
433
  msgstr "KLAAR"
434
 
435
+ #: rvg-optimize-db.php:1317
436
  msgid "Optimization took"
437
  msgstr "Optimalizatie duurde"
438
 
439
+ #: rvg-optimize-db.php:1319
440
  msgid "seconds"
441
  msgstr "seconden"
442
 
443
+ #: rvg-optimize-db.php:1943
444
  msgid "InnoDB table: skipped..."
445
  msgstr "InnoDB tabel overgeslagen..."
446
 
447
+ #: rvg-optimize-db.php:1949
448
+ msgid "<span class=\"odb-optimized\">TABLE OPTIMIZED</span>"
449
+ msgstr "<span class=\"odb-optimized\">TABEL GEOPTIMALISEERD</span>"
450
 
451
+ #: rvg-optimize-db.php:1950
452
  msgid "Table is already up to date"
453
  msgstr "Tabel is al optimaal"
454
 
455
+ #: rvg-optimize-db.php:2029
456
  msgid "time"
457
  msgstr "tijd"
458
 
459
+ #: rvg-optimize-db.php:2030
460
  msgid "deleted<br />revisions"
461
  msgstr "verw.<br />revisies"
462
 
463
+ #: rvg-optimize-db.php:2031
464
  msgid "deleted<br />trash"
465
  msgstr "verw.<br />prullenbak items"
466
 
467
+ #: rvg-optimize-db.php:2032
468
  msgid "deleted<br />spam"
469
  msgstr "verw.<br />spamitems"
470
 
471
+ #: rvg-optimize-db.php:2033
472
  msgid "deleted<br />tags"
473
  msgstr "verw.<br /> tags"
474
 
475
+ #: rvg-optimize-db.php:2034
476
  msgid "deleted<br />transients"
477
  msgstr "verw.<br />transiënts"
478
 
479
+ #: rvg-optimize-db.php:2035
480
  msgid "deleted<br />pingbacks<br />trackbacks"
481
  msgstr "verwijderde<br />pingbacks<br />trackbacks"
482
 
483
+ #: rvg-optimize-db.php:2036
484
  msgid "deleted<br />orphans"
485
  msgstr "verw.<br />wezen"
486
 
487
  # @ rvg-optimize-database
488
+ #: rvg-optimize-db.php:2037
489
  msgid "nr of optimized tables"
490
  msgstr "aantal geoptima-<br />liseerde tabellen"
491
 
492
+ #: rvg-optimize-db.php:2038
493
  msgid "database size BEFORE"
494
  msgstr "database<br />grootte<br />VOOR"
495
 
496
+ #: rvg-optimize-db.php:2039
497
  msgid "database size AFTER"
498
  msgstr "database<br />grootte<br />NA"
499
 
500
+ #~ msgid "<strong>TABLE OPTIMIZED</strong>"
501
+ #~ msgstr "<strong>TABEL GEOPTIMALISEERD</strong>"
502
+
503
+ #~ msgid "TABLE OPTIMIZED"
504
+ #~ msgstr "TABEL GEOPTIMALISEERD"
505
+
506
  #~ msgid "TABLE OPTIMIZED!"
507
  #~ msgstr "TABEL GEOPTIMALISEERD!"
508
 
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.1.1
11
- Stable tag: 3.2.1
12
- Version: 3.2.1
13
  License: GPLv2 or later
14
 
15
  == Description ==
@@ -29,6 +29,7 @@ This plugin is a 'One Click' WordPress Database Cleaner / Optimizer.
29
  * Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
30
  * 'Optimize DB (1 click)' link in the admin bar (optional)
31
  * 'Optimize Database' Icon in the admin menu (optional)
 
32
 
33
  = Settings =
34
  You can find the settings page in the WP Admin Panel &raquo; Optimize Database -or- via the WP Admin Panel &raquo; Optimize Database icon (depends on settings)
@@ -38,6 +39,12 @@ You can start the Optimization in the WP Admin Panel &raquo; Optimize Database.<
38
  Note: if you use the Scheduler the Optimization will run automatically!<br />
39
  Note: you also can click the 'Optimize DB (1 click)' link in the admin bar (if enabled)
40
 
 
 
 
 
 
 
41
  = Supported languages =
42
  * English [en_US] - translated by Rolf van Gelder, CAGE Web Design - http://cagewebdev.com
43
  * Dutch [nl_NL] - translated by Rolf van Gelder, CAGE Web Design - http://cagewebdev.com
@@ -62,11 +69,23 @@ http://cagewebdev.com/index.php/wordpress-plugins/
62
 
63
  == Installation ==
64
 
 
65
  * Upload the Plugin to the `/wp-content/plugins/` directory
66
  * Activate the plugin in the WP Admin Panel &raquo; Plugins
67
  * Change the settings (if needed) in the WP Admin Panel &raquo; Settings &raquo; Optimize Database -or- via the WP Admin Panel &raquo; Optimize Database icon (depends on settings)
68
 
 
 
 
 
 
 
69
  == Changelog ==
 
 
 
 
 
70
  = 3.2.1 [03/18/2015] =
71
  * CHANGE: due to problems, I removed the MULTISITE support again for now... Sorry about that!
72
 
8
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
9
  Requires at least: 2.8
10
  Tested up to: 4.1.1
11
+ Stable tag: 3.3
12
+ Version: 3.3
13
  License: GPLv2 or later
14
 
15
  == Description ==
29
  * Optimization can be scheduled to automatically run once hourly, twice daily, once daily or once weekly at a specific time (optional)
30
  * 'Optimize DB (1 click)' link in the admin bar (optional)
31
  * 'Optimize Database' Icon in the admin menu (optional)
32
+ * MULTISITE compatible: optimizes all sites in the network with one click
33
 
34
  = Settings =
35
  You can find the settings page in the WP Admin Panel &raquo; Optimize Database -or- via the WP Admin Panel &raquo; Optimize Database icon (depends on settings)
39
  Note: if you use the Scheduler the Optimization will run automatically!<br />
40
  Note: you also can click the 'Optimize DB (1 click)' link in the admin bar (if enabled)
41
 
42
+ = Multisite Support =
43
+ * Install the plugin as Network Administrator (Network Admin &raquo; Plugins)
44
+ * 'Network Activate' the plugin
45
+ * The settings are the same for ALL sites in the network, so if you change a setting for one site, it will be used for all other sites.
46
+ * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
47
+
48
  = Supported languages =
49
  * English [en_US] - translated by Rolf van Gelder, CAGE Web Design - http://cagewebdev.com
50
  * Dutch [nl_NL] - translated by Rolf van Gelder, CAGE Web Design - http://cagewebdev.com
69
 
70
  == Installation ==
71
 
72
+ = Single site =
73
  * Upload the Plugin to the `/wp-content/plugins/` directory
74
  * Activate the plugin in the WP Admin Panel &raquo; Plugins
75
  * Change the settings (if needed) in the WP Admin Panel &raquo; Settings &raquo; Optimize Database -or- via the WP Admin Panel &raquo; Optimize Database icon (depends on settings)
76
 
77
+ = Multisite =
78
+ * Install the plugin as Network Administrator (Network Admin &raquo; Plugins)
79
+ * 'Network Activate' the plugin
80
+ * The settings are the same for ALL sites in the network, so if you change a setting for one site, it will be used for all other sites.
81
+ * If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
82
+
83
  == Changelog ==
84
+ = 3.3 [03/27/2015] =
85
+ * NEW: MULTISITE support added (second try ;-))
86
+ * CHANGE: various minor improvements
87
+ * BUG FIX: sub-sites are accessible again (in the admin panel)
88
+
89
  = 3.2.1 [03/18/2015] =
90
  * CHANGE: due to problems, I removed the MULTISITE support again for now... Sorry about that!
91
 
rvg-optimize-db.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
- $odb_version = '3.2.1';
3
- $odb_release_date = '03/18/2015';
4
  /**
5
  * @package Optimize Database after Deleting Revisions
6
- * @version 3.2.1
7
  */
8
  /*
9
  Plugin Name: Optimize Database after Deleting Revisions
@@ -11,12 +9,21 @@ Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-rev
11
  Description: Optimizes the Wordpress Database after Cleaning it out
12
  Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
13
  Author URI: http://cagewebdev.com
14
- Version: 3.2.1
15
  */
16
 
 
 
 
 
 
 
 
17
  /********************************************************************************************
18
 
19
  ADD THE LANGUAGE SUPPORT (LOCALIZATION)
 
 
20
 
21
  *********************************************************************************************/
22
  function rvg_odb_action_init()
@@ -43,12 +50,14 @@ function optimize_db_main()
43
  'rvg_optimize_db');
44
  }
45
  }
46
- if(get_option('rvg_odb_adminmenu') != "Y") add_action('admin_menu', 'optimize_db_main');
47
 
48
 
49
  /********************************************************************************************
50
 
51
- 'ICON MODE': ADD A LINK TO THE ADMIN MENU (v3.1.3)
 
 
52
 
53
  *********************************************************************************************/
54
  function rvg_add_menu_page()
@@ -64,8 +73,8 @@ function rvg_add_menu_page()
64
  plugins_url('rvg-optimize-database/images/icon.png')
65
  );
66
  }
67
- }
68
- if(get_option('rvg_odb_adminmenu') == "Y") add_action('admin_menu', 'rvg_add_menu_page');
69
 
70
 
71
  /********************************************************************************************
@@ -83,8 +92,8 @@ function rvg_odb_admin_menu()
83
  'rvg_odb_admin',
84
  'rvg_odb_settings_page');
85
  }
86
- }
87
- if(get_option('rvg_odb_adminmenu') != "Y") add_action('admin_menu', 'rvg_odb_admin_menu');
88
 
89
 
90
  /********************************************************************************************
@@ -104,20 +113,22 @@ function register_odb_options()
104
  'rvg_odb_settings_page'
105
  );
106
  }
107
- }
108
- if(get_option('rvg_odb_adminmenu') == "Y") add_action('admin_menu', 'register_odb_options');
109
 
110
 
111
  /********************************************************************************************
112
- *
113
- * SHOW A LINK TO THE PLUGIN SETTINGS ON THE MAIN PLUGINS PAGE (v3.1)
114
- *
 
 
115
  *********************************************************************************************/
116
  function odb_settings_link($links)
117
  {
118
  array_unshift($links, '<a href="options-general.php?page=rvg_odb_admin">Settings</a>');
119
  return $links;
120
- } // gae_settings_link()
121
  add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link');
122
 
123
 
@@ -129,14 +140,15 @@ add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link'
129
  function rvg_odb_admin_bar()
130
  { global $wp_admin_bar;
131
  if (!is_super_admin() || !is_admin_bar_showing()) return;
 
132
  $siteurl = site_url('/');
133
  $wp_admin_bar->add_menu(
134
  array(
135
  'id' => 'optimize',
136
  'title' => __('Optimize DB (1 click)','rvg-optimize-database'),
137
  'href' => $siteurl.'wp-admin/tools.php?page=rvg-optimize-db.php&action=run' ));
138
- }
139
- $rvg_odb_adminbar = get_option('rvg_odb_adminbar');
140
  if($rvg_odb_adminbar == "Y") add_action('wp_before_admin_bar_render', 'rvg_odb_admin_bar');
141
 
142
 
@@ -147,7 +159,7 @@ if($rvg_odb_adminbar == "Y") add_action('wp_before_admin_bar_render', 'rvg_odb_a
147
  *********************************************************************************************/
148
  function odb_styles()
149
  { wp_enqueue_style ('odb', plugin_dir_url(__FILE__) . 'css/style.css',false,'1.0','all');
150
- } // wsc_styles()
151
  add_action( 'admin_init', 'odb_styles' );
152
 
153
 
@@ -158,14 +170,14 @@ add_action( 'admin_init', 'odb_styles' );
158
  http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
159
 
160
  *********************************************************************************************/
161
- function rvg_extra_schedules( $schedules ) {
162
- // ADD A WEEKLY SCHEDULE
163
  $schedules['weekly'] = array(
164
  'interval' => 604800,
165
  'display' => __('Once Weekly')
166
  );
167
  return $schedules;
168
- }
169
  add_filter( 'cron_schedules', 'rvg_extra_schedules' );
170
 
171
  add_action( 'rvg_optimize_database', 'rvg_optimize_db_cron' );
@@ -175,18 +187,103 @@ register_deactivation_hook( __FILE__, 'rvg_deactivate_plugin' );
175
  function rvg_deactivate_plugin()
176
  { // CLEAR CURRENT SCHEDULE (IF ANY)
177
  wp_clear_scheduled_hook('rvg_optimize_database');
178
- }
179
 
180
  // RE-SCHEDULE TASK WHEN RE-ACTIVATED (OR AFTER UPDATE)
181
  register_activation_hook( __FILE__, 'rvg_activate_plugin' );
182
  function rvg_activate_plugin()
183
- { $rvg_odb_schedule = get_option('rvg_odb_schedule');
184
  if($rvg_odb_schedule)
185
  { // PLUGIN RE-ACTIVATED: START SCHEDULER
186
  if( !wp_next_scheduled( 'rvg_optimize_database' ))
187
  wp_schedule_event( time(), $rvg_odb_schedule, 'rvg_optimize_database' );
188
  }
189
- } # rvg_activate_plugin ()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
 
191
 
192
  /********************************************************************************************
@@ -196,7 +293,13 @@ function rvg_activate_plugin()
196
  *********************************************************************************************/
197
  function rvg_odb_settings_page()
198
  {
199
- global $odb_version, $odb_release_date, $wpdb, $table_prefix;
 
 
 
 
 
 
200
 
201
  $timezone_format = _x('YmdGis', 'timezone date format');
202
  $current_datetime = date_i18n($timezone_format);
@@ -211,10 +314,10 @@ function rvg_odb_settings_page()
211
  {
212
  // v2.8.3
213
  check_admin_referer('odb_action', 'odb_nonce');
214
-
215
- # DELETE ALL EXCLUDED TABLES
216
  $sql = "
217
- DELETE FROM $wpdb->options
218
  WHERE `option_name` LIKE 'rvg_ex_%'
219
  ";
220
  $wpdb->get_results($sql);
@@ -222,70 +325,65 @@ function rvg_odb_settings_page()
222
  # ADD EXCLUDED TABLES
223
  foreach ($_POST as $key => $value)
224
  { if(substr($key,0,3) == 'cb_')
225
- { $sql = "
226
- INSERT INTO $wpdb->options (option_name, option_value, autoload)
227
- VALUES ('rvg_ex_".substr($key,3)."','excluded','yes')
228
- ";
229
- $wpdb->get_results($sql);
230
- }
231
  }
232
 
233
  if(isset($_POST['rvg_odb_number']))
234
  { $rvg_odb_number = trim($_POST['rvg_odb_number']);
235
- update_option('rvg_odb_number', $rvg_odb_number);
236
  }
237
 
238
  $rvg_clear_trash = 'N';
239
  if(isset($_POST['rvg_clear_trash']))
240
  $rvg_clear_trash = $_POST['rvg_clear_trash'];
241
- update_option('rvg_clear_trash', $rvg_clear_trash);
242
 
243
  $rvg_clear_spam = 'N';
244
  if(isset($_POST['rvg_clear_spam']))
245
  $rvg_clear_spam = $_POST['rvg_clear_spam'];
246
- update_option('rvg_clear_spam', $rvg_clear_spam);
247
 
248
  $rvg_clear_tags = 'N';
249
  if(isset($_POST['rvg_clear_tags']))
250
  $rvg_clear_tags = $_POST['rvg_clear_tags'];
251
- update_option('rvg_clear_tags', $rvg_clear_tags);
252
 
253
  $rvg_clear_transients = 'N';
254
  if(isset($_POST['rvg_clear_transients']))
255
  $rvg_clear_transients = $_POST['rvg_clear_transients'];
256
- update_option('rvg_clear_transients', $rvg_clear_transients);
257
 
258
  // v3.1
259
  $rvg_clear_pingbacks = 'N';
260
  if(isset($_POST['rvg_clear_pingbacks']))
261
  $rvg_clear_pingbacks = $_POST['rvg_clear_pingbacks'];
262
- update_option('rvg_clear_pingbacks', $rvg_clear_pingbacks);
263
 
264
  $rvg_odb_adminbar = 'N';
265
  if(isset($_POST['rvg_odb_adminbar']))
266
  $rvg_odb_adminbar = $_POST['rvg_odb_adminbar'];
267
- update_option('rvg_odb_adminbar', $rvg_odb_adminbar);
268
 
269
  // v3.1.3
270
  $rvg_odb_adminmenu = 'N';
271
  if(isset($_POST['rvg_odb_adminmenu']))
272
  $rvg_odb_adminmenu = $_POST['rvg_odb_adminmenu'];
273
- update_option('rvg_odb_adminmenu', $rvg_odb_adminmenu);
274
 
275
  $rvg_odb_logging_on = 'N';
276
  if(isset($_POST['rvg_odb_logging_on']))
277
  $rvg_odb_logging_on = $_POST['rvg_odb_logging_on'];
278
- update_option('rvg_odb_logging_on', $rvg_odb_logging_on);
279
 
280
  $rvg_odb_schedule = '';
281
  if(isset($_POST['rvg_odb_schedule']))
282
  $rvg_odb_schedule = $_POST['rvg_odb_schedule'];
283
- update_option('rvg_odb_schedule', $rvg_odb_schedule);
284
 
285
  $rvg_odb_schedulehour = '';
286
  if(isset($_POST['rvg_odb_schedulehour']))
287
  $rvg_odb_schedulehour = $_POST['rvg_odb_schedulehour'];
288
- update_option('rvg_odb_schedulehour', $rvg_odb_schedulehour);
289
 
290
  // CLEAR CURRENT SCHEDULE (IF ANY)
291
  wp_clear_scheduled_hook('rvg_optimize_database');
@@ -317,42 +415,43 @@ function rvg_odb_settings_page()
317
  echo "<div class='updated odb-bold'><p>".
318
  __('Optimize Database after Deleting Revisions SETTINGS UPDATED','rvg-optimize-database').
319
  " - ";
320
- echo __('Click <a href="tools.php?page=rvg-optimize-db.php" class="odb-bold">HERE</a> to run the optimization','rvg-optimize-database');
321
  echo "</p></div>";
322
- }
323
 
324
- $rvg_odb_number = get_option('rvg_odb_number');
325
  if(!$rvg_odb_number) $rvg_odb_number = '0';
326
 
327
- $rvg_clear_trash = get_option('rvg_clear_trash');
328
  if(!$rvg_clear_trash) $rvg_clear_trash = 'N';
329
 
330
- $rvg_clear_spam = get_option('rvg_clear_spam');
331
  if(!$rvg_clear_spam) $rvg_clear_spam = 'N';
332
 
333
- $rvg_clear_tags = get_option('rvg_clear_tags');
334
  if(!$rvg_clear_tags) $rvg_clear_tags = 'N';
335
 
336
- $rvg_clear_transients = get_option('rvg_clear_transients');
337
  if(!$rvg_clear_transients) $rvg_clear_transients = 'N';
338
 
339
  // v3.1
340
- $rvg_clear_pingbacks = get_option('rvg_clear_pingbacks');
341
  if(!$rvg_clear_pingbacks) $rvg_clear_pingbacks = 'N';
342
 
343
- $rvg_odb_logging_on = get_option('rvg_odb_logging_on');
344
  if(!$rvg_odb_logging_on) $rvg_odb_logging_on = 'N';
345
 
346
- $rvg_odb_schedule = get_option('rvg_odb_schedule');
347
  if(!$rvg_odb_schedule) $rvg_odb_schedule = '';
348
 
349
- $rvg_odb_schedulehour = get_option('rvg_odb_schedulehour');
350
 
351
- $rvg_odb_adminbar = get_option('rvg_odb_adminbar');
352
  if(!$rvg_odb_adminbar) $rvg_odb_adminbar = 'N';
353
 
354
- $rvg_odb_adminmenu = get_option('rvg_odb_adminmenu');
355
- if(!$rvg_odb_adminmenu) $rvg_odb_adminmenu = 'N';
 
356
  ?>
357
  <script type="text/javascript">
358
  function schedule_changed()
@@ -369,20 +468,36 @@ function schedule_changed()
369
  <?php // v2.8.3 ?>
370
  <?php wp_nonce_field( 'odb_action','odb_nonce' ); ?>
371
  <div class="wrap">
372
- <h2><?php echo __('Using Optimize Database after Deleting Revisions', 'rvg-optimize-database'); ?></h2>
 
 
373
  <blockquote>
374
- <p class="odb-bold">'<span class="odb-italic">Optimize Database after Deleting Revisions</span> ' <?php echo __('is an one-click plugin to clean and optimize your WordPress database','rvg-optimize-database');?></p>
375
- <p><?php echo __('Plugin version:','rvg-optimize-database');?><br />
 
 
 
 
376
  <span class="odb-bold">v<?php echo $odb_version ?> (<?php echo $odb_release_date?>)</span></p>
377
- <p><span class="odb-bold"><?php echo __('Author','rvg-optimize-database');?>:</span><br />
378
- <span class="odb-bold"><a href="http://cagewebdev.com/" target="_blank">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank">Rolf van Gelder</a></span>, Eindhoven, <?php echo __('The Netherlands','rvg-optimize-database');?><br />
379
- <span class="odb-bold"><?php echo __('Plugin URL:','rvg-optimize-database');?></span><br />
 
 
 
 
 
 
380
  <a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank"><span class="odb-bold">http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/</span></a><br />
381
- <span class="odb-bold"><?php echo __('Download URL:','rvg-optimize-database');?></span><br />
 
 
382
  <span class="odb-bold"><a href="https://wordpress.org/plugins/rvg-optimize-database/" target="_blank">https://wordpress.org/plugins/rvg-optimize-database/</a></span></p>
383
  <p>&nbsp;</p>
384
  </blockquote>
385
- <h2><?php echo __('Optimize Database after Deleting Revisions - Settings','rvg-optimize-database');?></h2>
 
 
386
  <?php
387
  if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"'; else $rvg_odb_adminbar_checked = '';
388
  if($rvg_odb_adminmenu == 'Y') $rvg_odb_adminmenu_checked = ' checked="checked"'; else $rvg_odb_adminmenu_checked = '';
@@ -400,49 +515,78 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
400
  <tr>
401
  <td colspan="3" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="4">
402
  <tr>
403
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?><br />
404
- <?php echo __('(\'0\' means: delete <u>ALL</u> revisions)','rvg-optimize-database');?></span></td>
 
 
 
405
  <td width="50%" valign="top"><input type="text" size="5" name="rvg_odb_number" id="rvg_odb_number" value="<?php echo $rvg_odb_number?>" class="odb-bold odb-blue" /></td>
406
  </tr>
407
  <tr>
408
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete all trashed items','rvg-optimize-database');?></span></td>
 
 
409
  <td width="50%" valign="top"><input name="rvg_clear_trash" type="checkbox" value="Y" <?php echo $rvg_clear_trash_checked?> /></td>
410
  </tr>
411
  <tr>
412
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete all spammed items','rvg-optimize-database');?></span></td>
 
 
413
  <td width="50%" valign="top"><input name="rvg_clear_spam" type="checkbox" value="Y" <?php echo $rvg_clear_spam_checked?> /></td>
414
  </tr>
415
  <tr>
416
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete unused tags','rvg-optimize-database');?></span></td>
 
 
417
  <td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
418
  </tr>
419
  <tr>
420
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete expired transients','rvg-optimize-database');?></span></td>
 
 
421
  <td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
422
  </tr>
423
  <tr>
424
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Delete pingbacks and trackbacks','rvg-optimize-database');?></span></td>
 
 
425
  <td width="50%" valign="top"><input name="rvg_clear_pingbacks" type="checkbox" value="Y" <?php echo $rvg_clear_pingbacks_checked?> /></td>
426
  </tr>
427
  <tr>
428
- <td width="50%" align="right" valign="top"><span class="odb-bold"><?php echo __('Keep a log','rvg-optimize-database');?></span></td>
 
 
429
  <td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
430
  </tr>
431
  <tr>
432
- <td width="50%" align="right"><span class="odb-bold"><?php echo __('Scheduler','rvg-optimize-database');?></span></td>
433
- <td width="50%"><select name="rvg_odb_schedule" id="rvg_odb_schedule" onchange="schedule_changed();">
434
- <option selected="selected" value=""><?php echo __('NOT SCHEDULED','rvg-optimize-database');?></option>
435
- <option value="hourly"><?php echo __('run optimization HOURLY','rvg-optimize-database');?></option>
436
- <option value="twicedaily"><?php echo __('run optimization TWICE A DAY','rvg-optimize-database');?></option>
437
- <option value="daily"><?php echo __('run optimization DAILY','rvg-optimize-database');?></option>
438
- <option value="weekly"><?php echo __('run optimization WEEKLY','rvg-optimize-database');?></option>
 
 
 
 
 
 
 
 
 
 
 
 
439
  <?php /*?><option value="test">run optimization TEST</option><?php */?>
440
  </select>
441
  <script type="text/javascript">
442
  jQuery("#rvg_odb_schedule").val('<?php echo $rvg_odb_schedule; ?>');
443
  </script>
444
- <span id="schedulehour" style="display:none;"> <span class="odb-bold"><?php echo __('Time','rvg-optimize-database');?></span>
445
- <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour">
 
 
446
  <?php
447
  for($i=0; $i<=23; $i++)
448
  { if($i<10) $i = '0'.$i;
@@ -459,14 +603,18 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
459
  <script type="text/javascript">schedule_changed();</script></td>
460
  </tr>
461
  <tr>
462
- <td align="right" valign="top"><span class="odb-bold"><?php echo __('Show \'1-click\' link in Admin Bar','rvg-optimize-database');?></span></td>
 
 
463
  <td valign="top"><input name="rvg_odb_adminbar" type="checkbox" value="Y" <?php echo $rvg_odb_adminbar_checked?> />
464
- <?php echo __('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
465
  </tr>
466
  <tr>
467
- <td align="right" valign="top"><span class="odb-bold"><?php echo __('Show an icon in the Admin Menu','rvg-optimize-database');?></span></td>
 
 
468
  <td valign="top"><input name="rvg_odb_adminmenu" type="checkbox" value="Y" <?php echo $rvg_odb_adminmenu_checked?> />
469
- <?php echo __('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
470
  </tr>
471
  </table></td>
472
  </tr>
@@ -476,10 +624,19 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
476
  # v2.8.3 $ replaced by jQuery
477
  ?>
478
  <tr>
479
- <td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
 
480
  <tr>
481
- <td colspan="4" align="center"><span class="odb-bold"><?php echo __('EXCLUDE DATABASE TABLES FROM OPTIMIZATION: <span class="odb-underline-red">CHECKED</span> TABLES <span class="odb-underline-red">WON\'T</span> BE OPTIMIZED!</span>','rvg-optimize-database');?><br />
482
- <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',true);"><?php echo __('check all tables','rvg-optimize-database');?></a> | <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',false);"><?php echo __('uncheck all tables','rvg-optimize-database');?></a> | <a href="javascript:;" onclick="jQuery(':not([id^=cb_<?php echo $table_prefix; ?>])').filter('[id^=cb_]').attr('checked',true);"><?php echo __('check all NON-WordPress tables','rvg-optimize-database');?></a></td>
 
 
 
 
 
 
 
 
483
  </tr>
484
  <tr>
485
  <?php
@@ -495,18 +652,13 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
495
  echo '<tr>';
496
  }
497
  $class = '';
498
- // WORDPRESS TABLE?
499
- if(substr($tables[$i][0], 0, strlen($table_prefix)) == $table_prefix) $class = 'class="odb-wp-table"';
 
500
 
501
  $cb_checked = '';
502
- $sql = "
503
- SELECT `option_value`
504
- FROM $wpdb->options
505
- WHERE `option_name` = 'rvg_ex_".$tables[$i][0]."'
506
- ";
507
- $results = $wpdb->get_results($sql);
508
- if(isset($results[0]->option_value))
509
- if($results[0]->option_value == 'excluded') $cb_checked = ' checked';
510
  echo '<td width="25%" '.$class.'><input id="cb_'.$tables[$i][0].'" name="cb_'.$tables[$i][0].'" type="checkbox" value="1" '.$cb_checked.' /> '.$tables[$i][0].'</td>'."\n";
511
  } # for ($i=0; $i<count($tables); $i++)
512
  ?>
@@ -517,16 +669,16 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
517
  </fieldset>
518
  </blockquote>
519
  <p class="submit">
520
- <input class="button-primary button-large" type='submit' name='info_update' value='<?php echo __('Save Settings','rvg-optimize-database');?>' class="odb-bold" />
521
  &nbsp;
522
- <input class="button odb-normal" type="button" name="optimizer" value="<?php echo __('Go To Optimizer','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php'" />
523
  </p>
524
  </div>
525
  </form>
526
  </div>
527
  <!-- ocb-options-form -->
528
  <?php
529
- } // rvg_odb_settings_page ()
530
 
531
 
532
  /********************************************************************************************
@@ -537,7 +689,10 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
537
  *********************************************************************************************/
538
  function rvg_optimize_db()
539
  {
540
- global $wpdb, $odb_version;
 
 
 
541
 
542
  // PAGE LOAD COUNTER
543
  $time = microtime();
@@ -545,8 +700,8 @@ function rvg_optimize_db()
545
  $time = $time[1] + $time[0];
546
  $odb_start_time = $time;
547
 
548
- $timezone_format = _x('G:i', 'timezone date format');
549
- $current_hour = date_i18n($timezone_format);
550
 
551
  if(isset($_REQUEST['action']))
552
  if($_REQUEST['action'] == "delete_log")
@@ -559,59 +714,59 @@ function rvg_optimize_db()
559
  ******************************************************************************************/
560
 
561
  // GET SETTINGS AND SET DEFAULT VALUES
562
- $max_revisions = get_option('rvg_odb_number');
563
  if(!$max_revisions)
564
  { $max_revisions = 0;
565
- update_option('rvg_odb_number', $max_revisions);
566
  }
567
 
568
- $clear_trash = get_option('rvg_clear_trash');
569
  if(!$clear_trash)
570
  { $clear_trash = 'N';
571
- update_option('rvg_clear_trash', $clear_trash);
572
  }
573
  $clear_trash_yn = ($clear_trash == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
574
 
575
- $clear_spam = get_option('rvg_clear_spam');
576
  if(!$clear_spam)
577
  { $clear_spam = 'N';
578
- update_option('rvg_clear_spam', $clear_spam);
579
  }
580
  $clear_spam_yn = ($clear_spam == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
581
 
582
- $clear_tags = get_option('rvg_clear_tags');
583
  if(!$clear_tags)
584
  { $clear_tags = 'N';
585
- update_option('rvg_clear_tags', $clear_tags);
586
  }
587
  $clear_tags_yn = ($clear_tags == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
588
 
589
- $clear_transients = get_option('rvg_clear_transients');
590
  if(!$clear_transients)
591
  { $clear_transients = 'N';
592
- update_option('rvg_clear_transients', $clear_transients);
593
  }
594
  $clear_transients_yn = ($clear_transients == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
595
 
596
  // v3.1
597
- $clear_pingbacks = get_option('rvg_clear_pingbacks');
598
  if(!$clear_pingbacks)
599
  { $clear_pingbacks = 'N';
600
- update_option('rvg_clear_pingbacks', $clear_pingbacks);
601
  }
602
  $clear_pingbacks_yn = ($clear_pingbacks == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
603
 
604
- $rvg_odb_logging_on = get_option('rvg_odb_logging_on');
605
  if(!$rvg_odb_logging_on)
606
  { $rvg_odb_logging_on = 'N';
607
- update_option('rvg_odb_logging_on', $rvg_odb_logging_on);
608
  }
609
  $rvg_odb_logging_on_yn = ($rvg_odb_logging_on == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
610
 
611
- $rvg_odb_schedule = get_option('rvg_odb_schedule');
612
  if(!$rvg_odb_schedule)
613
  { $rvg_odb_schedule = '';
614
- update_option('rvg_odb_schedule', $rvg_odb_schedule);
615
  }
616
 
617
  if($rvg_odb_schedule == 'hourly')
@@ -634,62 +789,92 @@ function rvg_optimize_db()
634
  $nextrun = date_i18n('M j, Y @ G:i', $timestamp);
635
  }
636
 
637
- $total_savings = get_option('rvg_odb_total_savings');
638
 
639
  $log_url = plugins_url().'/rvg-optimize-database/rvg-optimize-db-log.html';
640
 
641
  $sql = "
642
  SELECT COUNT(*) cnt
643
- FROM $wpdb->options
644
- WHERE option_name LIKE 'rvg_ex_%'
645
  ";
646
  $results = $wpdb->get_results($sql);
647
  $number_excluded = $results[0]->cnt;
648
  ?>
649
  <div class="odb-padding-left">
650
- <h2><?php echo __('Optimize your WordPress Database','rvg-optimize-database');?></h2>
 
 
651
  <?php
652
  if(isset($_REQUEST['action']))
653
  if($_REQUEST['action'] == "delete_log")
654
  echo '<div class="updated odb-updated"><p><span class="odb-bold">Optimize Database after Deleting Revisions - LOG FILE DELETED</span></p></div>';
655
  ?>
656
- <p><span class="odb-italic"><a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank" class="odb-bold">Optimize Database after Deleting Revisions v<?php echo $odb_version?></a> - <?php echo __('A WordPress Plugin by','rvg-optimize-database');?> <a href="http://cagewebdev.com/" target="_blank" class="odb-bold">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank" class="odb-bold">Rolf van Gelder</a>, Eindhoven, <?php echo __('The Netherlands','rvg-optimize-database');?></span></p>
657
- <p><?php echo __('Current settings','rvg-optimize-database');?>:<br />
658
- <span class="odb-bold"><?php echo __('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $max_revisions?></span><br />
659
- <span class="odb-bold"><?php echo __('Delete all trashed items','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $clear_trash_yn?></span><br />
660
- <span class="odb-bold"><?php echo __('Delete all spammed items','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $clear_spam_yn?></span><br />
661
- <span class="odb-bold"><?php echo __('Delete unused tags','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $clear_tags_yn?></span><br />
662
- <span class="odb-bold"><?php echo __('Delete expired transients','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $clear_transients_yn?></span><br />
663
- <span class="odb-bold"><?php echo __('Delete pingbacks and trackbacks','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $clear_pingbacks_yn?></span><br />
664
- <span class="odb-bold"><?php echo __('Keep a log','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $rvg_odb_logging_on_yn?></span><br />
665
- <span class="odb-bold"><?php echo __('Number of excluded tables','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $number_excluded?></span><br />
666
- <span class="odb-bold"><?php echo __('Scheduler','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $rvg_odb_schedule_txt?></span>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
667
  <?php
668
  if($nextrun)
669
  {
670
  ?>
671
  <br />
672
- <span class="odb-bold"><?php echo __('Next scheduled run','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo $nextrun?> hrs (current server time: <?php echo $current_hour?>)</span>
 
 
673
  <?php
674
  }
675
  if($total_savings)
676
  {
677
  ?>
678
  <br />
679
- <span class="odb-bold"><?php echo __('Total savings since the first run','rvg-optimize-database');?>:</span> <span class="odb-bold odb-blue"><?php echo rvg_format_size($total_savings); ?></span>
 
 
680
  <?php
681
  }
682
  ?>
683
  <p class="submit">
684
- <input class="button odb-normal" type="button" name="change_options" value="<?php echo __('Change Settings','rvg-optimize-database');?>" onclick="self.location='options-general.php?page=rvg_odb_admin'" />
685
  <?php
686
  if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
687
  {
688
  ?>
689
  &nbsp;
690
- <input class="button odb-normal" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" />
691
  &nbsp;
692
- <input class="button odb-normal" type="button" name="delete_log" value="<?php echo __('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" />
693
  <?php
694
  }
695
  $action = '';
@@ -698,7 +883,7 @@ function rvg_optimize_db()
698
  {
699
  ?>
700
  &nbsp;
701
- <input class="button-primary button-large" type="button" name="start_optimization" value="<?php echo __('Start Optimization','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=run'" class="odb-bold" />
702
  <?php
703
  }
704
  ?>
@@ -709,7 +894,9 @@ function rvg_optimize_db()
709
  if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
710
  if($action != 'run') return;
711
  ?>
712
- <h2 class="odb-padding-left"><?php echo __('Starting Optimization','rvg-optimize-database');?>...</h2>
 
 
713
  <?php
714
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
715
  $start_size = rvg_get_db_size();
@@ -728,20 +915,22 @@ function rvg_optimize_db()
728
  ?>
729
  <table border="0" cellspacing="8" cellpadding="2">
730
  <tr>
731
- <td colspan="4" class="odb-bold odb-blue"><?php echo __('DELETING REVISIONS','rvg-optimize-database');?>:</td>
 
732
  </tr>
733
  <tr>
734
  <th align="right" class="odb-border-bottom">#</th>
735
- <th align="left" class="odb-border-bottom"><?php echo __('post / page','rvg-optimize-database');?></th>
736
- <th align="left" class="odb-border-bottom"><?php echo __('revision date','rvg-optimize-database');?></th>
737
- <th align="right" class="odb-border-bottom"><?php echo __('revisions deleted','rvg-optimize-database');?></th>
 
738
  </tr>
739
  <?php
740
  // LOOP THROUGH THE REVISIONS AND DELETE THEM
741
  $total_deleted = rvg_delete_revisions($results, true, $max_revisions);
742
  ?>
743
  <tr>
744
- <td colspan="3" align="right" class="odb-border-top odb-bold"><?php echo __('total number of revisions deleted','rvg-optimize-database');?></td>
745
  <td align="right" class="odb-border-top odb-bold"><?php echo $total_deleted?></td>
746
  </tr>
747
  </table>
@@ -752,7 +941,8 @@ function rvg_optimize_db()
752
  ?>
753
  <table border="0" cellspacing="8" cellpadding="2">
754
  <tr>
755
- <td class="odb-not-found"><?php echo __('No REVISIONS found to delete','rvg-optimize-database');?>...</td>
 
756
  </tr>
757
  </table>
758
  <?php
@@ -761,6 +951,7 @@ function rvg_optimize_db()
761
  // NUMBER OF DELETED REVISIONS FOR LOG FILE
762
  $log_arr["revisions"] = $total_deleted;
763
 
 
764
  /****************************************************************************************
765
 
766
  DELETE TRASHED ITEMS
@@ -778,13 +969,15 @@ function rvg_optimize_db()
778
  <div class="odb-separator"></div>
779
  <table border="0" cellspacing="8" cellpadding="2">
780
  <tr>
781
- <td colspan="4" class="odb-found"><?php echo __('DELETING TRASHED ITEMS','rvg-optimize-database');?>:</td>
 
782
  </tr>
783
  <tr>
784
  <th align="right" class="odb-border-bottom">#</th>
785
- <th align="left" class="odb-border-bottom"><?php echo __('type','rvg-optimize-database');?></th>
786
- <th align="left" class="odb-border-bottom"><?php echo __('IP address / title','rvg-optimize-database');?></th>
787
- <th align="left" nowrap="nowrap" class="odb-border-bottom"><?php echo __('date','rvg-optimize-database');?></th>
 
788
  </tr>
789
  <?php
790
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
@@ -799,7 +992,8 @@ function rvg_optimize_db()
799
  <div class="odb-separator"></div>
800
  <table border="0" cellspacing="8" cellpadding="2">
801
  <tr>
802
- <td class="odb-not-found"><?php echo __('No TRASHED ITEMS found to delete','rvg-optimize-database');?>...</td>
 
803
  </tr>
804
  </table>
805
  <?php
@@ -807,8 +1001,8 @@ function rvg_optimize_db()
807
 
808
  // NUMBER OF DELETED TRASH FOR LOG FILE
809
  $log_arr["trash"] = $total_deleted;
810
-
811
  } // if($clear_trash == 'Y')
 
812
 
813
  /****************************************************************************************
814
 
@@ -827,13 +1021,15 @@ function rvg_optimize_db()
827
  <div class="odb-separator"></div>
828
  <table border="0" cellspacing="8" cellpadding="2">
829
  <tr>
830
- <td colspan="4" class="odb-found"><?php echo __('DELETING SPAMMED ITEMS','rvg-optimize-database');?>:</td>
 
831
  </tr>
832
  <tr>
833
  <th align="right" class="odb-border-bottom">#</th>
834
- <th align="left" class="odb-border-bottom"><?php echo __('comment author','rvg-optimize-database');?></th>
835
- <th align="left" class="odb-border-bottom"><?php echo __('comment author email','rvg-optimize-database');?></th>
836
- <th align="left" nowrap="nowrap" class="odb-border-bottom"><?php echo __('comment date','rvg-optimize-database');?></th>
 
837
  </tr>
838
  <?php
839
  // LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
@@ -848,7 +1044,8 @@ function rvg_optimize_db()
848
  <div class="odb-separator"></div>
849
  <table border="0" cellspacing="8" cellpadding="2">
850
  <tr>
851
- <td class="odb-not-found"><?php echo __('No SPAMMED ITEMS found to delete','rvg-optimize-database');?>...</td>
 
852
  </tr>
853
  </table>
854
  <?php
@@ -858,6 +1055,7 @@ function rvg_optimize_db()
858
 
859
  // NUMBER OF SPAM DELETED FOR LOG FILE
860
  $log_arr["spam"] = $total_deleted;
 
861
 
862
  /****************************************************************************************
863
 
@@ -875,7 +1073,9 @@ function rvg_optimize_db()
875
  <div class="odb-separator"></div>
876
  <table border="0" cellspacing="8" cellpadding="2">
877
  <tr>
878
- <td><span class="odb-found"><?php echo __('NUMBER OF UNUSED TAGS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
 
 
879
  </tr>
880
  </table>
881
  <?php
@@ -886,7 +1086,8 @@ function rvg_optimize_db()
886
  <div class="odb-separator"></div>
887
  <table border="0" cellspacing="8" cellpadding="2">
888
  <tr>
889
- <td class="odb-not-found"><?php echo __('No UNUSED TAGS found to delete','rvg-optimize-database');?>...</td>
 
890
  </tr>
891
  </table>
892
  <?php
@@ -897,6 +1098,7 @@ function rvg_optimize_db()
897
  // NUMBER OF tags DELETED FOR LOG FILE
898
  $log_arr["tags"] = $total_deleted;
899
 
 
900
  /****************************************************************************************
901
 
902
  DELETE EXPIRED TRANSIENTS
@@ -913,7 +1115,9 @@ function rvg_optimize_db()
913
  <div class="odb-separator"></div>
914
  <table border="0" cellspacing="8" cellpadding="2">
915
  <tr>
916
- <td><span class="odb-found"><?php echo __('NUMBER OF EXPIRED TRANSIENTS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
 
 
917
  </tr>
918
  </table>
919
  <?php
@@ -924,7 +1128,8 @@ function rvg_optimize_db()
924
  <div class="odb-separator"></div>
925
  <table border="0" cellspacing="8" cellpadding="2">
926
  <tr>
927
- <td class="odb-not-found"><?php echo __('No EXPIRED TRANSIENTS found to delete','rvg-optimize-database');?>...</td>
 
928
  </tr>
929
  </table>
930
  <?php
@@ -951,7 +1156,9 @@ function rvg_optimize_db()
951
  <div class="odb-separator"></div>
952
  <table border="0" cellspacing="8" cellpadding="2">
953
  <tr>
954
- <td><span class="odb-found"><?php echo __('NUMBER OF PINGBACKS AND TRACKBACKS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
 
 
955
  </tr>
956
  </table>
957
  <?php
@@ -962,7 +1169,8 @@ function rvg_optimize_db()
962
  <div class="odb-separator"></div>
963
  <table border="0" cellspacing="8" cellpadding="2">
964
  <tr>
965
- <td class="odb-not-found"><?php echo __('No PINGBACKS nor TRACKBACKS found to delete','rvg-optimize-database');?>...</td>
 
966
  </tr>
967
  </table>
968
  <?php
@@ -986,7 +1194,9 @@ function rvg_optimize_db()
986
  <div class="odb-separator"></div>
987
  <table border="0" cellspacing="8" cellpadding="2">
988
  <tr>
989
- <td colspan="4"><span class="odb-found"><?php echo __('NUMBER OF POSTMETA ORPHANS DELETED','rvg-optimize-database');?>:</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
 
 
990
  </tr>
991
  </table>
992
  <?php
@@ -997,7 +1207,8 @@ function rvg_optimize_db()
997
  <div class="odb-separator"></div>
998
  <table border="0" cellspacing="8" cellpadding="2">
999
  <tr>
1000
- <td class="odb-not-found"><?php echo __('No POSTMETA ORPHANS found to delete','rvg-optimize-database');?>...</td>
 
1001
  </tr>
1002
  </table>
1003
  <?php
@@ -1015,15 +1226,16 @@ function rvg_optimize_db()
1015
  <div class="odb-optimizing-table">
1016
  <table border="0" cellspacing="8" cellpadding="2">
1017
  <tr>
1018
- <td colspan="4" class="odb-bold odb-blue"><?php echo __('OPTIMIZING DATABASE TABLES','rvg-optimize-database');?>:</td>
 
1019
  </tr>
1020
  <tr>
1021
  <th class="odb-border-bottom" align="right">#</th>
1022
- <th class="odb-border-bottom" align="left"><?php echo __('table name','rvg-optimize-database');?></th>
1023
- <th class="odb-border-bottom" align="left"><?php echo __('optimization result','rvg-optimize-database');?></th>
1024
- <th class="odb-border-bottom" align="left"><?php echo __('engine','rvg-optimize-database');?></th>
1025
- <th class="odb-border-bottom" align="right"><?php echo __('table rows','rvg-optimize-database');?></th>
1026
- <th class="odb-border-bottom" align="right"><?php echo __('table size','rvg-optimize-database');?></th>
1027
  </tr>
1028
  <?php
1029
  # OPTIMIZE THE DATABASE TABLES
@@ -1043,31 +1255,33 @@ function rvg_optimize_db()
1043
  // WRITE RESULTS TO LOG FILE
1044
  rvg_write_log($log_arr);
1045
 
1046
- $total_savings = get_option('rvg_odb_total_savings');
1047
  $total_savings += ($start_size - $end_size);
1048
- update_option('rvg_odb_total_savings',$total_savings);
1049
  ?>
1050
  <div class="odb-separator"></div>
1051
- <span class="odb-bold odb-blue odb-padding-left"><?php echo __('SAVINGS','rvg-optimize-database');?></span><br />
 
 
1052
  <table border="0" cellspacing="8" cellpadding="2">
1053
  <tr>
1054
  <th>&nbsp;</th>
1055
- <th class="odb-border-bottom"><?php echo __('size of the database','rvg-optimize-database');?></th>
1056
  </tr>
1057
  <tr>
1058
- <td align="right"><?php echo __('BEFORE optimization','rvg-optimize-database');?></td>
1059
  <td align="right" class="odb-bold"><?php echo rvg_format_size($start_size,3); ?></td>
1060
  </tr>
1061
  <tr>
1062
- <td align="right"><?php echo __('AFTER optimization','rvg-optimize-database');?></td>
1063
  <td align="right" class="odb-bold"><?php echo rvg_format_size($end_size,3); ?></td>
1064
  </tr>
1065
  <tr>
1066
- <td align="right" class="odb-bold"><?php echo __('SAVINGS THIS TIME','rvg-optimize-database');?></td>
1067
  <td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size(($start_size - $end_size),3); ?></td>
1068
  </tr>
1069
  <tr>
1070
- <td align="right" class="odb-bold"><?php echo __('TOTAL SAVINGS SINCE THE FIRST RUN','rvg-optimize-database');?></td>
1071
  <td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size($total_savings,3); ?></td>
1072
  </tr>
1073
  </table>
@@ -1078,11 +1292,18 @@ $time = microtime();
1078
  $time = explode(' ', $time);
1079
  $time = $time[1] + $time[0];
1080
  $finish = $time;
 
1081
  $total_time = round(($finish - $odb_start_time), 4);
1082
  ?>
1083
- <span class="odb-bold odb-blue odb-padding-left"><?php echo __('DONE','rvg-optimize-database');?>!</span><br />
 
 
1084
  <br />
1085
- <span class="odb-padding-left"><?php echo __('Optimization took', 'rvg-optimize-database').' <strong>'.$total_time.'</strong> '.__('seconds', 'rvg-optimize-database').'.'?></span>
 
 
 
 
1086
  <?php
1087
  if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
1088
  {
@@ -1090,12 +1311,12 @@ $total_time = round(($finish - $odb_start_time), 4);
1090
  <br />
1091
  <br />
1092
  &nbsp;
1093
- <input class="button odb-normal" type="button" name="view_log" value="<?php echo __('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" />
1094
  &nbsp;
1095
- <input class="button odb-normal" type="button" name="delete_log" value="<?php echo __('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" />
1096
  <?php
1097
  }
1098
- } // rvg_optimize_db ()
1099
 
1100
 
1101
  /********************************************************************************************
@@ -1108,41 +1329,41 @@ function rvg_optimize_db_cron()
1108
  global $wpdb, $odb_version;
1109
 
1110
  // GET SETTINGS AND SET DEFAULT VALUES
1111
- $max_revisions = get_option('rvg_odb_number');
1112
  if(!$max_revisions)
1113
  { $max_revisions = 0;
1114
- update_option('rvg_odb_number', $max_revisions);
1115
  }
1116
 
1117
- $clear_trash = get_option('rvg_clear_trash');
1118
  if(!$clear_trash)
1119
  { $clear_trash = 'N';
1120
- update_option('rvg_clear_trash', $clear_trash);
1121
  }
1122
 
1123
- $clear_spam = get_option('rvg_clear_spam');
1124
  if(!$clear_spam)
1125
  { $clear_spam = 'N';
1126
- update_option('rvg_clear_spam', $clear_spam);
1127
  }
1128
 
1129
- $clear_tags = get_option('rvg_clear_tags');
1130
  if(!$clear_tags)
1131
  { $clear_tags = 'N';
1132
- update_option('rvg_clear_tags', $clear_tags);
1133
  }
1134
 
1135
- $clear_transients = get_option('rvg_clear_transients');
1136
  if(!$clear_transients)
1137
  { $clear_transients = 'N';
1138
- update_option('rvg_clear_transients', $clear_transients);
1139
  }
1140
 
1141
  // v3.1
1142
- $clear_pingbacks = get_option('rvg_clear_pingbacks');
1143
  if(!$clear_pingbacks)
1144
  { $clear_pingbacks = 'N';
1145
- update_option('rvg_clear_pingbacks', $clear_pingbacks);
1146
  }
1147
 
1148
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
@@ -1236,16 +1457,18 @@ function rvg_optimize_db_cron()
1236
  // WRITE RESULTS TO LOG FILE
1237
  rvg_write_log($log_arr);
1238
 
1239
- $total_savings = get_option('rvg_odb_total_savings');
1240
  $total_savings += ($start_size - $end_size);
1241
- update_option('rvg_odb_total_savings',$total_savings);
1242
 
1243
- } // rvg_optimize_db_cron ()
1244
 
1245
 
1246
  /********************************************************************************************
1247
 
1248
  DELETE THE REVISIONS
 
 
1249
 
1250
  *********************************************************************************************/
1251
  function rvg_delete_revisions($results, $display, $max_revisions)
@@ -1256,24 +1479,27 @@ function rvg_delete_revisions($results, $display, $max_revisions)
1256
  $total_deleted = 0;
1257
 
1258
  for($i=0; $i<count($results); $i++)
1259
- { $nr_to_delete = $results[$i]->cnt - $max_revisions;
1260
  $total_deleted += $nr_to_delete;
 
1261
  if($display)
1262
  {
1263
  ?>
1264
  <tr>
1265
  <td align="right" valign="top"><?php echo $nr?>.</td>
1266
- <td valign="top" class="odb-bold"><?php echo $results[$i]->post_title?></td>
 
1267
  <td valign="top"><?php
1268
  } // if($display)
1269
 
1270
  $sql_get_posts = "
1271
  SELECT `ID`, `post_modified`
1272
- FROM $wpdb->posts
1273
- WHERE `post_parent`=".$results[$i]->post_parent."
1274
- AND `post_type`='revision'
1275
  ORDER BY `post_modified` ASC
1276
  ";
 
1277
  $results_get_posts = $wpdb->get_results($sql_get_posts);
1278
 
1279
  for($j=0; $j<$nr_to_delete; $j++)
@@ -1281,7 +1507,7 @@ function rvg_delete_revisions($results, $display, $max_revisions)
1281
  if($display) echo $results_get_posts[$j]->post_modified.'<br />';
1282
 
1283
  $sql_delete = "
1284
- DELETE FROM $wpdb->posts
1285
  WHERE `ID` = ".$results_get_posts[$j]->ID."
1286
  ";
1287
  $wpdb->get_results($sql_delete);
@@ -1297,13 +1523,16 @@ function rvg_delete_revisions($results, $display, $max_revisions)
1297
  <?php
1298
  } // if($display)
1299
  } // for($i=0; $i<count($results); $i++)
 
1300
  return $total_deleted;
1301
- } // rvg_delete_revisions ()
1302
 
1303
 
1304
  /********************************************************************************************
1305
 
1306
  DELETE TRASHED POSTS AND PAGES
 
 
1307
 
1308
  *********************************************************************************************/
1309
  function rvg_delete_trash($results, $display)
@@ -1312,52 +1541,57 @@ function rvg_delete_trash($results, $display)
1312
 
1313
  $nr = 1;
1314
  $total_deleted = count($results);
1315
- for($i=0; $i<count($results); $i++)
 
1316
  { if($display)
1317
  {
1318
  ?>
1319
  <tr>
1320
  <td align="right" valign="top"><?php echo $nr; ?></td>
1321
- <td valign="top"><?php echo $results[$i]->post_type; ?></td>
1322
- <td valign="top"><?php echo $results[$i]->title; ?></td>
1323
- <td valign="top" nowrap="nowrap"><?php echo $results[$i]->modified; ?></td>
 
1324
  </tr>
1325
  <?php
1326
  }
1327
- if($results[$i]->post_type == 'comment')
 
1328
  { // DELETE META DATA (IF ANY...)
1329
  $sql_delete = "
1330
- DELETE FROM $wpdb->commentmeta
1331
- WHERE `comment_id` = ".$results[$i]->id."
1332
  ";
1333
  $wpdb->get_results($sql_delete);
1334
  }
1335
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1336
  $nr++;
1337
  } // for($i=0; $i<count($results); $i++)
1338
-
1339
- // DELETE TRASHED POSTS / PAGES
1340
- $sql_delete = "
1341
- DELETE FROM $wpdb->posts
1342
- WHERE `post_status` = 'trash'
1343
- ";
1344
- $wpdb->get_results($sql_delete);
1345
-
1346
- // DELETE TRASHED COMMENTS
1347
- $sql_delete = "
1348
- DELETE FROM $wpdb->comments
1349
- WHERE `comment_approved` = 'trash'
1350
- ";
1351
- $wpdb->get_results($sql_delete);
1352
 
1353
  return $total_deleted;
1354
 
1355
- } // rvg_delete_trash ()
1356
 
1357
 
1358
  /********************************************************************************************
1359
 
1360
  DELETE SPAMMED ITEMS
 
 
1361
 
1362
  *********************************************************************************************/
1363
  function rvg_delete_spam($results, $display)
@@ -1372,68 +1606,88 @@ function rvg_delete_spam($results, $display)
1372
  ?>
1373
  <tr>
1374
  <td align="right" valign="top"><?php echo $nr; ?></td>
1375
- <td valign="top"><?php echo $results[$i]->comment_author; ?></td>
1376
- <td valign="top"><?php echo $results[$i]->comment_author_email; ?></td>
1377
- <td valign="top" nowrap="nowrap"><?php echo $results[$i]->comment_date; ?></td>
 
1378
  </tr>
1379
  <?php
1380
  } // if($display)
 
 
 
 
 
 
 
1381
  $sql_delete = "
1382
- DELETE FROM $wpdb->commentmeta
1383
- WHERE `comment_id` = ".$results[$i]->comment_ID."
1384
  ";
1385
  $wpdb->get_results($sql_delete);
 
1386
  $nr++;
1387
  } // for($i=0; $i<count($results); $i++)
1388
 
1389
- $sql_delete = "
1390
- DELETE FROM $wpdb->comments
1391
- WHERE `comment_approved` = 'spam'
1392
- ";
1393
- $wpdb->get_results($sql_delete);
1394
-
1395
  return $total_deleted;
1396
 
1397
- } // rvg_delete_spam ()
1398
 
1399
 
1400
  /********************************************************************************************
1401
 
1402
  DELETE UNUSED TAGS
 
 
1403
 
1404
  *********************************************************************************************/
1405
  function rvg_delete_tags()
1406
  {
 
 
1407
  $total_deleted = 0;
1408
 
1409
- $tags = get_terms('post_tag', array('hide_empty' => 0));
1410
-
1411
- for($i=0; $i<count($tags); $i++)
1412
- if($tags[$i]->count < 1)
1413
- { if(!rvg_delete_tags_is_scheduled($tags[$i]->term_id))
1414
- { // v3.0: TAG NOT USED IN SCHEDULED POSTS: CAN BE DELETED
1415
- $total_deleted++;
1416
- // echo $tags[$i]->term_id.' '.$tags[$i]->name.'<br />';
1417
- wp_delete_term($tags[$i]->term_id,'post_tag');
1418
- }
 
 
 
 
 
1419
  }
1420
-
 
 
 
 
1421
  return $total_deleted;
1422
- } // rvg_delete_tags ()
1423
 
1424
 
1425
  /********************************************************************************************
1426
 
1427
- v3.0: IS THE UNUSED TAG USED IN ONE OR MORE SCHEDULED POSTS?
 
 
 
 
1428
 
1429
  *********************************************************************************************/
1430
- function rvg_delete_tags_is_scheduled($term_id)
1431
  {
1432
  global $wpdb;
1433
-
1434
  $sql_get_posts = "
1435
  SELECT p.post_status
1436
- FROM $wpdb->term_relationships t, $wpdb->posts p
1437
  WHERE t.term_taxonomy_id = '".$term_id."'
1438
  AND t.object_id = p.ID
1439
  ";
@@ -1450,171 +1704,193 @@ function rvg_delete_tags_is_scheduled($term_id)
1450
  /********************************************************************************************
1451
 
1452
  DELETE EXPIRED TRANSIENTS
 
 
1453
 
1454
  *********************************************************************************************/
1455
  function rvg_delete_transients()
1456
  {
1457
- global $wpdb;
1458
 
1459
- $delay = time() - 60; // one minute delay
1460
 
1461
  $total_deleted = 0;
1462
-
1463
- $sql = "
1464
- SELECT *
1465
- FROM $wpdb->options
1466
- WHERE (
1467
- option_name LIKE '_transient_timeout_%'
1468
- OR option_name LIKE '_site_transient_timeout_%'
1469
- OR option_name LIKE 'displayed_galleries_%'
1470
- )
1471
- AND option_value < '$delay'
1472
- ";
1473
-
1474
- $results = $wpdb->get_results($sql);
1475
- $total_deleted = count($results);
1476
-
1477
- $sql = "
1478
- DELETE FROM $wpdb->options
1479
- WHERE (
1480
- option_name LIKE '_transient_timeout_%'
1481
- OR option_name LIKE '_site_transient_timeout_%'
1482
- OR option_name LIKE 'displayed_galleries_%'
1483
- )
1484
- AND option_value < '$delay'
1485
- ";
1486
 
1487
- $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
 
 
 
 
1488
 
1489
- $sql = "
1490
- SELECT *
1491
- FROM $wpdb->options
1492
- WHERE (
1493
- option_name LIKE '_transient_timeout_%'
1494
- OR option_name LIKE '_site_transient_timeout_%'
1495
- )
1496
- AND option_value < '$delay'
1497
- ";
1498
 
1499
- $results = $wpdb->get_results($sql);
1500
- $total_deleted += count($results);
1501
-
1502
- $sql = "
1503
- DELETE FROM $wpdb->options
1504
- WHERE (
1505
- option_name LIKE '_transient_timeout_%'
1506
- OR option_name LIKE '_site_transient_timeout_%'
1507
- )
1508
- AND option_value < '$delay'
1509
- ";
1510
 
1511
- $wpdb->get_results($sql);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1512
 
1513
  return $total_deleted;
1514
- } // rvg_delete_transients ()
1515
 
1516
 
1517
  /********************************************************************************************
1518
 
1519
- DELETE PINGBACKS AND TRACKBACKS (v3.1)
 
 
 
 
1520
 
1521
  *********************************************************************************************/
1522
  function rvg_delete_pingbacks()
1523
  {
1524
- global $wpdb;
1525
 
1526
  $total_deleted = 0;
 
 
 
 
 
 
 
 
 
 
 
 
1527
 
1528
- $sql = "
1529
- SELECT `comment_ID`
1530
- FROM $wpdb->comments
1531
- WHERE (
1532
- `comment_type` = 'pingback'
1533
- OR `comment_type` = 'trackback'
1534
- )
1535
- ";
1536
 
1537
- $results = $wpdb->get_results($sql);
1538
- $total_deleted = count($results);
 
 
 
 
 
 
1539
 
1540
- for($i=0; $i<count($results); $i++)
1541
- { // DELETE METADATA FOR THIS COMMENT (IF ANY)
1542
- $sql_delete_meta = "
1543
- DELETE FROM $wpdb->commentmeta
1544
- WHERE `comment_id` = ".$results[$i]->comment_ID."
 
 
1545
  ";
1546
- $wpdb->get_results($sql_delete_meta);
1547
  }
1548
-
1549
- $sql_delete_comments = "
1550
- DELETE FROM $wpdb->comments
1551
- WHERE (
1552
- `comment_type` = 'pingback'
1553
- OR `comment_type` = 'trackback'
1554
- )
1555
- ";
1556
- $wpdb->get_results($sql_delete_comments);
1557
 
1558
  return $total_deleted;
1559
- } // rvg_delete_pingbacks ()
1560
 
1561
 
1562
  /********************************************************************************************
1563
 
1564
- DELETE ORPHAN POSTMETA RECORDS
 
 
 
 
1565
 
1566
  *********************************************************************************************/
1567
  function rvg_delete_orphans($display)
1568
  {
1569
- global $wpdb;
1570
 
1571
  $meta_orphans = 0;
1572
  $post_orphans = 0;
1573
 
1574
-
1575
- // DELETE POST ORPHANS (AUTO DRAFTS)
1576
- $sql_delete = "
1577
- SELECT COUNT(*) cnt
1578
- FROM $wpdb->posts
1579
- WHERE ID NOT IN (SELECT post_id FROM $wpdb->postmeta)
1580
- AND post_status = 'auto-draft'
1581
- ";
1582
-
1583
- $results = $wpdb->get_results($sql_delete);
1584
-
1585
- $post_orphans = $results[0]->cnt;
1586
-
1587
- if($post_orphans > 0)
1588
- { $sql_delete = "
1589
- DELETE FROM $wpdb->posts
1590
- WHERE ID NOT IN (SELECT post_id FROM $wpdb->postmeta)
1591
  AND post_status = 'auto-draft'
1592
  ";
1593
- $wpdb->get_results($sql_delete);
1594
- }
1595
 
1596
- // DELETE POSTMETA ORPHANS
1597
- $sql_delete = "
1598
- SELECT COUNT(*) cnt
1599
- FROM $wpdb->postmeta
1600
- WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)
1601
- ";
1602
-
1603
- $results = $wpdb->get_results($sql_delete);
1604
-
1605
- $meta_orphans = $results[0]->cnt;
1606
-
1607
- if($meta_orphans > 0)
1608
- { $sql_delete = "
1609
- DELETE FROM $wpdb->postmeta
1610
- WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)
 
 
 
1611
  ";
1612
- $wpdb->get_results($sql_delete);
 
 
 
 
 
 
 
 
 
 
 
1613
  }
1614
 
1615
  return ($meta_orphans + $post_orphans);
1616
 
1617
- } // rvg_delete_orphans ()
1618
 
1619
 
1620
  /********************************************************************************************
@@ -1633,7 +1909,7 @@ function rvg_optimize_tables($display)
1633
  $cnt = 0;
1634
  for ($i=0; $i<count($tables); $i++)
1635
  {
1636
- $excluded = get_option('rvg_ex_'.$tables[$i][0]);
1637
 
1638
  if(!$excluded)
1639
  { # TABLE NOT EXCLUDED
@@ -1657,7 +1933,7 @@ function rvg_optimize_tables($display)
1657
  { $query = "OPTIMIZE TABLE ".$tables[$i][0];
1658
  $result = $wpdb->get_results($query);
1659
  $msg = $result[0]->Msg_text;
1660
- $msg = str_replace('OK', __('TABLE OPTIMIZED', 'rvg-optimize-database'), $msg);
1661
  $msg = str_replace('Table is already up to date', __('Table is already up to date', 'rvg-optimize-database'), $msg);
1662
  }
1663
 
@@ -1678,7 +1954,7 @@ function rvg_optimize_tables($display)
1678
  } // for ($i=0; $i<count($tables); $i++)
1679
  return $cnt;
1680
 
1681
- } // rvg_optimize_tables ()
1682
 
1683
 
1684
  /********************************************************************************************
@@ -1690,10 +1966,10 @@ function rvg_write_log($log_arr)
1690
  {
1691
  global $odb_version;
1692
 
1693
- $rvg_odb_logging_on = get_option('rvg_odb_logging_on');
1694
  if(!$rvg_odb_logging_on)
1695
  { $rvg_odb_logging_on = 'N';
1696
- update_option('rvg_odb_logging_on', $rvg_odb_logging_on);
1697
  }
1698
 
1699
  if($rvg_odb_logging_on == "Y")
@@ -1772,83 +2048,132 @@ td {
1772
  <td width="8%" align="right" valign="top">'.$log_arr["after"].'</td>
1773
  <td width="8%" align="right" valign="top">'.$log_arr["savings"].'</td>
1774
  </tr>
1775
- </table>
1776
  ';
1777
 
1778
  // print_r($log_arr);
1779
  file_put_contents($file,$html,FILE_APPEND);
1780
  }
1781
 
1782
- } // rvg_write_log ()
1783
 
1784
 
1785
  /********************************************************************************************
1786
 
1787
  GET REVISIONS
 
 
1788
 
1789
  *********************************************************************************************/
1790
  function rvg_get_revisions($max_revisions)
1791
  {
1792
- global $wpdb;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1793
 
1794
- $sql = "
1795
- SELECT `post_parent`, `post_title`, COUNT(*) cnt
1796
- FROM $wpdb->posts
1797
- WHERE `post_type` = 'revision'
1798
- GROUP BY `post_parent`
1799
- HAVING COUNT(*) > ".$max_revisions."
1800
- ORDER BY UCASE(`post_title`)
1801
- ";
1802
 
1803
- return $wpdb->get_results($sql);
1804
 
1805
- } // rvg_get_revisions ()
1806
 
1807
 
1808
  /********************************************************************************************
1809
 
1810
  GET TRASHED POSTS / PAGES AND COMMENTS
 
 
1811
 
1812
  *********************************************************************************************/
1813
  function rvg_get_trash()
1814
  {
1815
- global $wpdb;
 
 
1816
 
1817
- $sql = "
1818
- SELECT `ID` AS id, 'post' AS post_type, `post_title` AS title, `post_modified` AS modified
1819
- FROM $wpdb->posts
1820
- WHERE `post_status` = 'trash'
1821
- UNION ALL
1822
- SELECT `comment_ID` AS id, 'comment' AS post_type, `comment_author_IP` AS title, `comment_date` AS modified
1823
- FROM $wpdb->comments
1824
- WHERE `comment_approved` = 'trash'
1825
- ORDER BY post_type, UCASE(title)
1826
- ";
 
 
 
 
 
 
 
 
 
 
 
 
 
1827
 
1828
- return $wpdb->get_results($sql);
1829
 
1830
- } // rvg_get_trash ()
1831
 
1832
 
1833
  /********************************************************************************************
1834
 
1835
  GET SPAMMED COMMENTS
 
 
1836
 
1837
  *********************************************************************************************/
1838
  function rvg_get_spam()
1839
  {
1840
- global $wpdb;
 
 
1841
 
 
 
 
 
1842
  $sql = "
1843
  SELECT `comment_ID`, `comment_author`, `comment_author_email`, `comment_date`
1844
- FROM $wpdb->comments
1845
  WHERE `comment_approved` = 'spam'
1846
  ORDER BY UCASE(`comment_author`)
1847
  ";
 
 
 
 
 
 
 
 
 
 
1848
 
1849
- return $wpdb->get_results($sql);
1850
-
1851
- } // rvg_get_trash ()
1852
 
1853
 
1854
  /********************************************************************************************
@@ -1872,7 +2197,7 @@ function rvg_get_db_size()
1872
 
1873
  return $res[0]->size;
1874
 
1875
- } // rvg_get_db_size ()
1876
 
1877
 
1878
  /********************************************************************************************
@@ -1888,5 +2213,5 @@ function rvg_format_size($size, $precision=1)
1888
  $table_size = (round($size/1024,$precision)).' KB';
1889
 
1890
  return $table_size;
1891
- } // rvg_format_size ()
1892
  ?>
1
  <?php
 
 
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
+ * @version 3.3
5
  */
6
  /*
7
  Plugin Name: Optimize Database after Deleting Revisions
9
  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
+ Version: 3.3
13
  */
14
 
15
+ $odb_version = '3.3';
16
+ $odb_release_date = '03/27/2015';
17
+ // v3.3 - MULTISITE
18
+ $odb_ms_prefixes = array();
19
+ $odb_ms_blogids = array();
20
+
21
+
22
  /********************************************************************************************
23
 
24
  ADD THE LANGUAGE SUPPORT (LOCALIZATION)
25
+
26
+ Since: v2.9
27
 
28
  *********************************************************************************************/
29
  function rvg_odb_action_init()
50
  'rvg_optimize_db');
51
  }
52
  }
53
+ if(rvg_odb_get_option('rvg_odb_adminmenu') != "Y") add_action('admin_menu', 'optimize_db_main');
54
 
55
 
56
  /********************************************************************************************
57
 
58
+ 'ICON MODE': ADD A LINK TO THE ADMIN MENU
59
+
60
+ Since: v3.1.1
61
 
62
  *********************************************************************************************/
63
  function rvg_add_menu_page()
73
  plugins_url('rvg-optimize-database/images/icon.png')
74
  );
75
  }
76
+ } // rvg_add_menu_page()
77
+ if(rvg_odb_get_option('rvg_odb_adminmenu') == "Y") add_action('admin_menu', 'rvg_add_menu_page');
78
 
79
 
80
  /********************************************************************************************
92
  'rvg_odb_admin',
93
  'rvg_odb_settings_page');
94
  }
95
+ } // rvg_odb_admin_menu()
96
+ if(rvg_odb_get_option('rvg_odb_adminmenu') != "Y") add_action('admin_menu', 'rvg_odb_admin_menu');
97
 
98
 
99
  /********************************************************************************************
113
  'rvg_odb_settings_page'
114
  );
115
  }
116
+ } // register_odb_options()
117
+ if(rvg_odb_get_option('rvg_odb_adminmenu') == "Y") add_action('admin_menu', 'register_odb_options');
118
 
119
 
120
  /********************************************************************************************
121
+
122
+ SHOW A LINK TO THE PLUGIN SETTINGS ON THE MAIN PLUGINS PAGE
123
+
124
+ Since: v3.1
125
+
126
  *********************************************************************************************/
127
  function odb_settings_link($links)
128
  {
129
  array_unshift($links, '<a href="options-general.php?page=rvg_odb_admin">Settings</a>');
130
  return $links;
131
+ } // odb_settings_link()
132
  add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link');
133
 
134
 
140
  function rvg_odb_admin_bar()
141
  { global $wp_admin_bar;
142
  if (!is_super_admin() || !is_admin_bar_showing()) return;
143
+
144
  $siteurl = site_url('/');
145
  $wp_admin_bar->add_menu(
146
  array(
147
  'id' => 'optimize',
148
  'title' => __('Optimize DB (1 click)','rvg-optimize-database'),
149
  'href' => $siteurl.'wp-admin/tools.php?page=rvg-optimize-db.php&action=run' ));
150
+ } // rvg_odb_admin_bar()
151
+ $rvg_odb_adminbar = rvg_odb_get_option('rvg_odb_adminbar');
152
  if($rvg_odb_adminbar == "Y") add_action('wp_before_admin_bar_render', 'rvg_odb_admin_bar');
153
 
154
 
159
  *********************************************************************************************/
160
  function odb_styles()
161
  { wp_enqueue_style ('odb', plugin_dir_url(__FILE__) . 'css/style.css',false,'1.0','all');
162
+ } // odb_styles()
163
  add_action( 'admin_init', 'odb_styles' );
164
 
165
 
170
  http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
171
 
172
  *********************************************************************************************/
173
+ function rvg_extra_schedules($schedules)
174
+ { // ADD A WEEKLY SCHEDULE
175
  $schedules['weekly'] = array(
176
  'interval' => 604800,
177
  'display' => __('Once Weekly')
178
  );
179
  return $schedules;
180
+ } // rvg_extra_schedules()
181
  add_filter( 'cron_schedules', 'rvg_extra_schedules' );
182
 
183
  add_action( 'rvg_optimize_database', 'rvg_optimize_db_cron' );
187
  function rvg_deactivate_plugin()
188
  { // CLEAR CURRENT SCHEDULE (IF ANY)
189
  wp_clear_scheduled_hook('rvg_optimize_database');
190
+ } // rvg_deactivate_plugin()
191
 
192
  // RE-SCHEDULE TASK WHEN RE-ACTIVATED (OR AFTER UPDATE)
193
  register_activation_hook( __FILE__, 'rvg_activate_plugin' );
194
  function rvg_activate_plugin()
195
+ { $rvg_odb_schedule = rvg_odb_get_option('rvg_odb_schedule');
196
  if($rvg_odb_schedule)
197
  { // PLUGIN RE-ACTIVATED: START SCHEDULER
198
  if( !wp_next_scheduled( 'rvg_optimize_database' ))
199
  wp_schedule_event( time(), $rvg_odb_schedule, 'rvg_optimize_database' );
200
  }
201
+ } // rvg_activate_plugin()
202
+
203
+
204
+ /********************************************************************************************
205
+
206
+ GET NETWORK INFORMATION (MULTISITE)
207
+
208
+ Since: v3.3
209
+
210
+ *********************************************************************************************/
211
+ function rvg_odb_network_info()
212
+ {
213
+ global $wpdb, $odb_ms_prefixes, $odb_ms_blogids;
214
+
215
+ // v3.2 - GET MULTISITE INFORMATION
216
+ $odb_ms_prefixes[0] = $wpdb->base_prefix;
217
+ $odb_ms_blogids[0] = 1;
218
+ if (function_exists('is_multisite') && is_multisite())
219
+ { $odb_blogids = $wpdb->get_col("SELECT blog_id FROM ".$wpdb->base_prefix."blogs");
220
+ // FOR INSTANCE: mywp_2_, mywp_3_ etc.
221
+ for($i=1; $i<count($odb_blogids); $i++)
222
+ { $odb_ms_prefixes[$i] = $wpdb->base_prefix.$odb_blogids[$i].'_';
223
+ $odb_ms_blogids[$i] = $odb_blogids[$i];
224
+ }
225
+ } // if (function_exists('is_multisite') && is_multisite())
226
+ } // rvg_odb_network_info()
227
+
228
+
229
+ /********************************************************************************************
230
+
231
+ GET AN OPTION FROM THE ROOT SITE OPTION TABLE
232
+
233
+ *********************************************************************************************/
234
+ function rvg_odb_get_option($option)
235
+ {
236
+ global $wpdb;
237
+
238
+ $sql = "
239
+ SELECT `option_value`
240
+ FROM ".$wpdb->base_prefix."options
241
+ WHERE `option_name` = '".$option."'
242
+ ";
243
+ $res = $wpdb->get_results($sql);
244
+
245
+ if(isset($res[0]->option_value)) return $res[0]->option_value;
246
+ return '';
247
+ } // rvg_odb_get_option()
248
+
249
+
250
+ /********************************************************************************************
251
+
252
+ SAVE AN OPTION TO THE ROOT SITE OPTION TABLE
253
+
254
+ *********************************************************************************************/
255
+ function rvg_odb_update_option($option, $value)
256
+ {
257
+ global $wpdb;
258
+
259
+ $sql = "
260
+ SELECT COUNT(*) cnt
261
+ FROM ".$wpdb->base_prefix."options
262
+ WHERE `option_name` = '".$option."'
263
+ ";
264
+ $res = $wpdb->get_results($sql);
265
+
266
+ if(isset($res[0]->cnt) && $res[0]->cnt > 0)
267
+ { $sql = "
268
+ UPDATE ".$wpdb->base_prefix."options
269
+ SET `option_value` = '".$value."'
270
+ WHERE `option_name` = '".$option."'
271
+ ";
272
+ }
273
+ else
274
+ { $sql = "
275
+ INSERT INTO ".$wpdb->base_prefix."options
276
+ (option_name, option_value)
277
+ VALUES
278
+ ( '".$option."',
279
+ '".$value."'
280
+ )
281
+ ";
282
+ }
283
+ $wpdb->get_results($sql);
284
+
285
+ return;
286
+ } // rvg_odb_update_option()
287
 
288
 
289
  /********************************************************************************************
293
  *********************************************************************************************/
294
  function rvg_odb_settings_page()
295
  {
296
+ global $odb_version, $odb_release_date, $wpdb, $table_prefix, $odb_ms_prefixes;
297
+
298
+ // v3.3 - GET NETWORK INFORMATION (MULTISITE)
299
+ rvg_odb_network_info();
300
+
301
+ // v3.3 - GET THE OPTIONS FROM THE TABLES OF THE MAIN SITE (IN CASE OF MULTISITE)
302
+ // if(function_exists('switch_to_blog')) switch_to_blog(1);
303
 
304
  $timezone_format = _x('YmdGis', 'timezone date format');
305
  $current_datetime = date_i18n($timezone_format);
314
  {
315
  // v2.8.3
316
  check_admin_referer('odb_action', 'odb_nonce');
317
+
318
+ # DELETE ALL EXCLUDED TABLES (FROM THE ROOT OPTIONS TABLE)
319
  $sql = "
320
+ DELETE FROM ".$wpdb->base_prefix."options
321
  WHERE `option_name` LIKE 'rvg_ex_%'
322
  ";
323
  $wpdb->get_results($sql);
325
  # ADD EXCLUDED TABLES
326
  foreach ($_POST as $key => $value)
327
  { if(substr($key,0,3) == 'cb_')
328
+ rvg_odb_update_option('rvg_ex_'.substr($key,3).'', 'excluded');
 
 
 
 
 
329
  }
330
 
331
  if(isset($_POST['rvg_odb_number']))
332
  { $rvg_odb_number = trim($_POST['rvg_odb_number']);
333
+ rvg_odb_update_option('rvg_odb_number', $rvg_odb_number);
334
  }
335
 
336
  $rvg_clear_trash = 'N';
337
  if(isset($_POST['rvg_clear_trash']))
338
  $rvg_clear_trash = $_POST['rvg_clear_trash'];
339
+ rvg_odb_update_option('rvg_clear_trash', $rvg_clear_trash);
340
 
341
  $rvg_clear_spam = 'N';
342
  if(isset($_POST['rvg_clear_spam']))
343
  $rvg_clear_spam = $_POST['rvg_clear_spam'];
344
+ rvg_odb_update_option('rvg_clear_spam', $rvg_clear_spam);
345
 
346
  $rvg_clear_tags = 'N';
347
  if(isset($_POST['rvg_clear_tags']))
348
  $rvg_clear_tags = $_POST['rvg_clear_tags'];
349
+ rvg_odb_update_option('rvg_clear_tags', $rvg_clear_tags);
350
 
351
  $rvg_clear_transients = 'N';
352
  if(isset($_POST['rvg_clear_transients']))
353
  $rvg_clear_transients = $_POST['rvg_clear_transients'];
354
+ rvg_odb_update_option('rvg_clear_transients', $rvg_clear_transients);
355
 
356
  // v3.1
357
  $rvg_clear_pingbacks = 'N';
358
  if(isset($_POST['rvg_clear_pingbacks']))
359
  $rvg_clear_pingbacks = $_POST['rvg_clear_pingbacks'];
360
+ rvg_odb_update_option('rvg_clear_pingbacks', $rvg_clear_pingbacks);
361
 
362
  $rvg_odb_adminbar = 'N';
363
  if(isset($_POST['rvg_odb_adminbar']))
364
  $rvg_odb_adminbar = $_POST['rvg_odb_adminbar'];
365
+ rvg_odb_update_option('rvg_odb_adminbar', $rvg_odb_adminbar);
366
 
367
  // v3.1.3
368
  $rvg_odb_adminmenu = 'N';
369
  if(isset($_POST['rvg_odb_adminmenu']))
370
  $rvg_odb_adminmenu = $_POST['rvg_odb_adminmenu'];
371
+ rvg_odb_update_option('rvg_odb_adminmenu', $rvg_odb_adminmenu);
372
 
373
  $rvg_odb_logging_on = 'N';
374
  if(isset($_POST['rvg_odb_logging_on']))
375
  $rvg_odb_logging_on = $_POST['rvg_odb_logging_on'];
376
+ rvg_odb_update_option('rvg_odb_logging_on', $rvg_odb_logging_on);
377
 
378
  $rvg_odb_schedule = '';
379
  if(isset($_POST['rvg_odb_schedule']))
380
  $rvg_odb_schedule = $_POST['rvg_odb_schedule'];
381
+ rvg_odb_update_option('rvg_odb_schedule', $rvg_odb_schedule);
382
 
383
  $rvg_odb_schedulehour = '';
384
  if(isset($_POST['rvg_odb_schedulehour']))
385
  $rvg_odb_schedulehour = $_POST['rvg_odb_schedulehour'];
386
+ rvg_odb_update_option('rvg_odb_schedulehour', $rvg_odb_schedulehour);
387
 
388
  // CLEAR CURRENT SCHEDULE (IF ANY)
389
  wp_clear_scheduled_hook('rvg_optimize_database');
415
  echo "<div class='updated odb-bold'><p>".
416
  __('Optimize Database after Deleting Revisions SETTINGS UPDATED','rvg-optimize-database').
417
  " - ";
418
+ _e('Click <a href="tools.php?page=rvg-optimize-db.php" class="odb-bold">HERE</a> to run the optimization','rvg-optimize-database');
419
  echo "</p></div>";
420
+ } // if (isset($_POST['info_update']))
421
 
422
+ $rvg_odb_number = rvg_odb_get_option('rvg_odb_number');
423
  if(!$rvg_odb_number) $rvg_odb_number = '0';
424
 
425
+ $rvg_clear_trash = rvg_odb_get_option('rvg_clear_trash');
426
  if(!$rvg_clear_trash) $rvg_clear_trash = 'N';
427
 
428
+ $rvg_clear_spam = rvg_odb_get_option('rvg_clear_spam');
429
  if(!$rvg_clear_spam) $rvg_clear_spam = 'N';
430
 
431
+ $rvg_clear_tags = rvg_odb_get_option('rvg_clear_tags');
432
  if(!$rvg_clear_tags) $rvg_clear_tags = 'N';
433
 
434
+ $rvg_clear_transients = rvg_odb_get_option('rvg_clear_transients');
435
  if(!$rvg_clear_transients) $rvg_clear_transients = 'N';
436
 
437
  // v3.1
438
+ $rvg_clear_pingbacks = rvg_odb_get_option('rvg_clear_pingbacks');
439
  if(!$rvg_clear_pingbacks) $rvg_clear_pingbacks = 'N';
440
 
441
+ $rvg_odb_logging_on = rvg_odb_get_option('rvg_odb_logging_on');
442
  if(!$rvg_odb_logging_on) $rvg_odb_logging_on = 'N';
443
 
444
+ $rvg_odb_schedule = rvg_odb_get_option('rvg_odb_schedule');
445
  if(!$rvg_odb_schedule) $rvg_odb_schedule = '';
446
 
447
+ $rvg_odb_schedulehour = rvg_odb_get_option('rvg_odb_schedulehour');
448
 
449
+ $rvg_odb_adminbar = rvg_odb_get_option('rvg_odb_adminbar');
450
  if(!$rvg_odb_adminbar) $rvg_odb_adminbar = 'N';
451
 
452
+ $rvg_odb_adminmenu = rvg_odb_get_option('rvg_odb_adminmenu');
453
+ if(!$rvg_odb_adminmenu) $rvg_odb_adminmenu = 'N';
454
+
455
  ?>
456
  <script type="text/javascript">
457
  function schedule_changed()
468
  <?php // v2.8.3 ?>
469
  <?php wp_nonce_field( 'odb_action','odb_nonce' ); ?>
470
  <div class="wrap">
471
+ <h2>
472
+ <?php _e('Using Optimize Database after Deleting Revisions', 'rvg-optimize-database'); ?>
473
+ </h2>
474
  <blockquote>
475
+ <p class="odb-bold">'<span class="odb-italic">Optimize Database after Deleting Revisions</span> '
476
+ <?php _e('is an one-click plugin to clean and optimize your WordPress database','rvg-optimize-database');?>
477
+ </p>
478
+ <p>
479
+ <?php _e('Plugin version:','rvg-optimize-database');?>
480
+ <br />
481
  <span class="odb-bold">v<?php echo $odb_version ?> (<?php echo $odb_release_date?>)</span></p>
482
+ <p><span class="odb-bold">
483
+ <?php _e('Author','rvg-optimize-database');?>
484
+ :</span><br />
485
+ <span class="odb-bold"><a href="http://cagewebdev.com/" target="_blank">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank">Rolf van Gelder</a></span>, Eindhoven,
486
+ <?php _e('The Netherlands','rvg-optimize-database');?>
487
+ <br />
488
+ <span class="odb-bold">
489
+ <?php _e('Plugin URL:','rvg-optimize-database');?>
490
+ </span><br />
491
  <a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank"><span class="odb-bold">http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/</span></a><br />
492
+ <span class="odb-bold">
493
+ <?php _e('Download URL:','rvg-optimize-database');?>
494
+ </span><br />
495
  <span class="odb-bold"><a href="https://wordpress.org/plugins/rvg-optimize-database/" target="_blank">https://wordpress.org/plugins/rvg-optimize-database/</a></span></p>
496
  <p>&nbsp;</p>
497
  </blockquote>
498
+ <h2>
499
+ <?php _e('Optimize Database after Deleting Revisions - Settings','rvg-optimize-database');?>
500
+ </h2>
501
  <?php
502
  if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"'; else $rvg_odb_adminbar_checked = '';
503
  if($rvg_odb_adminmenu == 'Y') $rvg_odb_adminmenu_checked = ' checked="checked"'; else $rvg_odb_adminmenu_checked = '';
515
  <tr>
516
  <td colspan="3" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="4">
517
  <tr>
518
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
519
+ <?php _e('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>
520
+ <br />
521
+ <?php _e('(\'0\' means: delete <u>ALL</u> revisions)','rvg-optimize-database');?>
522
+ </span></td>
523
  <td width="50%" valign="top"><input type="text" size="5" name="rvg_odb_number" id="rvg_odb_number" value="<?php echo $rvg_odb_number?>" class="odb-bold odb-blue" /></td>
524
  </tr>
525
  <tr>
526
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
527
+ <?php _e('Delete all trashed items','rvg-optimize-database');?>
528
+ </span></td>
529
  <td width="50%" valign="top"><input name="rvg_clear_trash" type="checkbox" value="Y" <?php echo $rvg_clear_trash_checked?> /></td>
530
  </tr>
531
  <tr>
532
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
533
+ <?php _e('Delete all spammed items','rvg-optimize-database');?>
534
+ </span></td>
535
  <td width="50%" valign="top"><input name="rvg_clear_spam" type="checkbox" value="Y" <?php echo $rvg_clear_spam_checked?> /></td>
536
  </tr>
537
  <tr>
538
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
539
+ <?php _e('Delete unused tags','rvg-optimize-database');?>
540
+ </span></td>
541
  <td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
542
  </tr>
543
  <tr>
544
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
545
+ <?php _e('Delete expired transients','rvg-optimize-database');?>
546
+ </span></td>
547
  <td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
548
  </tr>
549
  <tr>
550
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
551
+ <?php _e('Delete pingbacks and trackbacks','rvg-optimize-database');?>
552
+ </span></td>
553
  <td width="50%" valign="top"><input name="rvg_clear_pingbacks" type="checkbox" value="Y" <?php echo $rvg_clear_pingbacks_checked?> /></td>
554
  </tr>
555
  <tr>
556
+ <td width="50%" align="right" valign="top"><span class="odb-bold">
557
+ <?php _e('Keep a log','rvg-optimize-database');?>
558
+ </span></td>
559
  <td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
560
  </tr>
561
  <tr>
562
+ <td width="50%" align="right"><span class="odb-bold">
563
+ <?php _e('Scheduler','rvg-optimize-database');?>
564
+ </span></td>
565
+ <td width="50%"><select name="rvg_odb_schedule" id="rvg_odb_schedule" class="odb-schedule-select" onchange="schedule_changed();">
566
+ <option selected="selected" value="">
567
+ <?php _e('NOT SCHEDULED','rvg-optimize-database');?>
568
+ </option>
569
+ <option value="hourly">
570
+ <?php _e('run optimization HOURLY','rvg-optimize-database');?>
571
+ </option>
572
+ <option value="twicedaily">
573
+ <?php _e('run optimization TWICE A DAY','rvg-optimize-database');?>
574
+ </option>
575
+ <option value="daily">
576
+ <?php _e('run optimization DAILY','rvg-optimize-database');?>
577
+ </option>
578
+ <option value="weekly">
579
+ <?php _e('run optimization WEEKLY','rvg-optimize-database');?>
580
+ </option>
581
  <?php /*?><option value="test">run optimization TEST</option><?php */?>
582
  </select>
583
  <script type="text/javascript">
584
  jQuery("#rvg_odb_schedule").val('<?php echo $rvg_odb_schedule; ?>');
585
  </script>
586
+ <span id="schedulehour" class="odb-schedulehour"> <span class="odb-bold">
587
+ <?php _e('Time','rvg-optimize-database');?>
588
+ </span>
589
+ <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour" class="odb-schedulehour-select">
590
  <?php
591
  for($i=0; $i<=23; $i++)
592
  { if($i<10) $i = '0'.$i;
603
  <script type="text/javascript">schedule_changed();</script></td>
604
  </tr>
605
  <tr>
606
+ <td align="right" valign="top"><span class="odb-bold">
607
+ <?php _e('Show \'1-click\' link in Admin Bar','rvg-optimize-database');?>
608
+ </span></td>
609
  <td valign="top"><input name="rvg_odb_adminbar" type="checkbox" value="Y" <?php echo $rvg_odb_adminbar_checked?> />
610
+ <?php _e('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
611
  </tr>
612
  <tr>
613
+ <td align="right" valign="top"><span class="odb-bold">
614
+ <?php _e('Show an icon in the Admin Menu','rvg-optimize-database');?>
615
+ </span></td>
616
  <td valign="top"><input name="rvg_odb_adminmenu" type="checkbox" value="Y" <?php echo $rvg_odb_adminmenu_checked?> />
617
+ <?php _e('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
618
  </tr>
619
  </table></td>
620
  </tr>
624
  # v2.8.3 $ replaced by jQuery
625
  ?>
626
  <tr>
627
+ <td colspan="4" valign="top">
628
+ <table id="odb-table-excludes" class="odb-table-excludes" align="center" border="0">
629
  <tr>
630
+ <td colspan="4" align="center"><span class="odb-bold">
631
+ <?php _e('EXCLUDE DATABASE TABLES FROM OPTIMIZATION: <span class="odb-underline-red">CHECKED</span> TABLES <span class="odb-underline-red">WON\'T</span> BE OPTIMIZED!</span>','rvg-optimize-database');?>
632
+ <br />
633
+ <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',true);">
634
+ <?php _e('check all tables','rvg-optimize-database');?>
635
+ </a> | <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',false);">
636
+ <?php _e('uncheck all tables','rvg-optimize-database');?>
637
+ </a> | <a href="javascript:;" onclick="jQuery(':not([id^=cb_<?php echo $odb_ms_prefixes[0]; ?>])').filter('[id^=cb_]').attr('checked',true);">
638
+ <?php _e('check all NON-WordPress tables','rvg-optimize-database');?>
639
+ </a></td>
640
  </tr>
641
  <tr>
642
  <?php
652
  echo '<tr>';
653
  }
654
  $class = '';
655
+ // WORDPRESS TABLE? v3.3 (MULTISITE)
656
+ for($j=0; $j<count($odb_ms_prefixes); $j++)
657
+ if(substr($tables[$i][0], 0, strlen($odb_ms_prefixes[$j])) == $odb_ms_prefixes[$j]) $class = 'class="odb-wp-table"';
658
 
659
  $cb_checked = '';
660
+ $excluded = rvg_odb_get_option('rvg_ex_'.$tables[$i][0].'');
661
+ if($excluded == 'excluded') $cb_checked = ' checked';
 
 
 
 
 
 
662
  echo '<td width="25%" '.$class.'><input id="cb_'.$tables[$i][0].'" name="cb_'.$tables[$i][0].'" type="checkbox" value="1" '.$cb_checked.' /> '.$tables[$i][0].'</td>'."\n";
663
  } # for ($i=0; $i<count($tables); $i++)
664
  ?>
669
  </fieldset>
670
  </blockquote>
671
  <p class="submit">
672
+ <input class="button-primary button-large" type='submit' name='info_update' value='<?php _e('Save Settings','rvg-optimize-database');?>' class="odb-bold" />
673
  &nbsp;
674
+ <input class="button odb-normal" type="button" name="optimizer" value="<?php _e('Go To Optimizer','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php'" />
675
  </p>
676
  </div>
677
  </form>
678
  </div>
679
  <!-- ocb-options-form -->
680
  <?php
681
+ } // rvg_odb_settings_page()
682
 
683
 
684
  /********************************************************************************************
689
  *********************************************************************************************/
690
  function rvg_optimize_db()
691
  {
692
+ global $wpdb, $odb_version, $odb_ms_prefixes;
693
+
694
+ // v3.3.3 - GET NETWORK INFORMATION (MULTISITE)
695
+ rvg_odb_network_info();
696
 
697
  // PAGE LOAD COUNTER
698
  $time = microtime();
700
  $time = $time[1] + $time[0];
701
  $odb_start_time = $time;
702
 
703
+ $timezone_format = _x('G:i', 'timezone date format');
704
+ $current_hour = date_i18n($timezone_format);
705
 
706
  if(isset($_REQUEST['action']))
707
  if($_REQUEST['action'] == "delete_log")
714
  ******************************************************************************************/
715
 
716
  // GET SETTINGS AND SET DEFAULT VALUES
717
+ $max_revisions = rvg_odb_get_option('rvg_odb_number');
718
  if(!$max_revisions)
719
  { $max_revisions = 0;
720
+ rvg_odb_update_option('rvg_odb_number', $max_revisions);
721
  }
722
 
723
+ $clear_trash = rvg_odb_get_option('rvg_clear_trash');
724
  if(!$clear_trash)
725
  { $clear_trash = 'N';
726
+ rvg_odb_update_option('rvg_clear_trash', $clear_trash);
727
  }
728
  $clear_trash_yn = ($clear_trash == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
729
 
730
+ $clear_spam = rvg_odb_get_option('rvg_clear_spam');
731
  if(!$clear_spam)
732
  { $clear_spam = 'N';
733
+ rvg_odb_update_option('rvg_clear_spam', $clear_spam);
734
  }
735
  $clear_spam_yn = ($clear_spam == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
736
 
737
+ $clear_tags = rvg_odb_get_option('rvg_clear_tags');
738
  if(!$clear_tags)
739
  { $clear_tags = 'N';
740
+ rvg_odb_update_option('rvg_clear_tags', $clear_tags);
741
  }
742
  $clear_tags_yn = ($clear_tags == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
743
 
744
+ $clear_transients = rvg_odb_get_option('rvg_clear_transients');
745
  if(!$clear_transients)
746
  { $clear_transients = 'N';
747
+ rvg_odb_update_option('rvg_clear_transients', $clear_transients);
748
  }
749
  $clear_transients_yn = ($clear_transients == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
750
 
751
  // v3.1
752
+ $clear_pingbacks = rvg_odb_get_option('rvg_clear_pingbacks');
753
  if(!$clear_pingbacks)
754
  { $clear_pingbacks = 'N';
755
+ rvg_odb_update_option('rvg_clear_pingbacks', $clear_pingbacks);
756
  }
757
  $clear_pingbacks_yn = ($clear_pingbacks == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
758
 
759
+ $rvg_odb_logging_on = rvg_odb_get_option('rvg_odb_logging_on');
760
  if(!$rvg_odb_logging_on)
761
  { $rvg_odb_logging_on = 'N';
762
+ rvg_odb_update_option('rvg_odb_logging_on', $rvg_odb_logging_on);
763
  }
764
  $rvg_odb_logging_on_yn = ($rvg_odb_logging_on == 'N') ? __('NO','rvg-optimize-database') : __('YES','rvg-optimize-database');
765
 
766
+ $rvg_odb_schedule = rvg_odb_get_option('rvg_odb_schedule');
767
  if(!$rvg_odb_schedule)
768
  { $rvg_odb_schedule = '';
769
+ rvg_odb_update_option('rvg_odb_schedule', $rvg_odb_schedule);
770
  }
771
 
772
  if($rvg_odb_schedule == 'hourly')
789
  $nextrun = date_i18n('M j, Y @ G:i', $timestamp);
790
  }
791
 
792
+ $total_savings = rvg_odb_get_option('rvg_odb_total_savings');
793
 
794
  $log_url = plugins_url().'/rvg-optimize-database/rvg-optimize-db-log.html';
795
 
796
  $sql = "
797
  SELECT COUNT(*) cnt
798
+ FROM $wpdb->options
799
+ WHERE option_name LIKE 'rvg_ex_%'
800
  ";
801
  $results = $wpdb->get_results($sql);
802
  $number_excluded = $results[0]->cnt;
803
  ?>
804
  <div class="odb-padding-left">
805
+ <h2>
806
+ <?php _e('Optimize your WordPress Database','rvg-optimize-database');?>
807
+ </h2>
808
  <?php
809
  if(isset($_REQUEST['action']))
810
  if($_REQUEST['action'] == "delete_log")
811
  echo '<div class="updated odb-updated"><p><span class="odb-bold">Optimize Database after Deleting Revisions - LOG FILE DELETED</span></p></div>';
812
  ?>
813
+ <p><span class="odb-italic"><a href="http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/" target="_blank" class="odb-bold">Optimize Database after Deleting Revisions v<?php echo $odb_version?></a> -
814
+ <?php _e('A WordPress Plugin by','rvg-optimize-database');?>
815
+ <a href="http://cagewebdev.com/" target="_blank" class="odb-bold">CAGE Web Design</a> | <a href="http://rvg.cage.nl/" target="_blank" class="odb-bold">Rolf van Gelder</a>, Eindhoven,
816
+ <?php _e('The Netherlands','rvg-optimize-database');?>
817
+ </span></p>
818
+ <p>
819
+ <?php _e('Current settings','rvg-optimize-database');?>
820
+ :<br />
821
+ <span class="odb-bold">
822
+ <?php _e('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>
823
+ :</span> <span class="odb-bold odb-blue"><?php echo $max_revisions?></span><br />
824
+ <span class="odb-bold">
825
+ <?php _e('Delete all trashed items','rvg-optimize-database');?>
826
+ :</span> <span class="odb-bold odb-blue"><?php echo $clear_trash_yn?></span><br />
827
+ <span class="odb-bold">
828
+ <?php _e('Delete all spammed items','rvg-optimize-database');?>
829
+ :</span> <span class="odb-bold odb-blue"><?php echo $clear_spam_yn?></span><br />
830
+ <span class="odb-bold">
831
+ <?php _e('Delete unused tags','rvg-optimize-database');?>
832
+ :</span> <span class="odb-bold odb-blue"><?php echo $clear_tags_yn?></span><br />
833
+ <span class="odb-bold">
834
+ <?php _e('Delete expired transients','rvg-optimize-database');?>
835
+ :</span> <span class="odb-bold odb-blue"><?php echo $clear_transients_yn?></span><br />
836
+ <span class="odb-bold">
837
+ <?php _e('Delete pingbacks and trackbacks','rvg-optimize-database');?>
838
+ :</span> <span class="odb-bold odb-blue"><?php echo $clear_pingbacks_yn?></span><br />
839
+ <span class="odb-bold">
840
+ <?php _e('Keep a log','rvg-optimize-database');?>
841
+ :</span> <span class="odb-bold odb-blue"><?php echo $rvg_odb_logging_on_yn?></span><br />
842
+ <span class="odb-bold">
843
+ <?php _e('Number of excluded tables','rvg-optimize-database');?>
844
+ :</span> <span class="odb-bold odb-blue"><?php echo $number_excluded?></span><br />
845
+ <span class="odb-bold">
846
+ <?php _e('Scheduler','rvg-optimize-database');?>
847
+ :</span> <span class="odb-bold odb-blue"><?php echo $rvg_odb_schedule_txt?></span>
848
  <?php
849
  if($nextrun)
850
  {
851
  ?>
852
  <br />
853
+ <span class="odb-bold">
854
+ <?php _e('Next scheduled run','rvg-optimize-database');?>
855
+ :</span> <span class="odb-bold odb-blue"><?php echo $nextrun?> hrs (current server time: <?php echo $current_hour?>)</span>
856
  <?php
857
  }
858
  if($total_savings)
859
  {
860
  ?>
861
  <br />
862
+ <span class="odb-bold">
863
+ <?php _e('Total savings since the first run','rvg-optimize-database');?>
864
+ :</span> <span class="odb-bold odb-blue"><?php echo rvg_format_size($total_savings); ?></span>
865
  <?php
866
  }
867
  ?>
868
  <p class="submit">
869
+ <input class="button odb-normal" type="button" name="change_options" value="<?php _e('Change Settings','rvg-optimize-database');?>" onclick="self.location='options-general.php?page=rvg_odb_admin'" />
870
  <?php
871
  if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
872
  {
873
  ?>
874
  &nbsp;
875
+ <input class="button odb-normal" type="button" name="view_log" value="<?php _e('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" />
876
  &nbsp;
877
+ <input class="button odb-normal" type="button" name="delete_log" value="<?php _e('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" />
878
  <?php
879
  }
880
  $action = '';
883
  {
884
  ?>
885
  &nbsp;
886
+ <input class="button-primary button-large" type="button" name="start_optimization" value="<?php _e('Start Optimization','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=run'" class="odb-bold" />
887
  <?php
888
  }
889
  ?>
894
  if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
895
  if($action != 'run') return;
896
  ?>
897
+ <h2 class="odb-padding-left">
898
+ <?php _e('Starting Optimization','rvg-optimize-database');?>
899
+ ...</h2>
900
  <?php
901
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
902
  $start_size = rvg_get_db_size();
915
  ?>
916
  <table border="0" cellspacing="8" cellpadding="2">
917
  <tr>
918
+ <td colspan="4" class="odb-bold odb-blue"><?php _e('DELETING REVISIONS','rvg-optimize-database');?>
919
+ :</td>
920
  </tr>
921
  <tr>
922
  <th align="right" class="odb-border-bottom">#</th>
923
+ <th align="left" class="odb-border-bottom"><?php _e('prefix', 'rvg-optimize-database');?></th>
924
+ <th align="left" class="odb-border-bottom"><?php _e('post / page','rvg-optimize-database');?></th>
925
+ <th align="left" class="odb-border-bottom"><?php _e('revision date','rvg-optimize-database');?></th>
926
+ <th align="right" class="odb-border-bottom"><?php _e('revisions deleted','rvg-optimize-database');?></th>
927
  </tr>
928
  <?php
929
  // LOOP THROUGH THE REVISIONS AND DELETE THEM
930
  $total_deleted = rvg_delete_revisions($results, true, $max_revisions);
931
  ?>
932
  <tr>
933
+ <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of revisions deleted','rvg-optimize-database');?></td>
934
  <td align="right" class="odb-border-top odb-bold"><?php echo $total_deleted?></td>
935
  </tr>
936
  </table>
941
  ?>
942
  <table border="0" cellspacing="8" cellpadding="2">
943
  <tr>
944
+ <td class="odb-not-found"><?php _e('No REVISIONS found to delete','rvg-optimize-database');?>
945
+ ...</td>
946
  </tr>
947
  </table>
948
  <?php
951
  // NUMBER OF DELETED REVISIONS FOR LOG FILE
952
  $log_arr["revisions"] = $total_deleted;
953
 
954
+
955
  /****************************************************************************************
956
 
957
  DELETE TRASHED ITEMS
969
  <div class="odb-separator"></div>
970
  <table border="0" cellspacing="8" cellpadding="2">
971
  <tr>
972
+ <td colspan="4" class="odb-found"><?php _e('DELETING TRASHED ITEMS','rvg-optimize-database');?>
973
+ :</td>
974
  </tr>
975
  <tr>
976
  <th align="right" class="odb-border-bottom">#</th>
977
+ <th align="left" class="odb-border-bottom"><?php _e('prefix', 'rvg-optimize-database');?></th>
978
+ <th align="left" class="odb-border-bottom"><?php _e('type','rvg-optimize-database');?></th>
979
+ <th align="left" class="odb-border-bottom"><?php _e('IP address / title','rvg-optimize-database');?></th>
980
+ <th align="left" nowrap="nowrap" class="odb-border-bottom"><?php _e('date','rvg-optimize-database');?></th>
981
  </tr>
982
  <?php
983
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
992
  <div class="odb-separator"></div>
993
  <table border="0" cellspacing="8" cellpadding="2">
994
  <tr>
995
+ <td class="odb-not-found"><?php _e('No TRASHED ITEMS found to delete','rvg-optimize-database');?>
996
+ ...</td>
997
  </tr>
998
  </table>
999
  <?php
1001
 
1002
  // NUMBER OF DELETED TRASH FOR LOG FILE
1003
  $log_arr["trash"] = $total_deleted;
 
1004
  } // if($clear_trash == 'Y')
1005
+
1006
 
1007
  /****************************************************************************************
1008
 
1021
  <div class="odb-separator"></div>
1022
  <table border="0" cellspacing="8" cellpadding="2">
1023
  <tr>
1024
+ <td colspan="4" class="odb-found"><?php _e('DELETING SPAMMED ITEMS','rvg-optimize-database');?>
1025
+ :</td>
1026
  </tr>
1027
  <tr>
1028
  <th align="right" class="odb-border-bottom">#</th>
1029
+ <th align="left" class="odb-border-bottom"><?php _e('prefix', 'rvg-optimize-database');?></th>
1030
+ <th align="left" class="odb-border-bottom"><?php _e('comment author','rvg-optimize-database');?></th>
1031
+ <th align="left" class="odb-border-bottom"><?php _e('comment author email','rvg-optimize-database');?></th>
1032
+ <th align="left" nowrap="nowrap" class="odb-border-bottom"><?php _e('comment date','rvg-optimize-database');?></th>
1033
  </tr>
1034
  <?php
1035
  // LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
1044
  <div class="odb-separator"></div>
1045
  <table border="0" cellspacing="8" cellpadding="2">
1046
  <tr>
1047
+ <td class="odb-not-found"><?php _e('No SPAMMED ITEMS found to delete','rvg-optimize-database');?>
1048
+ ...</td>
1049
  </tr>
1050
  </table>
1051
  <?php
1055
 
1056
  // NUMBER OF SPAM DELETED FOR LOG FILE
1057
  $log_arr["spam"] = $total_deleted;
1058
+
1059
 
1060
  /****************************************************************************************
1061
 
1073
  <div class="odb-separator"></div>
1074
  <table border="0" cellspacing="8" cellpadding="2">
1075
  <tr>
1076
+ <td><span class="odb-found">
1077
+ <?php _e('NUMBER OF UNUSED TAGS DELETED','rvg-optimize-database');?>
1078
+ :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1079
  </tr>
1080
  </table>
1081
  <?php
1086
  <div class="odb-separator"></div>
1087
  <table border="0" cellspacing="8" cellpadding="2">
1088
  <tr>
1089
+ <td class="odb-not-found"><?php _e('No UNUSED TAGS found to delete','rvg-optimize-database');?>
1090
+ ...</td>
1091
  </tr>
1092
  </table>
1093
  <?php
1098
  // NUMBER OF tags DELETED FOR LOG FILE
1099
  $log_arr["tags"] = $total_deleted;
1100
 
1101
+
1102
  /****************************************************************************************
1103
 
1104
  DELETE EXPIRED TRANSIENTS
1115
  <div class="odb-separator"></div>
1116
  <table border="0" cellspacing="8" cellpadding="2">
1117
  <tr>
1118
+ <td><span class="odb-found">
1119
+ <?php _e('NUMBER OF EXPIRED TRANSIENTS DELETED','rvg-optimize-database');?>
1120
+ :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1121
  </tr>
1122
  </table>
1123
  <?php
1128
  <div class="odb-separator"></div>
1129
  <table border="0" cellspacing="8" cellpadding="2">
1130
  <tr>
1131
+ <td class="odb-not-found"><?php _e('No EXPIRED TRANSIENTS found to delete','rvg-optimize-database');?>
1132
+ ...</td>
1133
  </tr>
1134
  </table>
1135
  <?php
1156
  <div class="odb-separator"></div>
1157
  <table border="0" cellspacing="8" cellpadding="2">
1158
  <tr>
1159
+ <td><span class="odb-found">
1160
+ <?php _e('NUMBER OF PINGBACKS AND TRACKBACKS DELETED','rvg-optimize-database');?>
1161
+ :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1162
  </tr>
1163
  </table>
1164
  <?php
1169
  <div class="odb-separator"></div>
1170
  <table border="0" cellspacing="8" cellpadding="2">
1171
  <tr>
1172
+ <td class="odb-not-found"><?php _e('No PINGBACKS nor TRACKBACKS found to delete','rvg-optimize-database');?>
1173
+ ...</td>
1174
  </tr>
1175
  </table>
1176
  <?php
1194
  <div class="odb-separator"></div>
1195
  <table border="0" cellspacing="8" cellpadding="2">
1196
  <tr>
1197
+ <td colspan="4"><span class="odb-found">
1198
+ <?php _e('NUMBER OF POSTMETA ORPHANS DELETED','rvg-optimize-database');?>
1199
+ :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1200
  </tr>
1201
  </table>
1202
  <?php
1207
  <div class="odb-separator"></div>
1208
  <table border="0" cellspacing="8" cellpadding="2">
1209
  <tr>
1210
+ <td class="odb-not-found"><?php _e('No POSTMETA ORPHANS found to delete','rvg-optimize-database');?>
1211
+ ...</td>
1212
  </tr>
1213
  </table>
1214
  <?php
1226
  <div class="odb-optimizing-table">
1227
  <table border="0" cellspacing="8" cellpadding="2">
1228
  <tr>
1229
+ <td colspan="4" class="odb-bold odb-blue"><?php _e('OPTIMIZING DATABASE TABLES','rvg-optimize-database');?>
1230
+ :</td>
1231
  </tr>
1232
  <tr>
1233
  <th class="odb-border-bottom" align="right">#</th>
1234
+ <th class="odb-border-bottom" align="left"><?php _e('table name','rvg-optimize-database');?></th>
1235
+ <th class="odb-border-bottom" align="left"><?php _e('optimization result','rvg-optimize-database');?></th>
1236
+ <th class="odb-border-bottom" align="left"><?php _e('engine','rvg-optimize-database');?></th>
1237
+ <th class="odb-border-bottom" align="right"><?php _e('table rows','rvg-optimize-database');?></th>
1238
+ <th class="odb-border-bottom" align="right"><?php _e('table size','rvg-optimize-database');?></th>
1239
  </tr>
1240
  <?php
1241
  # OPTIMIZE THE DATABASE TABLES
1255
  // WRITE RESULTS TO LOG FILE
1256
  rvg_write_log($log_arr);
1257
 
1258
+ $total_savings = rvg_odb_get_option('rvg_odb_total_savings');
1259
  $total_savings += ($start_size - $end_size);
1260
+ rvg_odb_update_option('rvg_odb_total_savings',$total_savings);
1261
  ?>
1262
  <div class="odb-separator"></div>
1263
+ <span class="odb-bold odb-blue odb-padding-left">
1264
+ <?php _e('SAVINGS','rvg-optimize-database');?>
1265
+ </span><br />
1266
  <table border="0" cellspacing="8" cellpadding="2">
1267
  <tr>
1268
  <th>&nbsp;</th>
1269
+ <th class="odb-border-bottom"><?php _e('size of the database','rvg-optimize-database');?></th>
1270
  </tr>
1271
  <tr>
1272
+ <td align="right"><?php _e('BEFORE optimization','rvg-optimize-database');?></td>
1273
  <td align="right" class="odb-bold"><?php echo rvg_format_size($start_size,3); ?></td>
1274
  </tr>
1275
  <tr>
1276
+ <td align="right"><?php _e('AFTER optimization','rvg-optimize-database');?></td>
1277
  <td align="right" class="odb-bold"><?php echo rvg_format_size($end_size,3); ?></td>
1278
  </tr>
1279
  <tr>
1280
+ <td align="right" class="odb-bold"><?php _e('SAVINGS THIS TIME','rvg-optimize-database');?></td>
1281
  <td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size(($start_size - $end_size),3); ?></td>
1282
  </tr>
1283
  <tr>
1284
+ <td align="right" class="odb-bold"><?php _e('TOTAL SAVINGS SINCE THE FIRST RUN','rvg-optimize-database');?></td>
1285
  <td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size($total_savings,3); ?></td>
1286
  </tr>
1287
  </table>
1292
  $time = explode(' ', $time);
1293
  $time = $time[1] + $time[0];
1294
  $finish = $time;
1295
+
1296
  $total_time = round(($finish - $odb_start_time), 4);
1297
  ?>
1298
+ <span class="odb-bold odb-blue odb-padding-left">
1299
+ <?php _e('DONE','rvg-optimize-database');?>
1300
+ !</span><br />
1301
  <br />
1302
+ <span class="odb-padding-left">
1303
+ <?php _e('Optimization took', 'rvg-optimize-database')?>
1304
+ &nbsp;<strong><?php echo $total_time;?></strong>&nbsp;
1305
+ <?php _e('seconds', 'rvg-optimize-database')?>
1306
+ .</span>
1307
  <?php
1308
  if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
1309
  {
1311
  <br />
1312
  <br />
1313
  &nbsp;
1314
+ <input class="button odb-normal" type="button" name="view_log" value="<?php _e('View Log File','rvg-optimize-database');?>" onclick="window.open('<?php echo $log_url?>')" />
1315
  &nbsp;
1316
+ <input class="button odb-normal" type="button" name="delete_log" value="<?php _e('Delete Log File','rvg-optimize-database');?>" onclick="self.location='tools.php?page=rvg-optimize-db.php&action=delete_log'" />
1317
  <?php
1318
  }
1319
+ } // rvg_optimize_db()
1320
 
1321
 
1322
  /********************************************************************************************
1329
  global $wpdb, $odb_version;
1330
 
1331
  // GET SETTINGS AND SET DEFAULT VALUES
1332
+ $max_revisions = rvg_odb_get_option('rvg_odb_number');
1333
  if(!$max_revisions)
1334
  { $max_revisions = 0;
1335
+ rvg_odb_update_option('rvg_odb_number', $max_revisions);
1336
  }
1337
 
1338
+ $clear_trash = rvg_odb_get_option('rvg_clear_trash');
1339
  if(!$clear_trash)
1340
  { $clear_trash = 'N';
1341
+ rvg_odb_update_option('rvg_clear_trash', $clear_trash);
1342
  }
1343
 
1344
+ $clear_spam = rvg_odb_get_option('rvg_clear_spam');
1345
  if(!$clear_spam)
1346
  { $clear_spam = 'N';
1347
+ rvg_odb_update_option('rvg_clear_spam', $clear_spam);
1348
  }
1349
 
1350
+ $clear_tags = rvg_odb_get_option('rvg_clear_tags');
1351
  if(!$clear_tags)
1352
  { $clear_tags = 'N';
1353
+ rvg_odb_update_option('rvg_clear_tags', $clear_tags);
1354
  }
1355
 
1356
+ $clear_transients = rvg_odb_get_option('rvg_clear_transients');
1357
  if(!$clear_transients)
1358
  { $clear_transients = 'N';
1359
+ rvg_odb_update_option('rvg_clear_transients', $clear_transients);
1360
  }
1361
 
1362
  // v3.1
1363
+ $clear_pingbacks = rvg_odb_get_option('rvg_clear_pingbacks');
1364
  if(!$clear_pingbacks)
1365
  { $clear_pingbacks = 'N';
1366
+ rvg_odb_update_option('rvg_clear_pingbacks', $clear_pingbacks);
1367
  }
1368
 
1369
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
1457
  // WRITE RESULTS TO LOG FILE
1458
  rvg_write_log($log_arr);
1459
 
1460
+ $total_savings = rvg_odb_get_option('rvg_odb_total_savings');
1461
  $total_savings += ($start_size - $end_size);
1462
+ rvg_odb_update_option('rvg_odb_total_savings',$total_savings);
1463
 
1464
+ } // rvg_optimize_db_cron()
1465
 
1466
 
1467
  /********************************************************************************************
1468
 
1469
  DELETE THE REVISIONS
1470
+
1471
+ v3.2: MULTISITE
1472
 
1473
  *********************************************************************************************/
1474
  function rvg_delete_revisions($results, $display, $max_revisions)
1479
  $total_deleted = 0;
1480
 
1481
  for($i=0; $i<count($results); $i++)
1482
+ { $nr_to_delete = $results[$i]['cnt'] - $max_revisions;
1483
  $total_deleted += $nr_to_delete;
1484
+
1485
  if($display)
1486
  {
1487
  ?>
1488
  <tr>
1489
  <td align="right" valign="top"><?php echo $nr?>.</td>
1490
+ <td align="left" valign="top"><?php echo $results[$i]['site']?></td>
1491
+ <td valign="top" class="odb-bold"><?php echo $results[$i]['post_title']?></td>
1492
  <td valign="top"><?php
1493
  } // if($display)
1494
 
1495
  $sql_get_posts = "
1496
  SELECT `ID`, `post_modified`
1497
+ FROM ".$results[$i]['site']."posts
1498
+ WHERE `post_parent`=".$results[$i]['post_parent']."
1499
+ AND `post_type`='revision'
1500
  ORDER BY `post_modified` ASC
1501
  ";
1502
+
1503
  $results_get_posts = $wpdb->get_results($sql_get_posts);
1504
 
1505
  for($j=0; $j<$nr_to_delete; $j++)
1507
  if($display) echo $results_get_posts[$j]->post_modified.'<br />';
1508
 
1509
  $sql_delete = "
1510
+ DELETE FROM ".$results[$i]['site']."posts
1511
  WHERE `ID` = ".$results_get_posts[$j]->ID."
1512
  ";
1513
  $wpdb->get_results($sql_delete);
1523
  <?php
1524
  } // if($display)
1525
  } // for($i=0; $i<count($results); $i++)
1526
+
1527
  return $total_deleted;
1528
+ } // rvg_delete_revisions()
1529
 
1530
 
1531
  /********************************************************************************************
1532
 
1533
  DELETE TRASHED POSTS AND PAGES
1534
+
1535
+ v3.2: MULTISITE
1536
 
1537
  *********************************************************************************************/
1538
  function rvg_delete_trash($results, $display)
1541
 
1542
  $nr = 1;
1543
  $total_deleted = count($results);
1544
+
1545
+ for($i=0; $i<$total_deleted; $i++)
1546
  { if($display)
1547
  {
1548
  ?>
1549
  <tr>
1550
  <td align="right" valign="top"><?php echo $nr; ?></td>
1551
+ <td align="left" valign="top"><?php echo $results[$i]['site']?></td>
1552
+ <td valign="top"><?php echo $results[$i]['post_type']; ?></td>
1553
+ <td valign="top"><?php echo $results[$i]['title']; ?></td>
1554
+ <td valign="top" nowrap="nowrap"><?php echo $results[$i]['modified']; ?></td>
1555
  </tr>
1556
  <?php
1557
  }
1558
+
1559
+ if($results[$i]['post_type'] == 'comment')
1560
  { // DELETE META DATA (IF ANY...)
1561
  $sql_delete = "
1562
+ DELETE FROM ".$results[$i]['site']."commentmeta
1563
+ WHERE `comment_id` = ".$results[$i]['id']."
1564
  ";
1565
  $wpdb->get_results($sql_delete);
1566
  }
1567
 
1568
+ // DELETE TRASHED POSTS / PAGES
1569
+ $sql_delete = "
1570
+ DELETE FROM ".$results[$i]['site']."posts
1571
+ WHERE `post_status` = 'trash'
1572
+ ";
1573
+ $wpdb->get_results($sql_delete);
1574
+
1575
+ // DELETE TRASHED COMMENTS
1576
+ $sql_delete = "
1577
+ DELETE FROM ".$results[$i]['site']."comments
1578
+ WHERE `comment_approved` = 'trash'
1579
+ ";
1580
+ $wpdb->get_results($sql_delete);
1581
+
1582
  $nr++;
1583
  } // for($i=0; $i<count($results); $i++)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1584
 
1585
  return $total_deleted;
1586
 
1587
+ } // rvg_delete_trash()
1588
 
1589
 
1590
  /********************************************************************************************
1591
 
1592
  DELETE SPAMMED ITEMS
1593
+
1594
+ v3.2: MULTISITE
1595
 
1596
  *********************************************************************************************/
1597
  function rvg_delete_spam($results, $display)
1606
  ?>
1607
  <tr>
1608
  <td align="right" valign="top"><?php echo $nr; ?></td>
1609
+ <td align="left" valign="top"><?php echo $results[$i]['site']?></td>
1610
+ <td valign="top"><?php echo $results[$i]['comment_author']; ?></td>
1611
+ <td valign="top"><?php echo $results[$i]['comment_author_email']; ?></td>
1612
+ <td valign="top" nowrap="nowrap"><?php echo $results[$i]['comment_date']; ?></td>
1613
  </tr>
1614
  <?php
1615
  } // if($display)
1616
+
1617
+ $sql_delete = "
1618
+ DELETE FROM ".$results[$i]['site']."commentmeta
1619
+ WHERE `comment_id` = ".$results[$i]['comment_ID']."
1620
+ ";
1621
+ $wpdb->get_results($sql_delete);
1622
+
1623
  $sql_delete = "
1624
+ DELETE FROM ".$results[$i]['site']."comments
1625
+ WHERE `comment_approved` = 'spam'
1626
  ";
1627
  $wpdb->get_results($sql_delete);
1628
+
1629
  $nr++;
1630
  } // for($i=0; $i<count($results); $i++)
1631
 
 
 
 
 
 
 
1632
  return $total_deleted;
1633
 
1634
+ } // rvg_delete_spam()
1635
 
1636
 
1637
  /********************************************************************************************
1638
 
1639
  DELETE UNUSED TAGS
1640
+
1641
+ v3.2: MULTISITE
1642
 
1643
  *********************************************************************************************/
1644
  function rvg_delete_tags()
1645
  {
1646
+ global $odb_ms_blogids, $odb_ms_prefixes;
1647
+
1648
  $total_deleted = 0;
1649
 
1650
+ // LOOP THROUGH THE NETWORK
1651
+ for($i=0; $i<count($odb_ms_blogids); $i++)
1652
+ {
1653
+ if(function_exists('switch_to_blog')) switch_to_blog($odb_ms_blogids[$i]);
1654
+
1655
+ $tags = get_terms('post_tag', array('hide_empty' => 0));
1656
+ for($j=0; $j<count($tags); $j++)
1657
+ {
1658
+ if($tags[$i]->count < 1)
1659
+ { if(!rvg_delete_tags_is_scheduled($tags[$i]->term_id, $odb_ms_prefixes[$i]))
1660
+ { // v3.0: TAG NOT USED IN SCHEDULED POSTS: CAN BE DELETED
1661
+ $total_deleted++;
1662
+ wp_delete_term($tags[$i]->term_id, 'post_tag');
1663
+ }
1664
+ }
1665
  }
1666
+ } // for($i=0; $i<count($odb_ms_blogids); $i++)
1667
+
1668
+ // SWITCH BACK TO MAIN SITE
1669
+ // if(function_exists('switch_to_blog')) switch_to_blog(1);
1670
+
1671
  return $total_deleted;
1672
+ } // rvg_delete_tags()
1673
 
1674
 
1675
  /********************************************************************************************
1676
 
1677
+ IS THE UNUSED TAG USED IN ONE OR MORE SCHEDULED POSTS?
1678
+
1679
+ Since: v3.0
1680
+
1681
+ v3.2: MULTISITE
1682
 
1683
  *********************************************************************************************/
1684
+ function rvg_delete_tags_is_scheduled($term_id, $odb_prefix)
1685
  {
1686
  global $wpdb;
1687
+
1688
  $sql_get_posts = "
1689
  SELECT p.post_status
1690
+ FROM ".$odb_prefix."term_relationships t, ".$odb_prefix."posts p
1691
  WHERE t.term_taxonomy_id = '".$term_id."'
1692
  AND t.object_id = p.ID
1693
  ";
1704
  /********************************************************************************************
1705
 
1706
  DELETE EXPIRED TRANSIENTS
1707
+
1708
+ v3.2: MULTISITE
1709
 
1710
  *********************************************************************************************/
1711
  function rvg_delete_transients()
1712
  {
1713
+ global $wpdb, $odb_ms_prefixes;
1714
 
1715
+ $delay = time() - 60; // ONE MINUTE DELAY
1716
 
1717
  $total_deleted = 0;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1718
 
1719
+ // LOOP THROUGH THE NETWORK
1720
+ for($i=0; $i<count($odb_ms_prefixes); $i++)
1721
+ {
1722
+ $sql = "
1723
+ SELECT *
1724
+ FROM ".$odb_ms_prefixes[$i]."options
1725
+ WHERE (
1726
+ option_name LIKE '_transient_timeout_%'
1727
+ OR option_name LIKE '_site_transient_timeout_%'
1728
+ OR option_name LIKE 'displayed_galleries_%'
1729
+ )
1730
+ AND option_value < '$delay'
1731
+ ";
1732
 
1733
+ $results = $wpdb->get_results($sql);
1734
+ $total_deleted = count($results);
 
 
 
 
 
 
 
1735
 
1736
+ $sql = "
1737
+ DELETE FROM ".$odb_ms_prefixes[$i]."options
1738
+ WHERE (
1739
+ option_name LIKE '_transient_timeout_%'
1740
+ OR option_name LIKE '_site_transient_timeout_%'
1741
+ OR option_name LIKE 'displayed_galleries_%'
1742
+ )
1743
+ AND option_value < '$delay'
1744
+ ";
 
 
1745
 
1746
+ $wpdb->get_results($sql);
1747
+
1748
+ $sql = "
1749
+ SELECT *
1750
+ FROM ".$odb_ms_prefixes[$i]."options
1751
+ WHERE (
1752
+ option_name LIKE '_transient_timeout_%'
1753
+ OR option_name LIKE '_site_transient_timeout_%'
1754
+ )
1755
+ AND option_value < '$delay'
1756
+ ";
1757
+
1758
+ $results = $wpdb->get_results($sql);
1759
+ $total_deleted += count($results);
1760
+
1761
+ $sql = "
1762
+ DELETE FROM ".$odb_ms_prefixes[$i]."options
1763
+ WHERE (
1764
+ option_name LIKE '_transient_timeout_%'
1765
+ OR option_name LIKE '_site_transient_timeout_%'
1766
+ )
1767
+ AND option_value < '$delay'
1768
+ ";
1769
+
1770
+ $wpdb->get_results($sql);
1771
+ }
1772
 
1773
  return $total_deleted;
1774
+ } // rvg_delete_transients()
1775
 
1776
 
1777
  /********************************************************************************************
1778
 
1779
+ DELETE PINGBACKS AND TRACKBACKS
1780
+
1781
+ Since: v3.1
1782
+
1783
+ v3.2: MULTISITE
1784
 
1785
  *********************************************************************************************/
1786
  function rvg_delete_pingbacks()
1787
  {
1788
+ global $wpdb, $odb_ms_prefixes;
1789
 
1790
  $total_deleted = 0;
1791
+
1792
+ // LOOP THROUGH THE NETWORK
1793
+ for($i=0; $i<count($odb_ms_prefixes); $i++)
1794
+ {
1795
+ $sql = "
1796
+ SELECT `comment_ID`
1797
+ FROM ".$odb_ms_prefixes[$i]."comments
1798
+ WHERE (
1799
+ `comment_type` = 'pingback'
1800
+ OR `comment_type` = 'trackback'
1801
+ )
1802
+ ";
1803
 
1804
+ $results = $wpdb->get_results($sql);
1805
+ $total_deleted = count($results);
 
 
 
 
 
 
1806
 
1807
+ for($j=0; $j<count($results); $j++)
1808
+ { // DELETE METADATA FOR THIS COMMENT (IF ANY)
1809
+ $sql_delete_meta = "
1810
+ DELETE FROM ".$odb_ms_prefixes[$i]."commentmeta
1811
+ WHERE `comment_id` = ".$results[$j]->comment_ID."
1812
+ ";
1813
+ $wpdb->get_results($sql_delete_meta);
1814
+ }
1815
 
1816
+ // DELETE COMMENTS
1817
+ $sql_delete_comments = "
1818
+ DELETE FROM ".$odb_ms_prefixes[$i]."comments
1819
+ WHERE (
1820
+ `comment_type` = 'pingback'
1821
+ OR `comment_type` = 'trackback'
1822
+ )
1823
  ";
1824
+ $wpdb->get_results($sql_delete_comments);
1825
  }
 
 
 
 
 
 
 
 
 
1826
 
1827
  return $total_deleted;
1828
+ } // rvg_delete_pingbacks()
1829
 
1830
 
1831
  /********************************************************************************************
1832
 
1833
+ DELETE ORPHAN POSTMETA RECORDS - v3.2 MULTISITE
1834
+
1835
+ Since: v2.2.7
1836
+
1837
+ v3.2: MULTISITE
1838
 
1839
  *********************************************************************************************/
1840
  function rvg_delete_orphans($display)
1841
  {
1842
+ global $wpdb, $odb_ms_prefixes;
1843
 
1844
  $meta_orphans = 0;
1845
  $post_orphans = 0;
1846
 
1847
+ // LOOP THROUGH THE NETWORK
1848
+ for($i=0; $i<count($odb_ms_prefixes); $i++)
1849
+ {
1850
+ // DELETE POST ORPHANS (AUTO DRAFTS)
1851
+ $sql_delete = "
1852
+ SELECT COUNT(*) cnt
1853
+ FROM ".$odb_ms_prefixes[$i]."posts
1854
+ WHERE ID NOT IN (SELECT post_id FROM ".$odb_ms_prefixes[$i]."postmeta)
 
 
 
 
 
 
 
 
 
1855
  AND post_status = 'auto-draft'
1856
  ";
 
 
1857
 
1858
+ $results = $wpdb->get_results($sql_delete);
1859
+
1860
+ $post_orphans = $results[0]->cnt;
1861
+
1862
+ if($post_orphans > 0)
1863
+ { $sql_delete = "
1864
+ DELETE FROM ".$odb_ms_prefixes[$i]."posts
1865
+ WHERE ID NOT IN (SELECT post_id FROM ".$odb_ms_prefixes[$i]."postmeta)
1866
+ AND post_status = 'auto-draft'
1867
+ ";
1868
+ $wpdb->get_results($sql_delete);
1869
+ }
1870
+
1871
+ // DELETE POSTMETA ORPHANS
1872
+ $sql_delete = "
1873
+ SELECT COUNT(*) cnt
1874
+ FROM ".$odb_ms_prefixes[$i]."postmeta
1875
+ WHERE post_id NOT IN (SELECT ID FROM ".$odb_ms_prefixes[$i]."posts)
1876
  ";
1877
+
1878
+ $results = $wpdb->get_results($sql_delete);
1879
+
1880
+ $meta_orphans = $results[0]->cnt;
1881
+
1882
+ if($meta_orphans > 0)
1883
+ { $sql_delete = "
1884
+ DELETE FROM ".$odb_ms_prefixes[$i]."postmeta
1885
+ WHERE post_id NOT IN (SELECT ID FROM ".$odb_ms_prefixes[$i]."posts)
1886
+ ";
1887
+ $wpdb->get_results($sql_delete);
1888
+ }
1889
  }
1890
 
1891
  return ($meta_orphans + $post_orphans);
1892
 
1893
+ } // rvg_delete_orphans()
1894
 
1895
 
1896
  /********************************************************************************************
1909
  $cnt = 0;
1910
  for ($i=0; $i<count($tables); $i++)
1911
  {
1912
+ $excluded = rvg_odb_get_option('rvg_ex_'.$tables[$i][0]);
1913
 
1914
  if(!$excluded)
1915
  { # TABLE NOT EXCLUDED
1933
  { $query = "OPTIMIZE TABLE ".$tables[$i][0];
1934
  $result = $wpdb->get_results($query);
1935
  $msg = $result[0]->Msg_text;
1936
+ $msg = str_replace('OK', __('<span class="odb-optimized">TABLE OPTIMIZED</span>', 'rvg-optimize-database'), $msg);
1937
  $msg = str_replace('Table is already up to date', __('Table is already up to date', 'rvg-optimize-database'), $msg);
1938
  }
1939
 
1954
  } // for ($i=0; $i<count($tables); $i++)
1955
  return $cnt;
1956
 
1957
+ } // rvg_optimize_tables()
1958
 
1959
 
1960
  /********************************************************************************************
1966
  {
1967
  global $odb_version;
1968
 
1969
+ $rvg_odb_logging_on = rvg_odb_get_option('rvg_odb_logging_on');
1970
  if(!$rvg_odb_logging_on)
1971
  { $rvg_odb_logging_on = 'N';
1972
+ rvg_odb_update_option('rvg_odb_logging_on', $rvg_odb_logging_on);
1973
  }
1974
 
1975
  if($rvg_odb_logging_on == "Y")
2048
  <td width="8%" align="right" valign="top">'.$log_arr["after"].'</td>
2049
  <td width="8%" align="right" valign="top">'.$log_arr["savings"].'</td>
2050
  </tr>
2051
+ </table>
2052
  ';
2053
 
2054
  // print_r($log_arr);
2055
  file_put_contents($file,$html,FILE_APPEND);
2056
  }
2057
 
2058
+ } // rvg_write_log()
2059
 
2060
 
2061
  /********************************************************************************************
2062
 
2063
  GET REVISIONS
2064
+
2065
+ V3.2: MULTISITE
2066
 
2067
  *********************************************************************************************/
2068
  function rvg_get_revisions($max_revisions)
2069
  {
2070
+ global $wpdb, $odb_ms_prefixes;
2071
+
2072
+ $res_arr = array();
2073
+
2074
+ $index = 0;
2075
+ for($i=0; $i<count($odb_ms_prefixes); $i++)
2076
+ { $sql = "
2077
+ SELECT `post_parent`, `post_title`, COUNT(*) cnt
2078
+ FROM ".$odb_ms_prefixes[$i]."posts
2079
+ WHERE `post_type` = 'revision'
2080
+ GROUP BY `post_parent`
2081
+ HAVING COUNT(*) > ".$max_revisions."
2082
+ ORDER BY UCASE(`post_title`)
2083
+ ";
2084
+ $res = $wpdb->get_results($sql, ARRAY_A);
2085
 
2086
+ for($j=0; $j<count($res); $j++)
2087
+ { if(isset($res[$j]))
2088
+ { $res_arr[$index] = $res[$j];
2089
+ $res_arr[$index]['site'] = $odb_ms_prefixes[$i];
2090
+ $index++;
2091
+ }
2092
+ }
2093
+ }
2094
 
2095
+ return $res_arr;
2096
 
2097
+ } // rvg_get_revisions()
2098
 
2099
 
2100
  /********************************************************************************************
2101
 
2102
  GET TRASHED POSTS / PAGES AND COMMENTS
2103
+
2104
+ v3.2: MULTISITE
2105
 
2106
  *********************************************************************************************/
2107
  function rvg_get_trash()
2108
  {
2109
+ global $wpdb, $odb_ms_prefixes;
2110
+
2111
+ $res_arr = array();
2112
 
2113
+ $index = 0;
2114
+
2115
+ // LOOP TROUGH SITES
2116
+ for($i=0; $i<count($odb_ms_prefixes); $i++)
2117
+ {
2118
+ $sql = "
2119
+ SELECT `ID` AS id, 'post' AS post_type, `post_title` AS title, `post_modified` AS modified
2120
+ FROM ".$odb_ms_prefixes[$i]."posts
2121
+ WHERE `post_status` = 'trash'
2122
+ UNION ALL
2123
+ SELECT `comment_ID` AS id, 'comment' AS post_type, `comment_author_IP` AS title, `comment_date` AS modified
2124
+ FROM ".$odb_ms_prefixes[$i]."comments
2125
+ WHERE `comment_approved` = 'trash'
2126
+ ORDER BY post_type, UCASE(title)
2127
+ ";
2128
+ $res = $wpdb->get_results($sql, ARRAY_A);
2129
+
2130
+ if($res != null)
2131
+ { $res_arr[$index] = $res[0];
2132
+ $res_arr[$index]['site'] = $odb_ms_prefixes[$i];
2133
+ $index++;
2134
+ }
2135
+ }
2136
 
2137
+ return $res_arr;
2138
 
2139
+ } // rvg_get_trash()
2140
 
2141
 
2142
  /********************************************************************************************
2143
 
2144
  GET SPAMMED COMMENTS
2145
+
2146
+ v3.2: MULTISITE
2147
 
2148
  *********************************************************************************************/
2149
  function rvg_get_spam()
2150
  {
2151
+ global $wpdb, $odb_ms_prefixes;
2152
+
2153
+ $res_arr = array();
2154
 
2155
+ $index = 0;
2156
+ // LOOP THROUGH SITES
2157
+ for($i=0; $i<count($odb_ms_prefixes); $i++)
2158
+ {
2159
  $sql = "
2160
  SELECT `comment_ID`, `comment_author`, `comment_author_email`, `comment_date`
2161
+ FROM ".$odb_ms_prefixes[$i]."comments
2162
  WHERE `comment_approved` = 'spam'
2163
  ORDER BY UCASE(`comment_author`)
2164
  ";
2165
+ $res = $wpdb->get_results($sql, ARRAY_A);
2166
+
2167
+ if($res != null)
2168
+ { $res_arr[$index] = $res[0];
2169
+ $res_arr[$index]['site'] = $odb_ms_prefixes[$i];
2170
+ $index++;
2171
+ }
2172
+ }
2173
+
2174
+ return $res_arr;
2175
 
2176
+ } // rvg_get_spam()
 
 
2177
 
2178
 
2179
  /********************************************************************************************
2197
 
2198
  return $res[0]->size;
2199
 
2200
+ } // rvg_get_db_size()
2201
 
2202
 
2203
  /********************************************************************************************
2213
  $table_size = (round($size/1024,$precision)).' KB';
2214
 
2215
  return $table_size;
2216
+ } // rvg_format_size()
2217
  ?>