Version Description
[03/18/2013] = * NEW: 'Orphan Post items' (like 'Auto Drafts') will be automatically deleted too now (thanks to: 0izys)
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 2.2.7 |
Comparing to | |
See all releases |
Code changes from version 2.2.6 to 2.2.7
- readme.txt +6 -3
- rvg-optimize-db.php +31 -7
readme.txt
CHANGED
@@ -6,10 +6,10 @@ Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-rev
|
|
6 |
Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler
|
7 |
Author URI: http://cagewebdev.com
|
8 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
9 |
-
Requires at least: 2.2.
|
10 |
Tested up to: 3.5.1
|
11 |
-
Stable tag: 2.2.
|
12 |
-
Version: 2.2.
|
13 |
|
14 |
== Description ==
|
15 |
|
@@ -48,6 +48,9 @@ http://wordpress.org/extend/plugins/rvg-optimize-database/
|
|
48 |
|
49 |
== Changelog ==
|
50 |
|
|
|
|
|
|
|
51 |
= 2.2.6 [03/05/2013] =
|
52 |
* Text change: 'logging on' changed to 'keep a log' (thanks to: Neil Parks)
|
53 |
* NEW: number of orphans deleted now also shown in the log file
|
6 |
Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler
|
7 |
Author URI: http://cagewebdev.com
|
8 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
9 |
+
Requires at least: 2.2.7
|
10 |
Tested up to: 3.5.1
|
11 |
+
Stable tag: 2.2.7
|
12 |
+
Version: 2.2.7
|
13 |
|
14 |
== Description ==
|
15 |
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 2.2.7 [03/18/2013] =
|
52 |
+
* NEW: 'Orphan Post items' (like 'Auto Drafts') will be automatically deleted too now (thanks to: 0izys)
|
53 |
+
|
54 |
= 2.2.6 [03/05/2013] =
|
55 |
* Text change: 'logging on' changed to 'keep a log' (thanks to: Neil Parks)
|
56 |
* NEW: number of orphans deleted now also shown in the log file
|
rvg-optimize-db.php
CHANGED
@@ -1,16 +1,16 @@
|
|
1 |
<?php
|
2 |
-
$odb_version = '2.2.
|
3 |
-
$odb_release_date = '03/
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
-
* @version 2.2.
|
7 |
*/
|
8 |
/*
|
9 |
Plugin Name: Optimize Database after Deleting Revisions
|
10 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/
|
11 |
Description: Optimizes the Wordpress Database after Cleaning it out - <a href="options-general.php?page=rvg_odb_admin"><strong>plug in options</strong></a>
|
12 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
13 |
-
Version: 2.2.
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
?>
|
@@ -967,6 +967,30 @@ function rvg_delete_orphans($display)
|
|
967 |
{
|
968 |
global $wpdb;
|
969 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
970 |
$sql_delete = "
|
971 |
SELECT COUNT(*) cnt
|
972 |
FROM $wpdb->postmeta
|
@@ -975,9 +999,9 @@ function rvg_delete_orphans($display)
|
|
975 |
|
976 |
$results = $wpdb -> get_results($sql_delete);
|
977 |
|
978 |
-
$
|
979 |
|
980 |
-
if($
|
981 |
{ $sql_delete = "
|
982 |
DELETE FROM $wpdb->postmeta
|
983 |
WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)
|
@@ -985,7 +1009,7 @@ function rvg_delete_orphans($display)
|
|
985 |
$wpdb -> get_results($sql_delete);
|
986 |
}
|
987 |
|
988 |
-
return $
|
989 |
|
990 |
} // rvg_delete_orphans()
|
991 |
?>
|
1 |
<?php
|
2 |
+
$odb_version = '2.2.7';
|
3 |
+
$odb_release_date = '03/18/2013';
|
4 |
/**
|
5 |
* @package Optimize Database after Deleting Revisions
|
6 |
+
* @version 2.2.7
|
7 |
*/
|
8 |
/*
|
9 |
Plugin Name: Optimize Database after Deleting Revisions
|
10 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/
|
11 |
Description: Optimizes the Wordpress Database after Cleaning it out - <a href="options-general.php?page=rvg_odb_admin"><strong>plug in options</strong></a>
|
12 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
13 |
+
Version: 2.2.7
|
14 |
Author URI: http://cagewebdev.com
|
15 |
*/
|
16 |
?>
|
967 |
{
|
968 |
global $wpdb;
|
969 |
|
970 |
+
$meta_orphans = 0;
|
971 |
+
$post_orphans = 0;
|
972 |
+
|
973 |
+
|
974 |
+
// DELETE POST ORPHANS
|
975 |
+
$sql_delete = "
|
976 |
+
SELECT COUNT(*) cnt
|
977 |
+
FROM $wpdb->posts
|
978 |
+
WHERE ID NOT IN (SELECT post_id FROM $wpdb->postmeta)
|
979 |
+
";
|
980 |
+
|
981 |
+
$results = $wpdb -> get_results($sql_delete);
|
982 |
+
|
983 |
+
$post_orphans = $results[0] -> cnt;
|
984 |
+
|
985 |
+
if($post_orphans > 0)
|
986 |
+
{ $sql_delete = "
|
987 |
+
DELETE FROM $wpdb->posts
|
988 |
+
WHERE ID NOT IN (SELECT post_id FROM $wpdb->postmeta)
|
989 |
+
";
|
990 |
+
$wpdb -> get_results($sql_delete);
|
991 |
+
}
|
992 |
+
|
993 |
+
// DELETE POSTMETA ORPHANS
|
994 |
$sql_delete = "
|
995 |
SELECT COUNT(*) cnt
|
996 |
FROM $wpdb->postmeta
|
999 |
|
1000 |
$results = $wpdb -> get_results($sql_delete);
|
1001 |
|
1002 |
+
$meta_orphans = $results[0] -> cnt;
|
1003 |
|
1004 |
+
if($meta_orphans > 0)
|
1005 |
{ $sql_delete = "
|
1006 |
DELETE FROM $wpdb->postmeta
|
1007 |
WHERE post_id NOT IN (SELECT ID FROM $wpdb->posts)
|
1009 |
$wpdb -> get_results($sql_delete);
|
1010 |
}
|
1011 |
|
1012 |
+
return ($meta_orphans + $post_orphans);
|
1013 |
|
1014 |
} // rvg_delete_orphans()
|
1015 |
?>
|