Optimize Database after Deleting Revisions - Version 3.2.1

Version Description

[03/18/2015] = * CHANGE: due to problems, I removed the MULTISITE support again for now... Sorry about that!

Download this release

Release Info

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

Code changes from version 3.2 to 3.2.1

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-18 17:49+0100\n"
6
- "PO-Revision-Date: 2015-03-18 17:49+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"
@@ -21,33 +21,33 @@ msgstr ""
21
  "X-Poedit-SearchPath-0: .\n"
22
 
23
  # @ rvg-optimize-database
24
- #: rvg-optimize-db.php:64 rvg-optimize-db.php:65 rvg-optimize-db.php:86
25
- #: rvg-optimize-db.php:87 rvg-optimize-db.php:107 rvg-optimize-db.php:108
26
- #: rvg-optimize-db.php:127 rvg-optimize-db.php:128
27
  msgid "Optimize Database"
28
  msgstr "Optimaliseer Database"
29
 
30
  # @ optimize_db
31
- #: rvg-optimize-db.php:166
32
  msgid "Optimize DB (1 click)"
33
  msgstr "Optimaliseer DB (1 klik)"
34
 
35
  # @ default
36
- #: rvg-optimize-db.php:195
37
  msgid "Once Weekly"
38
  msgstr "Eenmaal per week"
39
 
40
  # @ default
41
- #: rvg-optimize-db.php:231
42
  msgctxt "timezone date format"
43
  msgid "YmdGis"
44
  msgstr ""
45
 
46
- #: rvg-optimize-db.php:348
47
  msgid "Optimize Database after Deleting Revisions SETTINGS UPDATED"
48
  msgstr "Optimize Database after Deleting Revisions INSTELLINGEN AANGEPAST"
49
 
50
- #: rvg-optimize-db.php:350
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:404
59
  msgid "Using Optimize Database after Deleting Revisions"
60
  msgstr "Het gebruik van Optimize Database after Deleting Revisions"
61
 
62
- #: rvg-optimize-db.php:408
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:411
69
  msgid "Plugin version:"
70
  msgstr "Plugin versie:"
71
 
72
- #: rvg-optimize-db.php:415
73
  msgid "Author"
74
  msgstr "Auteur"
75
 
76
- #: rvg-optimize-db.php:418 rvg-optimize-db.php:749 rvg-optimize-db.php:1942
77
  msgid "The Netherlands"
78
  msgstr "Nederland"
79
 
80
- #: rvg-optimize-db.php:421
81
  msgid "Plugin URL:"
82
  msgstr "Plugin URL:"
83
 
84
- #: rvg-optimize-db.php:425
85
  msgid "Download URL:"
86
  msgstr "Download URL:"
87
 
88
- #: rvg-optimize-db.php:431
89
  msgid "Optimize Database after Deleting Revisions - Settings"
90
  msgstr "Optimize Database after Deleting Revisions - Instellingen"
91
 
92
- #: rvg-optimize-db.php:451 rvg-optimize-db.php:755
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:453
99
  msgid "('0' means: delete <u>ALL</u> revisions)"
100
  msgstr "('0' betekent: verwijder <u>ALLE</u> revisies)"
101
 
102
- #: rvg-optimize-db.php:459 rvg-optimize-db.php:758
103
  msgid "Delete all trashed items"
104
  msgstr "Maak de prullenbak leeg"
105
 
106
- #: rvg-optimize-db.php:465 rvg-optimize-db.php:761
107
  msgid "Delete all spammed items"
108
  msgstr "Verwijder alle spam reacties"
109
 
110
- #: rvg-optimize-db.php:471 rvg-optimize-db.php:764
111
  msgid "Delete unused tags"
112
  msgstr "Verwijder ongebruikte tags"
113
 
114
- #: rvg-optimize-db.php:477 rvg-optimize-db.php:767
115
  msgid "Delete expired transients"
116
  msgstr "Verwijder verlopen transiënts"
117
 
118
- #: rvg-optimize-db.php:483 rvg-optimize-db.php:770
119
  msgid "Delete pingbacks and trackbacks"
120
  msgstr "Verwijder pingback en trackbacks"
121
 
122
- #: rvg-optimize-db.php:489 rvg-optimize-db.php:773
123
  msgid "Keep a log"
124
  msgstr "Gebruik een logbestand"
125
 
126
- #: rvg-optimize-db.php:495 rvg-optimize-db.php:779
127
  msgid "Scheduler"
128
  msgstr "Planner"
129
 
130
- #: rvg-optimize-db.php:499 rvg-optimize-db.php:718
131
  msgid "NOT SCHEDULED"
132
  msgstr "NIET GEPLAND"
133
 
134
- #: rvg-optimize-db.php:502
135
  msgid "run optimization HOURLY"
136
  msgstr "voer de optimalisatie ELK UUR uit"
137
 
138
- #: rvg-optimize-db.php:505
139
  msgid "run optimization TWICE A DAY"
140
  msgstr "voer de optimalisatie TWEE KEER PER DAG uit"
141
 
142
- #: rvg-optimize-db.php:508
143
  msgid "run optimization DAILY"
144
  msgstr "voer de optimalisatie DAGELIJKS uit"
145
 
146
- #: rvg-optimize-db.php:511
147
  msgid "run optimization WEEKLY"
148
  msgstr "voer de optimalisatie WEKELIJKS uit"
149
 
150
- #: rvg-optimize-db.php:519
151
  msgid "Time"
152
  msgstr "Tijd"
153
 
154
- #: rvg-optimize-db.php:526
155
  msgid "hrs"
156
  msgstr "uur"
157
 
158
- #: rvg-optimize-db.php:539
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:542 rvg-optimize-db.php:549
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:546
167
  msgid "Show an icon in the Admin Menu"
168
  msgstr "Toon een icon in het Admin Menu"
169
 
170
- #: rvg-optimize-db.php:562
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,323 +177,319 @@ 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:565
181
  msgid "check all tables"
182
  msgstr "vink alle tabellen aan"
183
 
184
- #: rvg-optimize-db.php:567
185
  msgid "uncheck all tables"
186
  msgstr "vink alle tabellen uit"
187
 
188
- #: rvg-optimize-db.php:569
189
  msgid "check all NON-WordPress tables"
190
  msgstr "vink alle NIET-WordPress tabellen aan"
191
 
192
- #: rvg-optimize-db.php:608
193
  msgid "Save Settings"
194
  msgstr "Bewaar instellingen"
195
 
196
- #: rvg-optimize-db.php:610
197
  msgid "Go To Optimizer"
198
  msgstr "Ga naar Optimalisatie"
199
 
200
  # @ default
201
- #: rvg-optimize-db.php:636
202
  msgctxt "timezone date format"
203
  msgid "G:i"
204
  msgstr ""
205
 
206
- #: rvg-optimize-db.php:661 rvg-optimize-db.php:668 rvg-optimize-db.php:675
207
- #: rvg-optimize-db.php:682 rvg-optimize-db.php:690 rvg-optimize-db.php:697
208
  msgid "NO"
209
  msgstr "NEE"
210
 
211
- #: rvg-optimize-db.php:661 rvg-optimize-db.php:668 rvg-optimize-db.php:675
212
- #: rvg-optimize-db.php:682 rvg-optimize-db.php:690 rvg-optimize-db.php:697
213
  msgid "YES"
214
  msgstr "JA"
215
 
216
- #: rvg-optimize-db.php:706
217
  msgid "ONCE HOURLY"
218
  msgstr "ELK UUR"
219
 
220
- #: rvg-optimize-db.php:708
221
  msgid "TWICE DAILY"
222
  msgstr "TWEEMAAL DAAGS"
223
 
224
- #: rvg-optimize-db.php:710
225
  msgid "ONCE DAILY"
226
  msgstr "DAGELIJKS"
227
 
228
- #: rvg-optimize-db.php:712
229
  msgid "ONCE WEEKLY"
230
  msgstr "WEKELIJKS"
231
 
232
  # @ rvg-optimize-database
233
- #: rvg-optimize-db.php:739
234
  msgid "Optimize your WordPress Database"
235
  msgstr "Optimaliseer uw WordPress Database"
236
 
237
- #: rvg-optimize-db.php:747 rvg-optimize-db.php:1942
238
  msgid "A WordPress Plugin by"
239
  msgstr "Een WordPress Plugin door"
240
 
241
- #: rvg-optimize-db.php:752
242
  msgid "Current settings"
243
  msgstr "Huidige instellingen"
244
 
245
- #: rvg-optimize-db.php:776
246
  msgid "Number of excluded tables"
247
  msgstr "Aantal uitgesloten tabellen"
248
 
249
- #: rvg-optimize-db.php:787
250
  msgid "Next scheduled run"
251
  msgstr "Volgende geplande uitvoering"
252
 
253
- #: rvg-optimize-db.php:796
254
  msgid "Total savings since the first run"
255
  msgstr "Totale besparing sinds de eerste uitvoering"
256
 
257
- #: rvg-optimize-db.php:802
258
  msgid "Change Settings"
259
  msgstr "Wijzig instellingen"
260
 
261
- #: rvg-optimize-db.php:808 rvg-optimize-db.php:1245
262
  msgid "View Log File"
263
  msgstr "Bekijk Logbestand"
264
 
265
- #: rvg-optimize-db.php:810 rvg-optimize-db.php:1247
266
  msgid "Delete Log File"
267
  msgstr "Verwijder Logbestand"
268
 
269
- #: rvg-optimize-db.php:819
270
  msgid "Start Optimization"
271
  msgstr "Start Optimalisatie"
272
 
273
- #: rvg-optimize-db.php:831
274
  msgid "Starting Optimization"
275
  msgstr "Aan het optimaliseren"
276
 
277
  # @ default
278
- #: rvg-optimize-db.php:838
279
  msgctxt "timezone date format"
