Optimize Database after Deleting Revisions - Version 1.0.5

Version Description

No Upgrade Notice available.

Download this release

Release Info

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

Code changes from version 1.0.2 to 1.0.5

Files changed (4) hide show
  1. readme.txt +12 -9
  2. rvg-optimize-db.php +22 -22
  3. trunk/readme.txt +0 -45
  4. trunk/rvg-optimize-db.php +0 -103
readme.txt CHANGED
@@ -8,15 +8,15 @@ Tags: wp, database, delete, revisions, optimize, posts, pages
8
  Author URI: http://cagewebdev.com
9
  Author: Rolf van Gelder
10
  Requires at least: 2.0
11
- Tested up to: 3.2.1
12
- Stable tag: 1.0.2
13
- Version: 1.0.2
14
 
15
  == Description ==
16
 
17
  <p>This plugin is a 'one click' database optimizer.</p>
18
  <p>It deletes the redundant revisions of posts and pages and then optimizes all Wordpress database tables.</p>
19
- <p>http://cagewebdev.com/</p>
20
 
21
  == Installation ==
22
 
@@ -35,11 +35,14 @@ No Screenshots available.
35
 
36
  == Changelog ==
37
 
38
- <p>1.0 11/22/2011 Initial release</p>
39
- <p>1.0.1 11/24/2011 A few updates for the readme.txt file</p>
40
- <p>1.0.2 12/02/2011 Some minor updates</p>
 
 
 
41
 
42
  == Frequently Asked Questions ==
43
 
44
- <p>Q: How do I run this plugin?</p>
45
- <p>A: In the WordPress ADMIN panel go to 'Settings'. Click on 'Optimize Database'. Et voila!</p>
8
  Author URI: http://cagewebdev.com
9
  Author: Rolf van Gelder
10
  Requires at least: 2.0
11
+ Tested up to: 3.4.1
12
+ Stable tag: 1.0.5
13
+ Version: 1.0.5
14
 
15
  == Description ==
16
 
17
  <p>This plugin is a 'one click' database optimizer.</p>
18
  <p>It deletes the redundant revisions of posts and pages and then optimizes all Wordpress database tables.</p>
19
+ <p>http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin</p>
20
 
21
  == Installation ==
22
 
35
 
36
  == Changelog ==
37
 
38
+ <p><b>1.0</b> 11/22/2011 Initial release</p>
39
+ <p><b>1.0.1</b> 11/24/2011 A few updates for the readme.txt file</p>
40
+ <p><b>1.0.2</b> 12/02/2011 Some minor updates</p>
41
+ <p><b>1.0.3</b> 12/15/2011 Some minor layout updates</p>
42
+ <p><b>1.0.4</b> 06/06/2012 Now also works with non short_open_tag's</p>
43
+ <p><b>1.0.5</b> 21/08/2012 Depreciated item ('has_cap') replaced, abandoned line of code removed</p>
44
 
45
  == Frequently Asked Questions ==
46
 
47
+ <p><b>Q:</b> How do I run this plugin?</p>
48
+ <p><b>A:</b> In the WordPress Admin panel go to '<b>Settings</b>'. Click on '<b>Optimize Database</b>'. Et voila!</p>
rvg-optimize-db.php CHANGED
@@ -1,29 +1,28 @@
1
  <?php
2
- $version = '1.0.2';
3
  /**
4
  * @package Optimize Database after Deleting Revisions
5
- * @version 1.0.2
6
  */
7
  /*
8
  Plugin Name: Optimize Database after Deleting Revisions
9
- Plugin URI: http://cagewebdev.com
10
  Description: Optimizes the Wordpress Database after Deleting Revisions
11
  Author: Rolf van Gelder
12
- Version: 1.0.2
13
  Author URI: http://cagewebdev.com
14
  */
15
- ?>
16
- <?php
17
  function optimize_db_main()
18
  { if (function_exists('add_options_page')) {
19
- add_options_page('Optimize Database', 'Optimize Database',8 ,'rvg-optimize-db.php', 'rvg_optimize_db');
20
  }
21
  }
