Version Description
[04/08/2015] = * BUG FIX: fixed a bug with the scheduler (it didn't clean everything)
Download this release
Release Info
Developer | cageehv |
Plugin | Optimize Database after Deleting Revisions |
Version | 3.3.1 |
Comparing to | |
See all releases |
Code changes from version 3.3 to 3.3.1
- readme.txt +7 -4
- rvg-optimize-db.php +30 -21
readme.txt
CHANGED
@@ -1,15 +1,15 @@
|
|
1 |
=== Optimize Database after Deleting Revisions ===
|
2 |
Contributors: CAGE Web Design | Rolf van Gelder
|
3 |
-
Donate link: http://cagewebdev.com
|
4 |
Plugin Name: Optimize Database after Deleting Revisions
|
5 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
|
6 |
Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler, transients, unused tags, pingback, trackback
|
7 |
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.
|
11 |
-
Stable tag: 3.3
|
12 |
-
Version: 3.3
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
@@ -81,6 +81,9 @@ http://cagewebdev.com/index.php/wordpress-plugins/
|
|
81 |
* If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
|
82 |
|
83 |
== Changelog ==
|
|
|
|
|
|
|
84 |
= 3.3 [03/27/2015] =
|
85 |
* NEW: MULTISITE support added (second try ;-))
|
86 |
* CHANGE: various minor improvements
|
1 |
=== Optimize Database after Deleting Revisions ===
|
2 |
Contributors: CAGE Web Design | Rolf van Gelder
|
3 |
+
Donate link: http://cagewebdev.com/index.php/donations/
|
4 |
Plugin Name: Optimize Database after Deleting Revisions
|
5 |
Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
|
6 |
Tags: database, delete, revisions, optimize, post, posts, page, pages, clean, clean up, trash, spam, trashed, spammed, database size, scheduler, transients, unused tags, pingback, trackback
|
7 |
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.2
|
11 |
+
Stable tag: 3.3.1
|
12 |
+
Version: 3.3.1
|
13 |
License: GPLv2 or later
|
14 |
|
15 |
== Description ==
|
81 |
* If you run the plugin from any of the sites, it will cleanup ALL the sites in the network!
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 3.3.1 [04/08/2015] =
|
85 |
+
* BUG FIX: fixed a bug with the scheduler (it didn't clean everything)
|
86 |
+
|
87 |
= 3.3 [03/27/2015] =
|
88 |
* NEW: MULTISITE support added (second try ;-))
|
89 |
* CHANGE: various minor improvements
|
rvg-optimize-db.php
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
-
* @version 3.3
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Optimize Database after Deleting Revisions
|
@@ -9,11 +9,11 @@ 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.3
|
13 |
*/
|
14 |
|
15 |
-
$odb_version = '3.3';
|
16 |
-
$odb_release_date = '
|
17 |
// v3.3 - MULTISITE
|
18 |
$odb_ms_prefixes = array();
|
19 |
$odb_ms_blogids = array();
|
@@ -186,7 +186,8 @@ add_action( 'rvg_optimize_database', 'rvg_optimize_db_cron' );
|
|
186 |
register_deactivation_hook( __FILE__, 'rvg_deactivate_plugin' );
|
187 |
function rvg_deactivate_plugin()
|
188 |
{ // CLEAR CURRENT SCHEDULE (IF ANY)
|
189 |
-
wp_clear_scheduled_hook('rvg_optimize_database');
|
|
|
190 |
} // rvg_deactivate_plugin()
|
191 |
|
192 |
// RE-SCHEDULE TASK WHEN RE-ACTIVATED (OR AFTER UPDATE)
|
@@ -300,11 +301,10 @@ function rvg_odb_settings_page()
|
|
300 |
|
301 |
// v3.3 - GET THE OPTIONS FROM THE TABLES OF THE MAIN SITE (IN CASE OF MULTISITE)
|
302 |
// if(function_exists('switch_to_blog')) switch_to_blog(1);
|
303 |
-
|
304 |
-
$
|
305 |
-
$current_datetime = date_i18n($timezone_format);
|
306 |
$current_date = substr($current_datetime, 0, 8);
|
307 |
-
$current_hour = substr($current_datetime, 8, 2);
|
308 |
|
309 |
if(isset($_REQUEST['delete_log']))
|
310 |
if($_REQUEST['delete_log'] == "Y") @unlink(dirname(__FILE__).'/rvg-optimize-db-log.html');
|
@@ -381,9 +381,16 @@ function rvg_odb_settings_page()
|
|
381 |
rvg_odb_update_option('rvg_odb_schedule', $rvg_odb_schedule);
|
382 |
|
383 |
$rvg_odb_schedulehour = '';
|
384 |
-
|
385 |
-
|
386 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
|
388 |
// CLEAR CURRENT SCHEDULE (IF ANY)
|
389 |
wp_clear_scheduled_hook('rvg_optimize_database');
|
@@ -394,10 +401,11 @@ function rvg_odb_settings_page()
|
|
394 |
{
|
395 |
$time = 0;
|
396 |
if($rvg_odb_schedulehour == '')
|
397 |
-
|
398 |
-
|
399 |
else
|
400 |
{
|
|
|
401 |
if($rvg_odb_schedulehour <= $current_hour)
|
402 |
// NEXT RUN TOMORROW
|
403 |
$newdatetime = date('YmdHis', strtotime($current_date.$rvg_odb_schedulehour.'0000'.' + 1 day'));
|
@@ -691,7 +699,7 @@ function rvg_optimize_db()
|
|
691 |
{
|
692 |
global $wpdb, $odb_version, $odb_ms_prefixes;
|
693 |
|
694 |
-
// v3.3
|
695 |
rvg_odb_network_info();
|
696 |
|
697 |
// PAGE LOAD COUNTER
|
@@ -700,8 +708,7 @@ function rvg_optimize_db()
|
|
700 |
$time = $time[1] + $time[0];
|
701 |
$odb_start_time = $time;
|
702 |
|
703 |
-
$
|
704 |
-
$current_hour = date_i18n($timezone_format);
|
705 |
|
706 |
if(isset($_REQUEST['action']))
|
707 |
if($_REQUEST['action'] == "delete_log")
|
@@ -786,7 +793,7 @@ function rvg_optimize_db()
|
|
786 |
}
|
787 |
else
|
788 |
{ $timestamp = wp_next_scheduled('rvg_optimize_database');
|
789 |
-
$nextrun
|
790 |
}
|
791 |
|
792 |
$total_savings = rvg_odb_get_option('rvg_odb_total_savings');
|
@@ -902,8 +909,7 @@ function rvg_optimize_db()
|
|
902 |
$start_size = rvg_get_db_size();
|
903 |
|
904 |
// TIMESTAMP FOR LOG FILE
|
905 |
-
$
|
906 |
-
$current_datetime = date_i18n($timezone_format);
|
907 |
$log_arr = array("time" => substr($current_datetime, 0, 10).'<br />'.substr($current_datetime,10));
|
908 |
|
909 |
// FIND REVISIONS
|
@@ -1326,7 +1332,10 @@ $total_time = round(($finish - $odb_start_time), 4);
|
|
1326 |
*********************************************************************************************/
|
1327 |
function rvg_optimize_db_cron()
|
1328 |
{
|
1329 |
-
global $wpdb, $odb_version;
|
|
|
|
|
|
|
1330 |
|
1331 |
// GET SETTINGS AND SET DEFAULT VALUES
|
1332 |
$max_revisions = rvg_odb_get_option('rvg_odb_number');
|
1 |
<?php
|
2 |
/**
|
3 |
* @package Optimize Database after Deleting Revisions
|
4 |
+
* @version 3.3.1
|
5 |
*/
|
6 |
/*
|
7 |
Plugin Name: Optimize Database after Deleting Revisions
|
9 |
Description: Optimizes the Wordpress Database after Cleaning it out
|
10 |
Author: CAGE Web Design | Rolf van Gelder, Eindhoven, The Netherlands
|
11 |
Author URI: http://cagewebdev.com
|
12 |
+
Version: 3.3.1
|
13 |
*/
|
14 |
|
15 |
+
$odb_version = '3.3.1';
|
16 |
+
$odb_release_date = '04/08/2015';
|
17 |
// v3.3 - MULTISITE
|
18 |
$odb_ms_prefixes = array();
|
19 |
$odb_ms_blogids = array();
|
186 |
register_deactivation_hook( __FILE__, 'rvg_deactivate_plugin' );
|
187 |
function rvg_deactivate_plugin()
|
188 |
{ // CLEAR CURRENT SCHEDULE (IF ANY)
|
189 |
+
wp_clear_scheduled_hook('rvg_optimize_database');
|
190 |
+
wp_clear_scheduled_hook('rvg_scheduled_run');
|
191 |
} // rvg_deactivate_plugin()
|
192 |
|
193 |
// RE-SCHEDULE TASK WHEN RE-ACTIVATED (OR AFTER UPDATE)
|
301 |
|
302 |
// v3.3 - GET THE OPTIONS FROM THE TABLES OF THE MAIN SITE (IN CASE OF MULTISITE)
|
303 |
// if(function_exists('switch_to_blog')) switch_to_blog(1);
|
304 |
+
|
305 |
+
$current_datetime = Date('YmdHis');
|
|
|
306 |
$current_date = substr($current_datetime, 0, 8);
|
307 |
+
$current_hour = substr($current_datetime, 8, 2);
|
308 |
|
309 |
if(isset($_REQUEST['delete_log']))
|
310 |
if($_REQUEST['delete_log'] == "Y") @unlink(dirname(__FILE__).'/rvg-optimize-db-log.html');
|
381 |
rvg_odb_update_option('rvg_odb_schedule', $rvg_odb_schedule);
|
382 |
|
383 |
$rvg_odb_schedulehour = '';
|
384 |
+
// v3.3.1
|
385 |
+
if($rvg_odb_schedule == 'daily' || $rvg_odb_schedule == 'weekly')
|
386 |
+
{
|
387 |
+
if(isset($_POST['rvg_odb_schedulehour']))
|
388 |
+
$rvg_odb_schedulehour = $_POST['rvg_odb_schedulehour'];
|
389 |
+
rvg_odb_update_option('rvg_odb_schedulehour', $rvg_odb_schedulehour);
|
390 |
+
}
|
391 |
+
else
|
392 |
+
// WIPE THE HOUR
|
393 |
+
rvg_odb_update_option('rvg_odb_schedulehour', '');
|
394 |
|
395 |
// CLEAR CURRENT SCHEDULE (IF ANY)
|
396 |
wp_clear_scheduled_hook('rvg_optimize_database');
|
401 |
{
|
402 |
$time = 0;
|
403 |
if($rvg_odb_schedulehour == '')
|
404 |
+
// 'hourly', 'twicedaily'
|
405 |
+
$time = time();
|
406 |
else
|
407 |
{
|
408 |
+
// 'daily', 'weekly'
|
409 |
if($rvg_odb_schedulehour <= $current_hour)
|
410 |
// NEXT RUN TOMORROW
|
411 |
$newdatetime = date('YmdHis', strtotime($current_date.$rvg_odb_schedulehour.'0000'.' + 1 day'));
|
699 |
{
|
700 |
global $wpdb, $odb_version, $odb_ms_prefixes;
|
701 |
|
702 |
+
// v3.3 - GET NETWORK INFORMATION (MULTISITE)
|
703 |
rvg_odb_network_info();
|
704 |
|
705 |
// PAGE LOAD COUNTER
|
708 |
$time = $time[1] + $time[0];
|
709 |
$odb_start_time = $time;
|
710 |
|
711 |
+
$current_hour = Date('H:i');
|
|
|
712 |
|
713 |
if(isset($_REQUEST['action']))
|
714 |
if($_REQUEST['action'] == "delete_log")
|
793 |
}
|
794 |
else
|
795 |
{ $timestamp = wp_next_scheduled('rvg_optimize_database');
|
796 |
+
$nextrun = Date('M j, Y @ H:i', $timestamp);
|
797 |
}
|
798 |
|
799 |
$total_savings = rvg_odb_get_option('rvg_odb_total_savings');
|
909 |
$start_size = rvg_get_db_size();
|
910 |
|
911 |
// TIMESTAMP FOR LOG FILE
|
912 |
+
$current_datetime = Date('m/d/YH:i:s');
|
|
|
913 |
$log_arr = array("time" => substr($current_datetime, 0, 10).'<br />'.substr($current_datetime,10));
|
914 |
|
915 |
// FIND REVISIONS
|
1332 |
*********************************************************************************************/
|
1333 |
function rvg_optimize_db_cron()
|
1334 |
{
|
1335 |
+
global $wpdb, $odb_version, $odb_ms_prefixes;
|
1336 |
+
|
1337 |
+
// v3.3.1 - GET NETWORK INFORMATION (MULTISITE)
|
1338 |
+
rvg_odb_network_info();
|
1339 |
|
1340 |
// GET SETTINGS AND SET DEFAULT VALUES
|
1341 |
$max_revisions = rvg_odb_get_option('rvg_odb_number');
|