280
  msgid "m/d/YH:i:s"
281
  msgstr ""
282
 
283
- #: rvg-optimize-db.php:851
284
  msgid "DELETING REVISIONS"
285
  msgstr "REVISIES AAN HET VERWIJDEREN"
286
 
287
- #: rvg-optimize-db.php:856 rvg-optimize-db.php:910 rvg-optimize-db.php:962
288
- msgid "prefix"
289
- msgstr "prefix"
290
-
291
- #: rvg-optimize-db.php:857
292
  msgid "post / page"
293
  msgstr "bericht / pagina"
294
 
295
- #: rvg-optimize-db.php:858
296
  msgid "revision date"
297
  msgstr "revisiedatum"
298
 
299
- #: rvg-optimize-db.php:859
300
  msgid "revisions deleted"
301
  msgstr "revisies verwijderd"
302
 
303
- #: rvg-optimize-db.php:866
304
  msgid "total number of revisions deleted"
305
  msgstr "totaal aantal verwijderde revisies"
306
 
307
- #: rvg-optimize-db.php:877
308
  msgid "No REVISIONS found to delete"
309
  msgstr "Geen REVISIES gevonden om te verwijderen"
310
 
311
- #: rvg-optimize-db.php:905
312
  msgid "DELETING TRASHED ITEMS"
313
  msgstr "PRULLENBAK AAN HET LEEGMAKEN"
314
 
315
- #: rvg-optimize-db.php:911
316
  msgid "type"
317
  msgstr "type"
318
 
319
- #: rvg-optimize-db.php:912
320
  msgid "IP address / title"
321
  msgstr "IP adres / titel"
322
 
323
- #: rvg-optimize-db.php:913
324
  msgid "date"
325
  msgstr "datum"
326
 
327
- #: rvg-optimize-db.php:928
328
  msgid "No TRASHED ITEMS found to delete"
329
  msgstr "Geen PRULLENBAK ITEMS gevonden om te verwijderen"
330
 
331
- #: rvg-optimize-db.php:957
332
  msgid "DELETING SPAMMED ITEMS"
333
  msgstr "SPAM ITEMS AAN HET VERWIJDEREN"
334
 
335
- #: rvg-optimize-db.php:963
336
  msgid "comment author"
337
  msgstr "plaatser van de reactie"
338
 
339
- #: rvg-optimize-db.php:964
340
  msgid "comment author email"
341
  msgstr "email van de plaatser van de reactie"
342
 
343
- #: rvg-optimize-db.php:965
344
  msgid "comment date"
345
  msgstr "datum van de reactie"
346
 
347
- #: rvg-optimize-db.php:980
348
  msgid "No SPAMMED ITEMS found to delete"
349
  msgstr "Geen SPAM gevonden om te verwijderen"
350
 
351
- #: rvg-optimize-db.php:1010
352
  msgid "NUMBER OF UNUSED TAGS DELETED"
353
  msgstr "AANTAL VERWIJDERDE ONGEBRUIKTE TAGS"
354
 
355
- #: rvg-optimize-db.php:1022
356
  msgid "No UNUSED TAGS found to delete"
357
  msgstr "Geen ONGEBRUIKTE TAGS gevonden om te verwijderen"
358
 
359
- #: rvg-optimize-db.php:1052
360
  msgid "NUMBER OF EXPIRED TRANSIENTS DELETED"
361
  msgstr "AANTAL VERWIJDERDE VERLOPEN TRANSIËNTS"
362
 
363
- #: rvg-optimize-db.php:1064
364
  msgid "No EXPIRED TRANSIENTS found to delete"
365
  msgstr "Geen VERLOPEN TRANSIËNTS gevonden om te verwijderen"
366
 
367
- #: rvg-optimize-db.php:1093
368
  msgid "NUMBER OF PINGBACKS AND TRACKBACKS DELETED"
369
  msgstr "AANTAL VERWIJDERDE PINGBACKS EN TRACKBACKS"
370
 
371
- #: rvg-optimize-db.php:1105
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:1131
376
  msgid "NUMBER OF POSTMETA ORPHANS DELETED"
377
  msgstr "AANTAL VERWIJDERDE POSTMETA WEZEN"
378
 
379
- #: rvg-optimize-db.php:1143
380
  msgid "No POSTMETA ORPHANS found to delete"
381
  msgstr "Geen POSTMETA WEZEN gevonden om te verwijderen"
382
 
383
- #: rvg-optimize-db.php:1162
384
  msgid "OPTIMIZING DATABASE TABLES"
385
  msgstr "DATABASETABELLEN AAN HET OPTIMALISEREN"
386
 
387
- #: rvg-optimize-db.php:1167
388
  msgid "table name"
389
  msgstr "tabelnaam"
390
 
391
- #: rvg-optimize-db.php:1168
392
  msgid "optimization result"
393
  msgstr "resultaat optimalisatie"
394
 
395
- #: rvg-optimize-db.php:1169
396
  msgid "engine"
397
  msgstr "engine"
398
 
399
- #: rvg-optimize-db.php:1170
400
  msgid "table rows"
401
  msgstr "tabelrijen"
402
 
403
- #: rvg-optimize-db.php:1171
404
  msgid "table size"
405
  msgstr "tabelgrootte"
406
 
407
- #: rvg-optimize-db.php:1197 rvg-optimize-db.php:1957
408
  msgid "SAVINGS"
409
  msgstr "BESPARINGEN"
410
 
411
- #: rvg-optimize-db.php:1202
412
  msgid "size of the database"
413
  msgstr "grootte van de database"
414
 
415
- #: rvg-optimize-db.php:1205
416
  msgid "BEFORE optimization"
417
  msgstr "VOOR de optimalisatie"
418
 
419
- #: rvg-optimize-db.php:1209
420
  msgid "AFTER optimization"
421
  msgstr "NA de optimalisatie"
422
 
423
- #: rvg-optimize-db.php:1213
424
  msgid "SAVINGS THIS TIME"
425
  msgstr "DIT KEER BESPAARD"
426
 
427
- #: rvg-optimize-db.php:1217
428
  msgid "TOTAL SAVINGS SINCE THE FIRST RUN"
429
  msgstr "TOTALE BESPARING SINDS DE EERSTE UITVOERING"
430
 
431
- #: rvg-optimize-db.php:1232
432
  msgid "DONE"
433
  msgstr "KLAAR"
434
 
435
- #: rvg-optimize-db.php:1236
436
  msgid "Optimization took"
437
  msgstr "Optimalizatie duurde"
438
 
439
- #: rvg-optimize-db.php:1236
440
  msgid "seconds"
441
  msgstr "seconden"
442
 
443
- #: rvg-optimize-db.php:1860
444
  msgid "InnoDB table: skipped..."
445
  msgstr "InnoDB tabel overgeslagen..."
446
 
447
- #: rvg-optimize-db.php:1866
448
  msgid "TABLE OPTIMIZED"
449
  msgstr "TABEL GEOPTIMALISEERD"
450
 
451
- #: rvg-optimize-db.php:1867
452
  msgid "Table is already up to date"
453
  msgstr "Tabel is al optimaal"
454
 
455
- #: rvg-optimize-db.php:1946
456
  msgid "time"
457
  msgstr "tijd"
458
 
459
- #: rvg-optimize-db.php:1947
460
  msgid "deleted<br />revisions"
461
  msgstr "verw.<br />revisies"
462
 
463
- #: rvg-optimize-db.php:1948
464
  msgid "deleted<br />trash"
465
  msgstr "verw.<br />prullenbak items"
466
 
467
- #: rvg-optimize-db.php:1949
468
  msgid "deleted<br />spam"
469
  msgstr "verw.<br />spamitems"
470
 
471
- #: rvg-optimize-db.php:1950
472
  msgid "deleted<br />tags"
473
  msgstr "verw.<br /> tags"
474
 
475
- #: rvg-optimize-db.php:1951
476
  msgid "deleted<br />transients"
477
  msgstr "verw.<br />transiënts"
478
 
479
- #: rvg-optimize-db.php:1952
480
  msgid "deleted<br />pingbacks<br />trackbacks"
481
  msgstr "verwijderde<br />pingbacks<br />trackbacks"
482
 
483
- #: rvg-optimize-db.php:1953
484
  msgid "deleted<br />orphans"
485
  msgstr "verw.<br />wezen"
486
 
487
  # @ rvg-optimize-database
488
- #: rvg-optimize-db.php:1954
489
  msgid "nr of optimized tables"
490
  msgstr "aantal geoptima-<br />liseerde tabellen"
491
 
492
- #: rvg-optimize-db.php:1955
493
  msgid "database size BEFORE"
494
  msgstr "database<br />grootte<br />VOOR"
495
 
496
- #: rvg-optimize-db.php:1956
497
  msgid "database size AFTER"
498
  msgstr "database<br />grootte<br />NA"
499
 
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"
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
  "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
  "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
 
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
12
- Version: 3.2
13
  License: GPLv2 or later
14
 
15
  == Description ==
@@ -29,7 +29,6 @@ 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
- * 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)
@@ -68,6 +67,9 @@ http://cagewebdev.com/index.php/wordpress-plugins/
68
  * 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)
69
 
70
  == Changelog ==
 
 
 
71
  = 3.2 [03/18/2015] =
72
  * NEW: MULTISITE support added
73
  * CHANGE: various minor improvements
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
  * 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)
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
+
73
  = 3.2 [03/18/2015] =
74
  * NEW: MULTISITE support added
75
  * CHANGE: various minor improvements
rvg-optimize-db.php CHANGED
@@ -1,7 +1,9 @@
1
  <?php
 
 
2
  /**
3
  * @package Optimize Database after Deleting Revisions
4
- * @version 3.2
5
  */
6
  /*
7
  Plugin Name: Optimize Database after Deleting Revisions
@@ -9,39 +11,12 @@ Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-rev
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.2
13
  */