22
  add_action('admin_menu', 'optimize_db_main');
23
 
24
  function rvg_optimize_db()
25
  {
26
- global $wpdb;
27
 
28
  echo '<h2 style="padding-left:5px;">Optimizing your WordPress database</h2>';
29
  echo '<span style="padding-left:5px;font-style:italic;">rvg-optimize-db v'.$version.' - A WordPress Plugin by Rolf van Gelder</span><br /><br />';
@@ -40,21 +39,22 @@ function rvg_optimize_db()
40
  { $cnt = count($results);
41
  # print_r($results);
42
  ?>
43
- <table border="0" cellspacing="5" cellpadding="5">
 
44
  <tr>
45
  <td colspan="3" style="font-weight:bold;color:#00F;">DELETING REVISIONS:</td>
46
  </tr>
47
- <?php
48
  for($i=0;$i<$cnt;$i++)
49
  { # MULTI LINGUAL?
50
  $post_title = str_replace('--><!--','--> | <!--',$results[$i]->post_title);
51
  ?>
52
  <tr valign="top">
53
- <td align="right" style="font-weight:bold;"><?=($i+1)?></td>
54
- <td><?=$results[$i]->post_modified?></td>
55
- <td style="font-weight:bold;"><?=$post_title?></td>
56
  </tr>
57
- <?php
58
  }
59
  ?>
60
  </table>
@@ -76,11 +76,11 @@ function rvg_optimize_db()
76
  $Tables_in_DB_NAME = 'Tables_in_'.DB_NAME;
77
  # print_r($Tables);
78
  ?>
79
- <table border="0" cellspacing="5" cellpadding="5">
80
  <tr>
81
  <td colspan="3" style="font-weight:bold;color:#00F;">OPTIMIZING DATABASE TABLES:</td>
82
  </tr>
83
- <?php
84
  for ($i=0; $i<count($Tables); $i++)
85
  {
86
  $query = "OPTIMIZE TABLE ".$Tables[$i]->$Tables_in_DB_NAME;
@@ -88,15 +88,15 @@ function rvg_optimize_db()
88
  # print_r($result);
89
  ?>
90
  <tr>
91
- <td style="font-weight:bold;"><?=$Tables[$i]->$Tables_in_DB_NAME?></td>
92
- <td style="font-weight:bold;">=&gt;</td>
93
- <td><?=$result[0]->Msg_text?></td>
94
  </tr>
95
- <?php
96
  }
97
- $query = "$operation TABLE ";
98
  ?>
99
- </table><br />
 
100
  <span style="font-weight:bold;color:#00F;padding-left:5px;">DONE!</span>
101
  <?php
102
  }
1
  <?php
2
+ $version = '1.0.5';
3
  /**
4
  * @package Optimize Database after Deleting Revisions
5
+ * @version 1.0.5
6
  */
7
  /*
8
  Plugin Name: Optimize Database after Deleting Revisions
9
+ Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin/
10
  Description: Optimizes the Wordpress Database after Deleting Revisions
11
  Author: Rolf van Gelder
12
+ Version: 1.0.5
13
  Author URI: http://cagewebdev.com
14
  */
15
+ ?><?php
 
16
  function optimize_db_main()
17
  { if (function_exists('add_options_page')) {
18
+ add_options_page('Optimize Database', 'Optimize Database','administrator' ,'rvg-optimize-db.php', 'rvg_optimize_db');
19
  }
20
  }
21
  add_action('admin_menu', 'optimize_db_main');
22
 
23
  function rvg_optimize_db()
24
  {
25
+ global $wpdb, $version;
26
 
27
  echo '<h2 style="padding-left:5px;">Optimizing your WordPress database</h2>';
28
  echo '<span style="padding-left:5px;font-style:italic;">rvg-optimize-db v'.$version.' - A WordPress Plugin by Rolf van Gelder</span><br /><br />';
39
  { $cnt = count($results);
40
  # print_r($results);
41
  ?>
42
+
43
+ <table border="0" cellspacing="0" cellpadding="4">
44
  <tr>
45
  <td colspan="3" style="font-weight:bold;color:#00F;">DELETING REVISIONS:</td>
46
  </tr>
47
+ <?php
48
  for($i=0;$i<$cnt;$i++)
49
  { # MULTI LINGUAL?
50
  $post_title = str_replace('--><!--','--> | <!--',$results[$i]->post_title);
51
  ?>
52
  <tr valign="top">
53
+ <td align="right" style="font-weight:bold;"><?php echo ($i+1) ?></td>
54
+ <td><?php echo $results[$i]->post_modified ?></td>
55
+ <td style="font-weight:bold;"><?php echo $post_title ?></td>
56
  </tr>
57
+ <?php
58
  }
59
  ?>
60
  </table>
76
  $Tables_in_DB_NAME = 'Tables_in_'.DB_NAME;
77
  # print_r($Tables);
78
  ?>
79
+ <table border="0" cellspacing="0" cellpadding="4">
80
  <tr>
81
  <td colspan="3" style="font-weight:bold;color:#00F;">OPTIMIZING DATABASE TABLES:</td>
82
  </tr>
83
+ <?php
84
  for ($i=0; $i<count($Tables); $i++)
85
  {
86
  $query = "OPTIMIZE TABLE ".$Tables[$i]->$Tables_in_DB_NAME;
88
  # print_r($result);
89
  ?>
90
  <tr>
91
+ <td style="font-weight:bold;"><?php echo $Tables[$i]->$Tables_in_DB_NAME ?></td>
92
+ <td style="font-weight:bold;">=&gt;</td>
93
+ <td><?php echo $result[0]->Msg_text ?></td>
94
  </tr>
95
+ <?php
96
  }
 
97
  ?>
98
+ </table>
99
+ <br />
100
  <span style="font-weight:bold;color:#00F;padding-left:5px;">DONE!</span>
101
  <?php
102
  }
trunk/readme.txt DELETED
@@ -1,45 +0,0 @@
1
- === Plugin Name ===
2
-
3
- Contributors: Rolf van Gelder
4
- Donate link: http://cagewebdev.com
5
- Plugin Name: Optimize Database after Deleting Revisions
6
- Plugin URI: http://cagewebdev.com/index.php/optimize-database-after-deleting-revisions-wordpress-plugin
7
- Tags: wp, database, delete, revisions, optimize, posts, pages
8
- Author URI: http://cagewebdev.com
9
- Author: Rolf van Gelder
10
- Requires at least: 2.0
11
- Tested up to: 3.2.1
12
- Stable tag: 1.0.2
13
- Version: 1.0.2
14
-
15
- == Description ==
16
-
17
- <p>This plugin is a 'one click' database optimizer.</p>
18
- <p>It deletes the redundant revisions of posts and pages and then optimizes all Wordpress database tables.</p>
19
- <p>http://cagewebdev.com/</p>
20
-
21
- == Installation ==
22
-
23
- <ol>
24
- <li>Upload `rvg-optimize-db.php` to the `/wp-content/plugins/` directory</li>
25
- <li>Activate the plugin through the 'Plugins' menu in WordPress</li>
26
- </ol>
27
-
28
- == Upgrade Notice ==
29
-
30
- No Upgrade Notice available.
31
-
32
- == Screenshots ==
33
-
34
- No Screenshots available.
35
-
36
- == Changelog ==
37
-
38
- <p>1.0 11/22/2011 Initial release</p>
39
- <p>1.0.1 11/24/2011 A few updates for the readme.txt file</p>
40
- <p>1.0.2 12/02/2011 Some minor updates</p>
41
-
42
- == Frequently Asked Questions ==
43
-
44
- <p>Q: How do I run this plugin?</p>
45
- <p>A: In the WordPress ADMIN panel go to 'Settings'. Click on 'Optimize Database'. Et voila!</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
trunk/rvg-optimize-db.php DELETED
@@ -1,103 +0,0 @@
1
- <?php
2
- $version = '1.0.2';
3
- /**
4
- * @package Optimize Database after Deleting Revisions
5
- * @version 1.0.2
6
- */
7
- /*
8
- Plugin Name: Optimize Database after Deleting Revisions
9
- Plugin URI: http://cagewebdev.com
10
- Description: Optimizes the Wordpress Database after Deleting Revisions
11
- Author: Rolf van Gelder
12
- Version: 1.0.2
13
- Author URI: http://cagewebdev.com
14
- */
15
- ?>
16
- <?php
17
- function optimize_db_main()
18
- { if (function_exists('add_options_page')) {
19
- add_options_page('Optimize Database', 'Optimize Database',8 ,'rvg-optimize-db.php', 'rvg_optimize_db');
20
- }
21
- }
22
- add_action('admin_menu', 'optimize_db_main');
23
-
24
- function rvg_optimize_db()
25
- {
26
- global $wpdb;
27
-
28
- echo '<h2 style="padding-left:5px;">Optimizing your WordPress database</h2>';
29
- echo '<span style="padding-left:5px;font-style:italic;">rvg-optimize-db v'.$version.' - A WordPress Plugin by Rolf van Gelder</span><br /><br />';
30
-
31
- /***********************************
32
- DELETE REVISIONS
33
- ***********************************/
34
- $sql = "SELECT `ID`,`post_date`,`post_title`,`post_modified`
35
- FROM $wpdb->posts
36
- WHERE `post_type` = 'revision'
37
- ORDER BY `ID` DESC";
38
- $results = $wpdb -> get_results($sql);
39
- if($results)
40
- { $cnt = count($results);
41
- # print_r($results);
42
- ?>
43
- <table border="0" cellspacing="5" cellpadding="5">
44
- <tr>
45
- <td colspan="3" style="font-weight:bold;color:#00F;">DELETING REVISIONS:</td>
46
- </tr>
47
- <?php
48
- for($i=0;$i<$cnt;$i++)
49
- { # MULTI LINGUAL?
50
- $post_title = str_replace('--><!--','--> | <!--',$results[$i]->post_title);
51
- ?>
52
- <tr valign="top">
53
- <td align="right" style="font-weight:bold;"><?=($i+1)?></td>
54
- <td><?=$results[$i]->post_modified?></td>
55
- <td style="font-weight:bold;"><?=$post_title?></td>
56
- </tr>
57
- <?php
58
- }
59
- ?>
60
- </table>
61
- <br />
62
- <?php
63
- # DELETE THE REVISIONS
64
- $sql = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'";
65
- $results = $wpdb -> get_results($sql);
66
- }
67
- else
68
- { echo '<span style="font-weight:bold;color:#00F;padding-left:5px;">NO REVISIONS FOUND!</span><br /><br />';
69
- } // if($results)
70
-
71
- /***********************************
72
- OPTIMIZE TABLES
73
- ***********************************/
74
- # GET TABLE NAMES
75
- $Tables = $wpdb -> get_results('SHOW TABLES IN '.DB_NAME);
76
- $Tables_in_DB_NAME = 'Tables_in_'.DB_NAME;
77
- # print_r($Tables);
78
- ?>
79
- <table border="0" cellspacing="5" cellpadding="5">
80
- <tr>
81
- <td colspan="3" style="font-weight:bold;color:#00F;">OPTIMIZING DATABASE TABLES:</td>
82
- </tr>
83
- <?php
84
- for ($i=0; $i<count($Tables); $i++)
85
- {
86
- $query = "OPTIMIZE TABLE ".$Tables[$i]->$Tables_in_DB_NAME;
87
- $result = $wpdb -> get_results($query);
88
- # print_r($result);
89
- ?>
90
- <tr>
91
- <td style="font-weight:bold;"><?=$Tables[$i]->$Tables_in_DB_NAME?></td>
92
- <td style="font-weight:bold;">=&gt;</td>
93
- <td><?=$result[0]->Msg_text?></td>
94
- </tr>
95
- <?php
96
- }
97
- $query = "$operation TABLE ";
98
- ?>
99
- </table><br />
100
- <span style="font-weight:bold;color:#00F;padding-left:5px;">DONE!</span>
101
- <?php
102
- }
103
- ?>