14
 
15
- $odb_version = '3.2';
16
- $odb_release_date = '03/18/2015';
17
- // v3.2 - MULTISITE
18
- $odb_ms_prefixes = array();
19
- $odb_ms_blogids = array();
20
-
21
- // v3.2 - GET THE OPTIONS FROM THE TABLES OF THE MAIN SITE (IN CASE OF MULTISITE)
22
- if(function_exists('switch_to_blog')) switch_to_blog(1);
23
-
24
- // v3.2 - GET MULTISITE INFORMATION
25
- if(isset($wpdb))
26
- {
27
- $odb_ms_prefixes[0] = $wpdb->base_prefix;
28
- $odb_ms_blogids[0] = 1;
29
- if (function_exists('is_multisite') && is_multisite())
30
- { $odb_blogids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
31
- // FOR INSTANCE: mywp_2_, mywp_3_ etc.
32
- for($i=1; $i<count($odb_blogids); $i++)
33
- { $odb_ms_prefixes[$i] = $wpdb->base_prefix.$odb_blogids[$i].'_';
34
- $odb_ms_blogids[$i] = $odb_blogids[$i];
35
- }
36
- } // if (function_exists('is_multisite') && is_multisite())
37
- }
38
-
39
-
40
  /********************************************************************************************
41
 
42
  ADD THE LANGUAGE SUPPORT (LOCALIZATION)
43
-
44
- Since: v2.9
45
 
46
  *********************************************************************************************/
47
  function rvg_odb_action_init()
@@ -73,9 +48,7 @@ if(get_option('rvg_odb_adminmenu') != "Y") add_action('admin_menu', 'optimize_db
73
 
74
  /********************************************************************************************
75
 
76
- 'ICON MODE': ADD A LINK TO THE ADMIN MENU
77
-
78
- Since: v3.1.1
79
 
80
  *********************************************************************************************/
81
  function rvg_add_menu_page()
@@ -136,17 +109,15 @@ if(get_option('rvg_odb_adminmenu') == "Y") add_action('admin_menu', 'register_od
136
 
137
 
138
  /********************************************************************************************
139
-
140
- SHOW A LINK TO THE PLUGIN SETTINGS ON THE MAIN PLUGINS PAGE
141
-
142
- Since: v3.1
143
-
144
  *********************************************************************************************/
145
  function odb_settings_link($links)
146
  {
147
  array_unshift($links, '<a href="options-general.php?page=rvg_odb_admin">Settings</a>');
148
  return $links;
149
- } // odb_settings_link()
150
  add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link');
151
 
152
 
@@ -158,14 +129,13 @@ add_filter('plugin_action_links_'.plugin_basename(__FILE__), 'odb_settings_link'
158
  function rvg_odb_admin_bar()
159
  { global $wp_admin_bar;
160
  if (!is_super_admin() || !is_admin_bar_showing()) return;
161
-
162
  $siteurl = site_url('/');
163
  $wp_admin_bar->add_menu(
164
  array(
165
  'id' => 'optimize',
166
  'title' => __('Optimize DB (1 click)','rvg-optimize-database'),
167
  'href' => $siteurl.'wp-admin/tools.php?page=rvg-optimize-db.php&action=run' ));
168
- } // rvg_odb_admin_bar()
169
  $rvg_odb_adminbar = get_option('rvg_odb_adminbar');
170
  if($rvg_odb_adminbar == "Y") add_action('wp_before_admin_bar_render', 'rvg_odb_admin_bar');
171
 
@@ -177,7 +147,7 @@ if($rvg_odb_adminbar == "Y") add_action('wp_before_admin_bar_render', 'rvg_odb_a
177
  *********************************************************************************************/
178
  function odb_styles()
179
  { wp_enqueue_style ('odb', plugin_dir_url(__FILE__) . 'css/style.css',false,'1.0','all');
180
- } // odb_styles()
181
  add_action( 'admin_init', 'odb_styles' );
182
 
183
 
@@ -188,14 +158,14 @@ add_action( 'admin_init', 'odb_styles' );
188
  http://codex.wordpress.org/Plugin_API/Filter_Reference/cron_schedules
189
 
190
  *********************************************************************************************/
191
- function rvg_extra_schedules($schedules)
192
- { // ADD A WEEKLY SCHEDULE
193
  $schedules['weekly'] = array(
194
  'interval' => 604800,
195
  'display' => __('Once Weekly')
196
  );
197
  return $schedules;
198
- } // rvg_extra_schedules()
199
  add_filter( 'cron_schedules', 'rvg_extra_schedules' );
200
 
201
  add_action( 'rvg_optimize_database', 'rvg_optimize_db_cron' );
@@ -205,7 +175,7 @@ register_deactivation_hook( __FILE__, 'rvg_deactivate_plugin' );
205
  function rvg_deactivate_plugin()
206
  { // CLEAR CURRENT SCHEDULE (IF ANY)
207
  wp_clear_scheduled_hook('rvg_optimize_database');
208
- } // rvg_deactivate_plugin()
209
 
210
  // RE-SCHEDULE TASK WHEN RE-ACTIVATED (OR AFTER UPDATE)
211
  register_activation_hook( __FILE__, 'rvg_activate_plugin' );
@@ -216,7 +186,7 @@ function rvg_activate_plugin()
216
  if( !wp_next_scheduled( 'rvg_optimize_database' ))
217
  wp_schedule_event( time(), $rvg_odb_schedule, 'rvg_optimize_database' );
218
  }
219
- } // rvg_activate_plugin()
220
 
221
 
222
  /********************************************************************************************
@@ -226,7 +196,7 @@ function rvg_activate_plugin()
226
  *********************************************************************************************/
227
  function rvg_odb_settings_page()
228
  {
229
- global $odb_version, $odb_release_date, $wpdb, $table_prefix, $odb_ms_prefixes;
230
 
231
  $timezone_format = _x('YmdGis', 'timezone date format');
232
  $current_datetime = date_i18n($timezone_format);
@@ -241,7 +211,7 @@ function rvg_odb_settings_page()
241
  {
242
  // v2.8.3
243
  check_admin_referer('odb_action', 'odb_nonce');
244
-
245
  # DELETE ALL EXCLUDED TABLES
246
  $sql = "
247
  DELETE FROM $wpdb->options
@@ -347,9 +317,9 @@ function rvg_odb_settings_page()
347
  echo "<div class='updated odb-bold'><p>".
348
  __('Optimize Database after Deleting Revisions SETTINGS UPDATED','rvg-optimize-database').
349
  " - ";
350
- _e('Click <a href="tools.php?page=rvg-optimize-db.php" class="odb-bold">HERE</a> to run the optimization','rvg-optimize-database');
351
  echo "</p></div>";
352
- } // if (isset($_POST['info_update']))
353
 
354
  $rvg_odb_number = get_option('rvg_odb_number');
355
  if(!$rvg_odb_number) $rvg_odb_number = '0';
@@ -382,8 +352,7 @@ function rvg_odb_settings_page()
382
  if(!$rvg_odb_adminbar) $rvg_odb_adminbar = 'N';
383
 
384
  $rvg_odb_adminmenu = get_option('rvg_odb_adminmenu');
385
- if(!$rvg_odb_adminmenu) $rvg_odb_adminmenu = 'N';
386
-
387
  ?>
388
  <script type="text/javascript">
389
  function schedule_changed()
@@ -400,36 +369,20 @@ function schedule_changed()
400
  <?php // v2.8.3 ?>
401
  <?php wp_nonce_field( 'odb_action','odb_nonce' ); ?>
402
  <div class="wrap">
403
- <h2>
404
- <?php _e('Using Optimize Database after Deleting Revisions', 'rvg-optimize-database'); ?>
405
- </h2>
406
  <blockquote>
407
- <p class="odb-bold">'<span class="odb-italic">Optimize Database after Deleting Revisions</span> '
408
- <?php _e('is an one-click plugin to clean and optimize your WordPress database','rvg-optimize-database');?>
409
- </p>
410
- <p>
411
- <?php _e('Plugin version:','rvg-optimize-database');?>
412
- <br />
413
  <span class="odb-bold">v<?php echo $odb_version ?> (<?php echo $odb_release_date?>)</span></p>
414
- <p><span class="odb-bold">
415
- <?php _e('Author','rvg-optimize-database');?>
416
- :</span><br />
417
- <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,
418
- <?php _e('The Netherlands','rvg-optimize-database');?>
419
- <br />
420
- <span class="odb-bold">
421
- <?php _e('Plugin URL:','rvg-optimize-database');?>
422
- </span><br />
423
  <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 />
424
- <span class="odb-bold">
425
- <?php _e('Download URL:','rvg-optimize-database');?>
426
- </span><br />
427
  <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>
428
  <p>&nbsp;</p>
429
  </blockquote>
430
- <h2>
431
- <?php _e('Optimize Database after Deleting Revisions - Settings','rvg-optimize-database');?>
432
- </h2>
433
  <?php
434
  if($rvg_odb_adminbar == 'Y') $rvg_odb_adminbar_checked = ' checked="checked"'; else $rvg_odb_adminbar_checked = '';
435
  if($rvg_odb_adminmenu == 'Y') $rvg_odb_adminmenu_checked = ' checked="checked"'; else $rvg_odb_adminmenu_checked = '';
@@ -447,77 +400,48 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
447
  <tr>
448
  <td colspan="3" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="4">
449
  <tr>
450
- <td width="50%" align="right" valign="top"><span class="odb-bold">
451
- <?php _e('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>
452
- <br />
453
- <?php _e('(\'0\' means: delete <u>ALL</u> revisions)','rvg-optimize-database');?>
454
- </span></td>
455
  <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>
456
  </tr>
457
  <tr>
458
- <td width="50%" align="right" valign="top"><span class="odb-bold">
459
- <?php _e('Delete all trashed items','rvg-optimize-database');?>
460
- </span></td>
461
  <td width="50%" valign="top"><input name="rvg_clear_trash" type="checkbox" value="Y" <?php echo $rvg_clear_trash_checked?> /></td>
462
  </tr>
463
  <tr>
464
- <td width="50%" align="right" valign="top"><span class="odb-bold">
465
- <?php _e('Delete all spammed items','rvg-optimize-database');?>
466
- </span></td>
467
  <td width="50%" valign="top"><input name="rvg_clear_spam" type="checkbox" value="Y" <?php echo $rvg_clear_spam_checked?> /></td>
468
  </tr>
469
  <tr>
470
- <td width="50%" align="right" valign="top"><span class="odb-bold">
471
- <?php _e('Delete unused tags','rvg-optimize-database');?>
472
- </span></td>
473
  <td width="50%" valign="top"><input name="rvg_clear_tags" type="checkbox" value="Y" <?php echo $rvg_clear_tags_checked?> /></td>
474
  </tr>
475
  <tr>
476
- <td width="50%" align="right" valign="top"><span class="odb-bold">
477
- <?php _e('Delete expired transients','rvg-optimize-database');?>
478
- </span></td>
479
  <td width="50%" valign="top"><input name="rvg_clear_transients" type="checkbox" value="Y" <?php echo $rvg_clear_transients_checked?> /></td>
480
  </tr>
481
  <tr>
482
- <td width="50%" align="right" valign="top"><span class="odb-bold">
483
- <?php _e('Delete pingbacks and trackbacks','rvg-optimize-database');?>
484
- </span></td>
485
  <td width="50%" valign="top"><input name="rvg_clear_pingbacks" type="checkbox" value="Y" <?php echo $rvg_clear_pingbacks_checked?> /></td>
486
  </tr>
487
  <tr>
488
- <td width="50%" align="right" valign="top"><span class="odb-bold">
489
- <?php _e('Keep a log','rvg-optimize-database');?>
490
- </span></td>
491
  <td width="50%" valign="top"><input name="rvg_odb_logging_on" type="checkbox" value="Y" <?php echo $rvg_odb_logging_on_checked?> /></td>
492
  </tr>
493
  <tr>
494
- <td width="50%" align="right"><span class="odb-bold">
495
- <?php _e('Scheduler','rvg-optimize-database');?>
496
- </span></td>
497
  <td width="50%"><select name="rvg_odb_schedule" id="rvg_odb_schedule" onchange="schedule_changed();">
498
- <option selected="selected" value="">
499
- <?php _e('NOT SCHEDULED','rvg-optimize-database');?>
500
- </option>
501
- <option value="hourly">
502
- <?php _e('run optimization HOURLY','rvg-optimize-database');?>
503
- </option>
504
- <option value="twicedaily">
505
- <?php _e('run optimization TWICE A DAY','rvg-optimize-database');?>
506
- </option>
507
- <option value="daily">
508
- <?php _e('run optimization DAILY','rvg-optimize-database');?>
509
- </option>
510
- <option value="weekly">
511
- <?php _e('run optimization WEEKLY','rvg-optimize-database');?>
512
- </option>
513
  <?php /*?><option value="test">run optimization TEST</option><?php */?>
514
  </select>
515
  <script type="text/javascript">
516
  jQuery("#rvg_odb_schedule").val('<?php echo $rvg_odb_schedule; ?>');
517
  </script>
518
- <span id="schedulehour" style="display:none;"> <span class="odb-bold">
519
- <?php _e('Time','rvg-optimize-database');?>
520
- </span>
521
  <select name="rvg_odb_schedulehour" id="rvg_odb_schedulehour">
522
  <?php
523
  for($i=0; $i<=23; $i++)
@@ -535,18 +459,14 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
535
  <script type="text/javascript">schedule_changed();</script></td>
536
  </tr>
537
  <tr>
538
- <td align="right" valign="top"><span class="odb-bold">
539
- <?php _e('Show \'1-click\' link in Admin Bar','rvg-optimize-database');?>
540
- </span></td>
541
  <td valign="top"><input name="rvg_odb_adminbar" type="checkbox" value="Y" <?php echo $rvg_odb_adminbar_checked?> />
542
- <?php _e('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
543
  </tr>
544
  <tr>
545
- <td align="right" valign="top"><span class="odb-bold">
546
- <?php _e('Show an icon in the Admin Menu','rvg-optimize-database');?>
547
- </span></td>
548
  <td valign="top"><input name="rvg_odb_adminmenu" type="checkbox" value="Y" <?php echo $rvg_odb_adminmenu_checked?> />
549
- <?php _e('(change will be visible after loading the next page)','rvg-optimize-database');?></td>
550
  </tr>
551
  </table></td>
552
  </tr>
@@ -558,16 +478,8 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
558
  <tr>
559
  <td colspan="4" valign="top"><table id="table_list" width="100%" border="0" cellspacing="0" cellpadding="4" style="display:block;">
560
  <tr>
561
- <td colspan="4" align="center"><span class="odb-bold">
562
- <?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');?>
563
- <br />
564
- <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',true);">
565
- <?php _e('check all tables','rvg-optimize-database');?>
566
- </a> | <a href="javascript:;" onclick="jQuery('[id^=cb_]').attr('checked',false);">
567
- <?php _e('uncheck all tables','rvg-optimize-database');?>
568
- </a> | <a href="javascript:;" onclick="jQuery(':not([id^=cb_<?php echo $table_prefix; ?>])').filter('[id^=cb_]').attr('checked',true);">
569
- <?php _e('check all NON-WordPress tables','rvg-optimize-database');?>
570
- </a></td>
571
  </tr>
572
  <tr>
573
  <?php
@@ -605,16 +517,16 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
605
  </fieldset>
606
  </blockquote>
607
  <p class="submit">
608
- <input class="button-primary button-large" type='submit' name='info_update' value='<?php _e('Save Settings','rvg-optimize-database');?>' class="odb-bold" />
609
  &nbsp;
610
- <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'" />
611
  </p>
612
  </div>
613
  </form>
614
  </div>
615
  <!-- ocb-options-form -->
616
  <?php
617
- } // rvg_odb_settings_page()
618
 
619
 
620
  /********************************************************************************************
@@ -625,7 +537,7 @@ if($rvg_odb_logging_on == 'Y') $rvg_odb_logging_on_checked = ' checked="checke
625
  *********************************************************************************************/
626
  function rvg_optimize_db()
627
  {
628
- global $wpdb, $odb_version, $odb_ms_prefixes;
629
 
630
  // PAGE LOAD COUNTER
631
  $time = microtime();
@@ -633,8 +545,8 @@ function rvg_optimize_db()
633
  $time = $time[1] + $time[0];
634
  $odb_start_time = $time;
635
 
636
- $timezone_format = _x('G:i', 'timezone date format');
637
- $current_hour = date_i18n($timezone_format);
638
 
639
  if(isset($_REQUEST['action']))
640
  if($_REQUEST['action'] == "delete_log")
@@ -728,86 +640,56 @@ function rvg_optimize_db()
728
 
729
  $sql = "
730
  SELECT COUNT(*) cnt
731
- FROM $wpdb->options
732
- WHERE option_name LIKE 'rvg_ex_%'
733
  ";
734
  $results = $wpdb->get_results($sql);
735
  $number_excluded = $results[0]->cnt;
736
  ?>
737
  <div class="odb-padding-left">
738
- <h2>
739
- <?php _e('Optimize your WordPress Database','rvg-optimize-database');?>
740
- </h2>
741
  <?php
742
  if(isset($_REQUEST['action']))
743
  if($_REQUEST['action'] == "delete_log")
744
  echo '<div class="updated odb-updated"><p><span class="odb-bold">Optimize Database after Deleting Revisions - LOG FILE DELETED</span></p></div>';
745
  ?>
746
- <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> -
747
- <?php _e('A WordPress Plugin by','rvg-optimize-database');?>
748
- <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,
749
- <?php _e('The Netherlands','rvg-optimize-database');?>
750
- </span></p>
751
- <p>
752
- <?php _e('Current settings','rvg-optimize-database');?>
753
- :<br />
754
- <span class="odb-bold">
755
- <?php _e('Maximum number of - most recent - revisions to keep per post / page','rvg-optimize-database');?>
756
- :</span> <span class="odb-bold odb-blue"><?php echo $max_revisions?></span><br />
757
- <span class="odb-bold">
758
- <?php _e('Delete all trashed items','rvg-optimize-database');?>
759
- :</span> <span class="odb-bold odb-blue"><?php echo $clear_trash_yn?></span><br />
760
- <span class="odb-bold">
761
- <?php _e('Delete all spammed items','rvg-optimize-database');?>
762
- :</span> <span class="odb-bold odb-blue"><?php echo $clear_spam_yn?></span><br />
763
- <span class="odb-bold">
764
- <?php _e('Delete unused tags','rvg-optimize-database');?>
765
- :</span> <span class="odb-bold odb-blue"><?php echo $clear_tags_yn?></span><br />
766
- <span class="odb-bold">
767
- <?php _e('Delete expired transients','rvg-optimize-database');?>
768
- :</span> <span class="odb-bold odb-blue"><?php echo $clear_transients_yn?></span><br />
769
- <span class="odb-bold">
770
- <?php _e('Delete pingbacks and trackbacks','rvg-optimize-database');?>
771
- :</span> <span class="odb-bold odb-blue"><?php echo $clear_pingbacks_yn?></span><br />
772
- <span class="odb-bold">
773
- <?php _e('Keep a log','rvg-optimize-database');?>
774
- :</span> <span class="odb-bold odb-blue"><?php echo $rvg_odb_logging_on_yn?></span><br />
775
- <span class="odb-bold">
776
- <?php _e('Number of excluded tables','rvg-optimize-database');?>
777
- :</span> <span class="odb-bold odb-blue"><?php echo $number_excluded?></span><br />
778
- <span class="odb-bold">
779
- <?php _e('Scheduler','rvg-optimize-database');?>
780
- :</span> <span class="odb-bold odb-blue"><?php echo $rvg_odb_schedule_txt?></span>
781
  <?php
782
  if($nextrun)
783
  {
784
  ?>
785
  <br />
786
- <span class="odb-bold">
787
- <?php _e('Next scheduled run','rvg-optimize-database');?>
788
- :</span> <span class="odb-bold odb-blue"><?php echo $nextrun?> hrs (current server time: <?php echo $current_hour?>)</span>
789
  <?php
790
  }
791
  if($total_savings)
792
  {
793
  ?>
794
  <br />
795
- <span class="odb-bold">
796
- <?php _e('Total savings since the first run','rvg-optimize-database');?>
797
- :</span> <span class="odb-bold odb-blue"><?php echo rvg_format_size($total_savings); ?></span>
798
  <?php
799
  }
800
  ?>
801
  <p class="submit">
802
- <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'" />
803
  <?php
804
  if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
805
  {
806
  ?>
807
  &nbsp;
808
- <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?>')" />
809
  &nbsp;
810
- <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'" />
811
  <?php
812
  }
813
  $action = '';
@@ -816,7 +698,7 @@ function rvg_optimize_db()
816
  {
817
  ?>
818
  &nbsp;
819
- <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" />
820
  <?php
821
  }
822
  ?>
@@ -827,9 +709,7 @@ function rvg_optimize_db()
827
  if(isset($_REQUEST['action'])) $action = $_REQUEST['action'];
828
  if($action != 'run') return;
829
  ?>
830
- <h2 class="odb-padding-left">
831
- <?php _e('Starting Optimization','rvg-optimize-database');?>
832
- ...</h2>
833
  <?php
834
  // GET THE SIZE OF THE DATABASE BEFORE OPTIMIZATION
835
  $start_size = rvg_get_db_size();
@@ -848,22 +728,20 @@ function rvg_optimize_db()
848
  ?>
849
  <table border="0" cellspacing="8" cellpadding="2">
850
  <tr>
851
- <td colspan="4" class="odb-bold odb-blue"><?php _e('DELETING REVISIONS','rvg-optimize-database');?>
852
- :</td>
853
  </tr>
854
  <tr>
855
  <th align="right" class="odb-border-bottom">#</th>
856
- <th align="left" class="odb-border-bottom"><?php _e('prefix', 'rvg-optimize-database');?></th>
857
- <th align="left" class="odb-border-bottom"><?php _e('post / page','rvg-optimize-database');?></th>
858
- <th align="left" class="odb-border-bottom"><?php _e('revision date','rvg-optimize-database');?></th>
859
- <th align="right" class="odb-border-bottom"><?php _e('revisions deleted','rvg-optimize-database');?></th>
860
  </tr>
861
  <?php
862
  // LOOP THROUGH THE REVISIONS AND DELETE THEM
863
  $total_deleted = rvg_delete_revisions($results, true, $max_revisions);
864
  ?>
865
  <tr>
866
- <td colspan="4" align="right" class="odb-border-top odb-bold"><?php _e('total number of revisions deleted','rvg-optimize-database');?></td>
867
  <td align="right" class="odb-border-top odb-bold"><?php echo $total_deleted?></td>
868
  </tr>
869
  </table>
@@ -874,8 +752,7 @@ function rvg_optimize_db()
874
  ?>
875
  <table border="0" cellspacing="8" cellpadding="2">
876
  <tr>
877
- <td class="odb-not-found"><?php _e('No REVISIONS found to delete','rvg-optimize-database');?>
878
- ...</td>
879
  </tr>
880
  </table>
881
  <?php
@@ -884,7 +761,6 @@ function rvg_optimize_db()
884
  // NUMBER OF DELETED REVISIONS FOR LOG FILE
885
  $log_arr["revisions"] = $total_deleted;
886
 
887
-
888
  /****************************************************************************************
889
 
890
  DELETE TRASHED ITEMS
@@ -902,15 +778,13 @@ function rvg_optimize_db()
902
  <div class="odb-separator"></div>
903
  <table border="0" cellspacing="8" cellpadding="2">
904
  <tr>
905
- <td colspan="4" class="odb-found"><?php _e('DELETING TRASHED ITEMS','rvg-optimize-database');?>
906
- :</td>
907
  </tr>
908
  <tr>
909
  <th align="right" class="odb-border-bottom">#</th>
910
- <th align="left" class="odb-border-bottom"><?php _e('prefix', 'rvg-optimize-database');?></th>
911
- <th align="left" class="odb-border-bottom"><?php _e('type','rvg-optimize-database');?></th>
912
- <th align="left" class="odb-border-bottom"><?php _e('IP address / title','rvg-optimize-database');?></th>
913
- <th align="left" nowrap="nowrap" class="odb-border-bottom"><?php _e('date','rvg-optimize-database');?></th>
914
  </tr>
915
  <?php
916
  // LOOP THROUGH THE TRASHED ITEMS AND DELETE THEM
@@ -925,8 +799,7 @@ function rvg_optimize_db()
925
  <div class="odb-separator"></div>
926
  <table border="0" cellspacing="8" cellpadding="2">
927
  <tr>
928
- <td class="odb-not-found"><?php _e('No TRASHED ITEMS found to delete','rvg-optimize-database');?>
929
- ...</td>
930
  </tr>
931
  </table>
932
  <?php
@@ -934,8 +807,8 @@ function rvg_optimize_db()
934
 
935
  // NUMBER OF DELETED TRASH FOR LOG FILE
936
  $log_arr["trash"] = $total_deleted;
 
937
  } // if($clear_trash == 'Y')
938
-
939
 
940
  /****************************************************************************************
941
 
@@ -954,15 +827,13 @@ function rvg_optimize_db()
954
  <div class="odb-separator"></div>
955
  <table border="0" cellspacing="8" cellpadding="2">
956
  <tr>
957
- <td colspan="4" class="odb-found"><?php _e('DELETING SPAMMED ITEMS','rvg-optimize-database');?>
958
- :</td>
959
  </tr>
960
  <tr>
961
  <th align="right" class="odb-border-bottom">#</th>
962
- <th align="left" class="odb-border-bottom"><?php _e('prefix', 'rvg-optimize-database');?></th>
963
- <th align="left" class="odb-border-bottom"><?php _e('comment author','rvg-optimize-database');?></th>
964
- <th align="left" class="odb-border-bottom"><?php _e('comment author email','rvg-optimize-database');?></th>
965
- <th align="left" nowrap="nowrap" class="odb-border-bottom"><?php _e('comment date','rvg-optimize-database');?></th>
966
  </tr>
967
  <?php
968
  // LOOP THROUGH SPAMMED ITEMS AND DELETE THEM
@@ -977,8 +848,7 @@ function rvg_optimize_db()
977
  <div class="odb-separator"></div>
978
  <table border="0" cellspacing="8" cellpadding="2">
979
  <tr>
980
- <td class="odb-not-found"><?php _e('No SPAMMED ITEMS found to delete','rvg-optimize-database');?>
981
- ...</td>
982
  </tr>
983
  </table>
984
  <?php
@@ -988,7 +858,6 @@ function rvg_optimize_db()
988
 
989
  // NUMBER OF SPAM DELETED FOR LOG FILE
990
  $log_arr["spam"] = $total_deleted;
991
-
992
 
993
  /****************************************************************************************
994
 
@@ -1006,9 +875,7 @@ function rvg_optimize_db()
1006
  <div class="odb-separator"></div>
1007
  <table border="0" cellspacing="8" cellpadding="2">
1008
  <tr>
1009
- <td><span class="odb-found">
1010
- <?php _e('NUMBER OF UNUSED TAGS DELETED','rvg-optimize-database');?>
1011
- :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1012
  </tr>
1013
  </table>
1014
  <?php
@@ -1019,8 +886,7 @@ function rvg_optimize_db()
1019
  <div class="odb-separator"></div>
1020
  <table border="0" cellspacing="8" cellpadding="2">
1021
  <tr>
1022
- <td class="odb-not-found"><?php _e('No UNUSED TAGS found to delete','rvg-optimize-database');?>
1023
- ...</td>
1024
  </tr>
1025
  </table>
1026
  <?php
@@ -1031,7 +897,6 @@ function rvg_optimize_db()
1031
  // NUMBER OF tags DELETED FOR LOG FILE
1032
  $log_arr["tags"] = $total_deleted;
1033
 
1034
-
1035
  /****************************************************************************************
1036
 
1037
  DELETE EXPIRED TRANSIENTS
@@ -1048,9 +913,7 @@ function rvg_optimize_db()
1048
  <div class="odb-separator"></div>
1049
  <table border="0" cellspacing="8" cellpadding="2">
1050
  <tr>
1051
- <td><span class="odb-found">
1052
- <?php _e('NUMBER OF EXPIRED TRANSIENTS DELETED','rvg-optimize-database');?>
1053
- :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1054
  </tr>
1055
  </table>
1056
  <?php
@@ -1061,8 +924,7 @@ function rvg_optimize_db()
1061
  <div class="odb-separator"></div>
1062
  <table border="0" cellspacing="8" cellpadding="2">
1063
  <tr>
1064
- <td class="odb-not-found"><?php _e('No EXPIRED TRANSIENTS found to delete','rvg-optimize-database');?>
1065
- ...</td>
1066
  </tr>
1067
  </table>
1068
  <?php
@@ -1089,9 +951,7 @@ function rvg_optimize_db()
1089
  <div class="odb-separator"></div>
1090
  <table border="0" cellspacing="8" cellpadding="2">
1091
  <tr>
1092
- <td><span class="odb-found">
1093
- <?php _e('NUMBER OF PINGBACKS AND TRACKBACKS DELETED','rvg-optimize-database');?>
1094
- :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1095
  </tr>
1096
  </table>
1097
  <?php
@@ -1102,8 +962,7 @@ function rvg_optimize_db()
1102
  <div class="odb-separator"></div>
1103
  <table border="0" cellspacing="8" cellpadding="2">
1104
  <tr>
1105
- <td class="odb-not-found"><?php _e('No PINGBACKS nor TRACKBACKS found to delete','rvg-optimize-database');?>
1106
- ...</td>
1107
  </tr>
1108
  </table>
1109
  <?php
@@ -1127,9 +986,7 @@ function rvg_optimize_db()
1127
  <div class="odb-separator"></div>
1128
  <table border="0" cellspacing="8" cellpadding="2">
1129
  <tr>
1130
- <td colspan="4"><span class="odb-found">
1131
- <?php _e('NUMBER OF POSTMETA ORPHANS DELETED','rvg-optimize-database');?>
1132
- :</span> <span class="odb-bold"><?php echo $total_deleted;?></span></td>
1133
  </tr>
1134
  </table>
1135
  <?php
@@ -1140,8 +997,7 @@ function rvg_optimize_db()
1140
  <div class="odb-separator"></div>
1141
  <table border="0" cellspacing="8" cellpadding="2">
1142
  <tr>
1143
- <td class="odb-not-found"><?php _e('No POSTMETA ORPHANS found to delete','rvg-optimize-database');?>
1144
- ...</td>
1145
  </tr>
1146
  </table>
1147
  <?php
@@ -1159,16 +1015,15 @@ function rvg_optimize_db()
1159
  <div class="odb-optimizing-table">
1160
  <table border="0" cellspacing="8" cellpadding="2">
1161
  <tr>
1162
- <td colspan="4" class="odb-bold odb-blue"><?php _e('OPTIMIZING DATABASE TABLES','rvg-optimize-database');?>
1163
- :</td>
1164
  </tr>
1165
  <tr>
1166
  <th class="odb-border-bottom" align="right">#</th>
1167
- <th class="odb-border-bottom" align="left"><?php _e('table name','rvg-optimize-database');?></th>
1168
- <th class="odb-border-bottom" align="left"><?php _e('optimization result','rvg-optimize-database');?></th>
1169
- <th class="odb-border-bottom" align="left"><?php _e('engine','rvg-optimize-database');?></th>
1170
- <th class="odb-border-bottom" align="right"><?php _e('table rows','rvg-optimize-database');?></th>
1171
- <th class="odb-border-bottom" align="right"><?php _e('table size','rvg-optimize-database');?></th>
1172
  </tr>
1173
  <?php
1174
  # OPTIMIZE THE DATABASE TABLES
@@ -1193,28 +1048,26 @@ function rvg_optimize_db()
1193
  update_option('rvg_odb_total_savings',$total_savings);
1194
  ?>
1195
  <div class="odb-separator"></div>
1196
- <span class="odb-bold odb-blue odb-padding-left">
1197
- <?php _e('SAVINGS','rvg-optimize-database');?>
1198
- </span><br />
1199
  <table border="0" cellspacing="8" cellpadding="2">
1200
  <tr>
1201
  <th>&nbsp;</th>
1202
- <th class="odb-border-bottom"><?php _e('size of the database','rvg-optimize-database');?></th>
1203
  </tr>
1204
  <tr>
1205
- <td align="right"><?php _e('BEFORE optimization','rvg-optimize-database');?></td>
1206
  <td align="right" class="odb-bold"><?php echo rvg_format_size($start_size,3); ?></td>
1207
  </tr>
1208
  <tr>
1209
- <td align="right"><?php _e('AFTER optimization','rvg-optimize-database');?></td>
1210
  <td align="right" class="odb-bold"><?php echo rvg_format_size($end_size,3); ?></td>
1211
  </tr>
1212
  <tr>
1213
- <td align="right" class="odb-bold"><?php _e('SAVINGS THIS TIME','rvg-optimize-database');?></td>
1214
  <td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size(($start_size - $end_size),3); ?></td>
1215
  </tr>
1216
  <tr>
1217
- <td align="right" class="odb-bold"><?php _e('TOTAL SAVINGS SINCE THE FIRST RUN','rvg-optimize-database');?></td>
1218
  <td align="right" class="odb-border-top odb-bold"><?php echo rvg_format_size($total_savings,3); ?></td>
1219
  </tr>
1220
  </table>
@@ -1225,16 +1078,11 @@ $time = microtime();
1225
  $time = explode(' ', $time);
1226
  $time = $time[1] + $time[0];
1227
  $finish = $time;
1228
-
1229
  $total_time = round(($finish - $odb_start_time), 4);
1230
  ?>
1231
- <span class="odb-bold odb-blue odb-padding-left">
1232
- <?php _e('DONE','rvg-optimize-database');?>
1233
- !</span><br />
1234
  <br />
1235
- <span class="odb-padding-left">
1236
- <?php _e('Optimization took', 'rvg-optimize-database')?>&nbsp;<strong><?php echo $total_time;?></strong>&nbsp;<?php _e('seconds', 'rvg-optimize-database')?>
1237
- .</span>
1238
  <?php
1239
  if(file_exists(dirname(__FILE__).'/rvg-optimize-db-log.html'))
1240
  {
@@ -1242,12 +1090,12 @@ $total_time = round(($finish - $odb_start_time), 4);
1242
  <br />
1243
  <br />
1244
  &nbsp;
1245
- <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?>')" />
1246
  &nbsp;
1247
- <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'" />
1248
  <?php
1249
  }
1250
- } // rvg_optimize_db()
1251
 
1252
 
1253
  /********************************************************************************************
@@ -1392,14 +1240,12 @@ function rvg_optimize_db_cron()
1392
  $total_savings += ($start_size - $end_size);
1393
  update_option('rvg_odb_total_savings',$total_savings);
1394
 
1395
- } // rvg_optimize_db_cron()
1396
 
1397
 
1398
  /********************************************************************************************
1399
 
1400
  DELETE THE REVISIONS
1401
-
1402
- v3.2: MULTISITE
1403
 
1404
  *********************************************************************************************/
1405
  function rvg_delete_revisions($results, $display, $max_revisions)
@@ -1410,24 +1256,22 @@ function rvg_delete_revisions($results, $display, $max_revisions)
1410
  $total_deleted = 0;
1411
 
1412
  for($i=0; $i<count($results); $i++)
1413
- { $nr_to_delete = $results[$i]['cnt'] - $max_revisions;
1414
  $total_deleted += $nr_to_delete;
1415
-
1416
  if($display)
1417
  {
1418
  ?>
1419
  <tr>
1420
  <td align="right" valign="top"><?php echo $nr?>.</td>
1421
- <td align="left" valign="top"><?php echo $results[$i]['site']?></td>
1422
- <td valign="top" class="odb-bold"><?php echo $results[$i]['post_title']?></td>
1423
  <td valign="top"><?php
1424
  } // if($display)
1425
 
1426
  $sql_get_posts = "
1427
  SELECT `ID`, `post_modified`
1428
- FROM ".$results[$i]['site']."posts
1429
- WHERE `post_parent`=".$results[$i]['post_parent']."
1430
- AND `post_type`='revision'
1431
  ORDER BY `post_modified` ASC
1432
  ";
1433
  $results_get_posts = $wpdb->get_results($sql_get_posts);
@@ -1437,7 +1281,7 @@ function rvg_delete_revisions($results, $display, $max_revisions)
1437
  if($display) echo $results_get_posts[$j]->post_modified.'<br />';
1438
 
1439
  $sql_delete = "
1440
- DELETE FROM ".$results[$i]['site']."posts
1441
  WHERE `ID` = ".$results_get_posts[$j]->ID."
1442
  ";
1443
  $wpdb->get_results($sql_delete);
@@ -1453,16 +1297,13 @@ function rvg_delete_revisions($results, $display, $max_revisions)
1453
  <?php
1454
  } // if($display)
1455
  } // for($i=0; $i<count($results); $i++)
1456
-
1457
  return $total_deleted;
1458
- } // rvg_delete_revisions()
1459
 
1460
 
1461
  /********************************************************************************************
1462
 
1463
  DELETE TRASHED POSTS AND PAGES
1464
-
1465
- v3.2: MULTISITE
1466
 
1467
  *********************************************************************************************/
1468
  function rvg_delete_trash($results, $display)
@@ -1471,57 +1312,52 @@ function rvg_delete_trash($results, $display)
1471
 
1472
  $nr = 1;
1473
  $total_deleted = count($results);
1474
-
1475
- for($i=0; $i<$total_deleted; $i++)
1476
  { if($display)
1477
  {
1478
  ?>
1479
  <tr>
1480
  <td align="right" valign="top"><?php echo $nr; ?></td>
1481
- <td align="left" valign="top"><?php echo $results[$i]['site']?></td>
1482
- <td valign="top"><?php echo $results[$i]['post_type']; ?></td>
1483
- <td valign="top"><?php echo $results[$i]['title']; ?></td>
1484
- <td valign="top" nowrap="nowrap"><?php echo $results[$i]['modified']; ?></td>
1485
  </tr>
1486
  <?php
1487
  }
1488
-
1489
- if($results[$i]['post_type'] == 'comment')
1490
  { // DELETE META DATA (IF ANY...)
1491
  $sql_delete = "
1492
- DELETE FROM ".$results[$i]['site']."commentmeta
1493
- WHERE `comment_id` = ".$results[$i]['id']."
1494
  ";
1495
  $wpdb->get_results($sql_delete);
1496
  }
1497
 
1498
- // DELETE TRASHED POSTS / PAGES
1499
- $sql_delete = "
1500
- DELETE FROM ".$results[$i]['site']."posts
1501
- WHERE `post_status` = 'trash'
1502
- ";
1503
- $wpdb->get_results($sql_delete);
1504
-
1505
- // DELETE TRASHED COMMENTS
1506
- $sql_delete = "
1507
- DELETE FROM ".$results[$i]['site']."comments
1508
- WHERE `comment_approved` = 'trash'
1509
- ";
1510
- $wpdb->get_results($sql_delete);
1511
-
1512
  $nr++;
1513
  } // for($i=0; $i<count($results); $i++)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1514
 
1515
  return $total_deleted;
1516
 
1517
- } // rvg_delete_trash()
1518
 
1519
 
1520
  /********************************************************************************************
1521
 
1522
  DELETE SPAMMED ITEMS
1523
-
1524
- v3.2: MULTISITE
1525
 
1526
  *********************************************************************************************/
1527
  function rvg_delete_spam($results, $display)
@@ -1536,88 +1372,68 @@ function rvg_delete_spam($results, $display)
1536
  ?>
1537
  <tr>
1538
  <td align="right" valign="top"><?php echo $nr; ?></td>
1539
- <td align="left" valign="top"><?php echo $results[$i]['site']?></td>
1540
- <td valign="top"><?php echo $results[$i]['comment_author']; ?></td>
1541
- <td valign="top"><?php echo $results[$i]['comment_author_email']; ?></td>
1542
- <td valign="top" nowrap="nowrap"><?php echo $results[$i]['comment_date']; ?></td>
1543
  </tr>
1544
  <?php
1545
  } // if($display)
1546
-
1547
  $sql_delete = "
1548
- DELETE FROM ".$results[$i]['site']."commentmeta
1549
- WHERE `comment_id` = ".$results[$i]['comment_ID']."
1550
  ";
1551
  $wpdb->get_results($sql_delete);
1552
-
1553
- $sql_delete = "
1554
- DELETE FROM ".$results[$i]['site']."comments
1555
- WHERE `comment_approved` = 'spam'
1556
- ";
1557
- $wpdb->get_results($sql_delete);
1558
-
1559
  $nr++;
1560
  } // for($i=0; $i<count($results); $i++)
1561
 
 
 
 
 
 
 
1562
  return $total_deleted;
1563
 
1564
- } // rvg_delete_spam()
1565
 
1566
 
1567
  /********************************************************************************************
1568
 
1569
  DELETE UNUSED TAGS
1570
-
1571
- v3.2: MULTISITE
1572
 
1573
  *********************************************************************************************/
1574
  function rvg_delete_tags()
1575
  {
1576
- global $odb_ms_blogids, $odb_ms_prefixes;
1577
-
1578
  $total_deleted = 0;
1579
 
1580
- // LOOP THROUGH THE NETWORK
1581
- for($i=0; $i<count($odb_ms_blogids); $i++)
1582
- {
1583
- if(function_exists('switch_to_blog')) switch_to_blog($odb_ms_blogids[$i]);
1584
-
1585
- $tags = get_terms('post_tag', array('hide_empty' => 0));
1586
- for($j=0; $j<count($tags); $j++)
1587
- {
1588
- if($tags[$i]->count < 1)
1589
- { if(!rvg_delete_tags_is_scheduled($tags[$i]->term_id, $odb_ms_prefixes[$i]))
1590
- { // v3.0: TAG NOT USED IN SCHEDULED POSTS: CAN BE DELETED
1591
- $total_deleted++;
1592
- wp_delete_term($tags[$i]->term_id, 'post_tag');
1593
- }
1594
- }
1595
  }
1596
- } // for($i=0; $i<count($odb_ms_blogids); $i++)
1597
-
1598
- // SWITCH BACK TO MAIN SITE
1599
- if(function_exists('switch_to_blog')) switch_to_blog(1);
1600
-
1601
  return $total_deleted;
1602
- } // rvg_delete_tags()
1603
 
1604
 
1605
  /********************************************************************************************
1606
 
1607
- IS THE UNUSED TAG USED IN ONE OR MORE SCHEDULED POSTS?
1608
-
1609
- Since: v3.0
1610
-
1611
- v3.2: MULTISITE
1612
 
1613
  *********************************************************************************************/
1614
- function rvg_delete_tags_is_scheduled($term_id, $odb_prefix)
1615
  {
1616
  global $wpdb;
1617
-
1618
  $sql_get_posts = "
1619
  SELECT p.post_status
1620
- FROM ".$odb_prefix."term_relationships t, ".$odb_prefix."posts p
1621
  WHERE t.term_taxonomy_id = '".$term_id."'
1622
  AND t.object_id = p.ID
1623
  ";
@@ -1634,193 +1450,171 @@ function rvg_delete_tags_is_scheduled($term_id, $odb_prefix)
1634
  /********************************************************************************************
1635
 
1636
  DELETE EXPIRED TRANSIENTS
1637
-
1638
- v3.2: MULTISITE
1639
 
1640
  *********************************************************************************************/
1641
  function rvg_delete_transients()
1642
  {
1643
- global $wpdb, $odb_ms_prefixes;
1644
 
1645
- $delay = time() - 60; // ONE MINUTE DELAY
1646
 
1647
  $total_deleted = 0;
1648
-
1649
- // LOOP THROUGH THE NETWORK
1650
- for($i=0; $i<count($odb_ms_prefixes); $i++)
1651
- {
1652
- $sql = "
1653
- SELECT *
1654
- FROM ".$odb_ms_prefixes[$i]."options
1655
- WHERE (
1656
- option_name LIKE '_transient_timeout_%'
1657
- OR option_name LIKE '_site_transient_timeout_%'
1658
- OR option_name LIKE 'displayed_galleries_%'
1659
- )
1660
- AND option_value < '$delay'
1661
- ";
1662
 
1663
- $results = $wpdb->get_results($sql);
1664
- $total_deleted = count($results);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1665
 
1666
- $sql = "
1667
- DELETE FROM ".$odb_ms_prefixes[$i]."options
1668
- WHERE (
1669
- option_name LIKE '_transient_timeout_%'
1670
- OR option_name LIKE '_site_transient_timeout_%'
1671
- OR option_name LIKE 'displayed_galleries_%'
1672
- )
1673
- AND option_value < '$delay'
1674
- ";
1675
 
1676
- $wpdb->get_results($sql);
1677
-
1678
- $sql = "
1679
- SELECT *
1680
- FROM ".$odb_ms_prefixes[$i]."options
1681
- WHERE (
1682
- option_name LIKE '_transient_timeout_%'
1683
- OR option_name LIKE '_site_transient_timeout_%'
1684
- )
1685
- AND option_value < '$delay'
1686
- ";
1687
-
1688
- $results = $wpdb->get_results($sql);
1689
- $total_deleted += count($results);
1690
 
1691
- $sql = "
1692
- DELETE FROM ".$odb_ms_prefixes[$i]."options
1693
- WHERE (
1694
- option_name LIKE '_transient_timeout_%'
1695
- OR option_name LIKE '_site_transient_timeout_%'
1696
- )
1697
- AND option_value < '$delay'
1698
- ";
1699
-
1700
- $wpdb->get_results($sql);
1701
- }
1702
 
1703
  return $total_deleted;
1704
- } // rvg_delete_transients()
1705
 
1706
 
1707
  /********************************************************************************************
1708
 
1709
- DELETE PINGBACKS AND TRACKBACKS
1710
-
1711
- Since: v3.1
1712
-
1713
- v3.2: MULTISITE
1714
 
1715
  *********************************************************************************************/
1716
  function rvg_delete_pingbacks()
1717
  {
1718
- global $wpdb, $odb_ms_prefixes;
1719
 
1720
  $total_deleted = 0;
1721
-
1722
- // LOOP THROUGH THE NETWORK
1723
- for($i=0; $i<count($odb_ms_prefixes); $i++)
1724
- {
1725
- $sql = "
1726
- SELECT `comment_ID`
1727
- FROM ".$odb_ms_prefixes[$i]."comments
1728
- WHERE (
1729
- `comment_type` = 'pingback'
1730
- OR `comment_type` = 'trackback'
1731
- )
1732
- ";
1733
 
1734
- $results = $wpdb->get_results($sql);
1735
- $total_deleted = count($results);
 
 
 
 
 
 
1736
 
1737
- for($j=0; $j<count($results); $j++)
1738
- { // DELETE METADATA FOR THIS COMMENT (IF ANY)
1739
- $sql_delete_meta = "
1740
- DELETE FROM ".$odb_ms_prefixes[$i]."commentmeta
1741
- WHERE `comment_id` = ".$results[$j]->comment_ID."
1742
- ";
1743
- $wpdb->get_results($sql_delete_meta);
1744
- }
1745
 
1746
- // DELETE COMMENTS
1747
- $sql_delete_comments = "
1748
- DELETE FROM ".$odb_ms_prefixes[$i]."comments
1749
- WHERE (
1750
- `comment_type` = 'pingback'
1751
- OR `comment_type` = 'trackback'
1752
- )
1753
  ";
1754
- $wpdb->get_results($sql_delete_comments);
1755
  }
 
 
 
 
 
 
 
 
 
1756
 
1757
  return $total_deleted;
1758
- } // rvg_delete_pingbacks()
1759
 
1760
 
1761
  /********************************************************************************************
1762
 
1763
- DELETE ORPHAN POSTMETA RECORDS - v3.2 MULTISITE
1764
-
1765
- Since: v2.2.7
1766
-
1767
- v3.2: MULTISITE
1768
 
1769
  *********************************************************************************************/
1770
  function rvg_delete_orphans($display)
1771
  {
1772
- global $wpdb, $odb_ms_prefixes;
1773
 
1774
  $meta_orphans = 0;
1775
  $post_orphans = 0;
1776
 
1777
- // LOOP THROUGH THE NETWORK
1778
- for($i=0; $i<count($odb_ms_prefixes); $i++)
1779
- {
1780
- // DELETE POST ORPHANS (AUTO DRAFTS)
1781
- $sql_delete = "
1782
- SELECT COUNT(*) cnt
1783
- FROM ".$odb_ms_prefixes[$i]."posts
1784
- WHERE ID NOT IN (SELECT post_id FROM ".$odb_ms_prefixes[$i]."postmeta)
 
 
 
 
 
 
 
 
 
1785
  AND post_status = 'auto-draft'
1786
  ";
 
 
1787
 
1788
- $results = $wpdb->get_results($sql_delete);
1789
-
1790
- $post_orphans = $results[0]->cnt;
1791
-
1792
- if($post_orphans > 0)
1793
- { $sql_delete = "
1794
- DELETE FROM ".$odb_ms_prefixes[$i]."posts
1795
- WHERE ID NOT IN (SELECT post_id FROM ".$odb_ms_prefixes[$i]."postmeta)
1796
- AND post_status = 'auto-draft'
1797
- ";
1798
- $wpdb->get_results($sql_delete);
1799
- }
1800
-
1801
- // DELETE POSTMETA ORPHANS
1802
- $sql_delete = "
1803
- SELECT COUNT(*) cnt
1804
- FROM ".$odb_ms_prefixes[$i]."postmeta
1805
- WHERE post_id NOT IN (SELECT ID FROM ".$odb_ms_prefixes[$i]."posts)
1806
  ";
1807
-
1808
- $results = $wpdb->get_results($sql_delete);
1809
-
1810
- $meta_orphans = $results[0]->cnt;
1811
-
1812
- if($meta_orphans > 0)
1813
- { $sql_delete = "
1814
- DELETE FROM ".$odb_ms_prefixes[$i]."postmeta
1815
- WHERE post_id NOT IN (SELECT ID FROM ".$odb_ms_prefixes[$i]."posts)
1816
- ";
1817
- $wpdb->get_results($sql_delete);
1818
- }
1819
  }
1820
 
1821
  return ($meta_orphans + $post_orphans);
1822
 
1823
- } // rvg_delete_orphans()
1824
 
1825
 
1826
  /********************************************************************************************
@@ -1884,7 +1678,7 @@ function rvg_optimize_tables($display)
1884
  } // for ($i=0; $i<count($tables); $i++)
1885
  return $cnt;
1886
 
1887
- } // rvg_optimize_tables()
1888
 
1889
 
1890
  /********************************************************************************************
@@ -1985,123 +1779,76 @@ td {
1985
  file_put_contents($file,$html,FILE_APPEND);
1986
  }
1987
 
1988
- } // rvg_write_log()
1989
 
1990
 
1991
  /********************************************************************************************
1992
 
1993
  GET REVISIONS
1994
-
1995
- V3.2: MULTISITE
1996
 
1997
  *********************************************************************************************/
1998
  function rvg_get_revisions($max_revisions)
1999
  {
2000
- global $wpdb, $odb_ms_prefixes;
2001
-
2002
- $res_arr = array();
2003
-
2004
- $index = 0;
2005
- for($i=0; $i<count($odb_ms_prefixes); $i++)
2006
- { $sql = "
2007
- SELECT `post_parent`, `post_title`, COUNT(*) cnt
2008
- FROM ".$odb_ms_prefixes[$i]."posts
2009
- WHERE `post_type` = 'revision'
2010
- GROUP BY `post_parent`
2011
- HAVING COUNT(*) > ".$max_revisions."
2012
- ORDER BY UCASE(`post_title`)
2013
- ";
2014
- $res = $wpdb->get_results($sql, ARRAY_A);
2015
 
2016
- if($res != null)
2017
- { $res_arr[$index] = $res[0];
2018
- $res_arr[$index]['site'] = $odb_ms_prefixes[$i];
2019
- $index++;
2020
- }
2021
- }
 
 
2022
 
2023
- return $res_arr;
2024
 
2025
- } // rvg_get_revisions()
2026
 
2027
 
2028
  /********************************************************************************************
2029
 
2030
  GET TRASHED POSTS / PAGES AND COMMENTS
2031
-
2032
- v3.2: MULTISITE
2033
 
2034
  *********************************************************************************************/
2035
  function rvg_get_trash()
2036
  {
2037
- global $wpdb, $odb_ms_prefixes;
2038
-
2039
- $res_arr = array();
2040
-
2041
- $index = 0;
2042
-
2043
- // LOOP TROUGH SITES
2044
- for($i=0; $i<count($odb_ms_prefixes); $i++)
2045
- {
2046
- $sql = "
2047
- SELECT `ID` AS id, 'post' AS post_type, `post_title` AS title, `post_modified` AS modified
2048
- FROM ".$odb_ms_prefixes[$i]."posts
2049
- WHERE `post_status` = 'trash'
2050
- UNION ALL
2051
- SELECT `comment_ID` AS id, 'comment' AS post_type, `comment_author_IP` AS title, `comment_date` AS modified
2052
- FROM ".$odb_ms_prefixes[$i]."comments
2053
- WHERE `comment_approved` = 'trash'
2054
- ORDER BY post_type, UCASE(title)
2055
- ";
2056
- $res = $wpdb->get_results($sql, ARRAY_A);
2057
 
2058
- if($res != null)
2059
- { $res_arr[$index] = $res[0];
2060
- $res_arr[$index]['site'] = $odb_ms_prefixes[$i];
2061
- $index++;
2062
- }
2063
- }
 
 
 
 
2064
 
2065
- return $res_arr;
2066
 
2067
- } // rvg_get_trash()
2068
 
2069
 
2070
  /********************************************************************************************
2071
 
2072
  GET SPAMMED COMMENTS
2073
-
2074
- v3.2: MULTISITE
2075
 
2076
  *********************************************************************************************/
2077
  function rvg_get_spam()
2078
  {
2079
- global $wpdb, $odb_ms_prefixes;
2080
-
2081
- $res_arr = array();
2082
 
2083
- $index = 0;
2084
- // LOOP THROUGH SITES
2085
- for($i=0; $i<count($odb_ms_prefixes); $i++)
2086
- {
2087
  $sql = "
2088
  SELECT `comment_ID`, `comment_author`, `comment_author_email`, `comment_date`
2089
- FROM ".$odb_ms_prefixes[$i]."comments
2090
  WHERE `comment_approved` = 'spam'
2091
  ORDER BY UCASE(`comment_author`)
2092
  ";
2093
- $res = $wpdb->get_results($sql, ARRAY_A);
2094
-
2095
- if($res != null)
2096
- { $res_arr[$index] = $res[0];
2097
- $res_arr[$index]['site'] = $odb_ms_prefixes[$i];
2098
- $index++;
2099
- }
2100
- }
2101
-
2102
- return $res_arr;
2103
 
2104
- } // rvg_get_spam()
 
 
2105
 
2106
 
2107
  /********************************************************************************************
@@ -2125,7 +1872,7 @@ function rvg_get_db_size()
2125
 
2126
  return $res[0]->size;
2127
 
2128
- } // rvg_get_db_size()
2129
 
2130
 
2131
  /********************************************************************************************
@@ -2141,5 +1888,5 @@ function rvg_format_size($size, $precision=1)
2141
  $table_size = (round($size/1024,$precision)).' KB';
2142
 
2143
  return $table_size;
2144
- } // rvg_format_size()
2145
  ?>
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
  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()
48
 
49
  /********************************************************************************************
50
 
51
+ 'ICON MODE': ADD A LINK TO THE ADMIN MENU (v3.1.3)
 
 
52
 
53
  *********************************************************************************************/
54
  function rvg_add_menu_page()
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
  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
 
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
  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
  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' );
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
  *********************************************************************************************/
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
  {
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
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';
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
  <?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
  <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++)
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>
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
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
  *********************************************************************************************/
538
  function rvg_optimize_db()
539
  {
540
+ global $wpdb, $odb_version;
541
 
542
  // PAGE LOAD COUNTER
543
  $time = microtime();
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")
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
  {
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
  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
  ?>
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
  ?>
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
  // NUMBER OF DELETED REVISIONS FOR LOG FILE
762
  $log_arr["revisions"] = $total_deleted;
763
 
 
764
  /****************************************************************************************
765
 
766
  DELETE TRASHED ITEMS
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
  <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
 
808
  // NUMBER OF DELETED TRASH FOR LOG FILE
809
  $log_arr["trash"] = $total_deleted;
810
+
811
  } // if($clear_trash == 'Y')
 
812
 
813
  /****************************************************************************************
814
 
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
  <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
 
859
  // NUMBER OF SPAM DELETED FOR LOG FILE
860
  $log_arr["spam"] = $total_deleted;
 
861
 
862
  /****************************************************************************************
863
 
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
  <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
  // NUMBER OF tags DELETED FOR LOG FILE
898
  $log_arr["tags"] = $total_deleted;
899
 
 
900
  /****************************************************************************************
901
 
902
  DELETE EXPIRED TRANSIENTS
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
  <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
  <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
  <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
  <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
  <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
  <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
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
  $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
  <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
  /********************************************************************************************
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
  $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);
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
  <?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
 
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
  ?>
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
  /********************************************************************************************
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
  /********************************************************************************************
1678
  } // for ($i=0; $i<count($tables); $i++)
1679
  return $cnt;
1680
 
1681
+ } // rvg_optimize_tables ()
1682
 
1683
 
1684
  /********************************************************************************************
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
 
1873
  return $res[0]->size;
1874
 
1875
+ } // rvg_get_db_size ()
1876
 
1877
 
1878
  /********************************************************************************************
1888
  $table_size = (round($size/1024,$precision)).' KB';
1889
 
1890
  return $table_size;
1891
+ } // rvg_format_size ()
1892
  ?>