Changeset 579704
- Timestamp:
- 07/31/2012 11:46:08 AM (14 years ago)
- Location:
- kt-cleanpress/trunk
- Files:
-
- 4 added
- 6 edited
-
includes/css/ktclean.css (modified) (2 diffs)
-
includes/kt-initdisplay.php (modified) (4 diffs)
-
includes/kt-left-display-options.php (modified) (2 diffs)
-
includes/kt-right-display-options.php (modified) (1 diff)
-
includes/lang/kt-cleanpress-fr_FR.mo (added)
-
includes/lang/kt-cleanpress-fr_FR.po (added)
-
includes/lang/kt-cleanpress.mo (added)
-
includes/lang/kt-cleanpress.po (added)
-
kt-cleanpress.php (modified) (1 diff)
-
readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
kt-cleanpress/trunk/includes/css/ktclean.css
r572415 r579704 19 19 .ktcleanpressright{ 20 20 margin:10px 0px 10px 25px; 21 width: 5 50px;21 width: 500px; 22 22 height:450px; 23 23 float: left; … … 27 27 .ktcleanpressleft{ 28 28 margin:10px 0px 0px 10px; 29 width: 350px;29 width:450px; 30 30 height:450px; 31 31 float: left; -
kt-cleanpress/trunk/includes/kt-initdisplay.php
r572415 r579704 68 68 case 'clean-trash': 69 69 case 'clean-pending': 70 if(! array_key_exists('post_options', $ktqueryarr))71 $ktqueryarr['post _options'] = "('" . $value . "'";70 if(!isset($ktqueryarr['post'])) 71 $ktqueryarr['post'] = "('" . $value . "'"; 72 72 else 73 $ktqueryarr['post _options'] .= ",'" . $value . "'";73 $ktqueryarr['post'] .= ",'" . $value . "'"; 74 74 break; 75 75 case 'cleanp-draft': 76 76 case 'cleanp-trash': 77 77 case 'cleanp-pending': 78 if(! array_key_exists('pages_options', $ktqueryarr))79 $ktqueryarr['page s_options'] = "('" . $value . "'";78 if(!isset($ktqueryarr['page'])) 79 $ktqueryarr['page'] = "('" . $value . "'"; 80 80 else 81 $ktqueryarr['page s_options'] .= ",'" .$value . "'";81 $ktqueryarr['page'] .= ",'" .$value . "'"; 82 82 break; 83 83 case 'clean-spam': 84 84 case 'clean-unaproved': 85 85 case 'clean-trashcomment': 86 if(! array_key_exists('comment_options', $ktqueryarr))86 if(!isset($ktqueryarr['comment_options'])) 87 87 $ktqueryarr['comment_options'] = "('" . $value . "'"; 88 88 else … … 138 138 global $wpdb; 139 139 $ktextime = microtime(true); 140 $ktsize['originalsize'] = (int) $wpdb->get_var("SELECT SUM(DATA_LENGTH) + SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . constant("DB_NAME") . "' GROUP BY TABLE_SCHEMA;");141 140 $ktterms = array('clean-emptyc' => 'category' ,'clean-emptyt' => 'post_tag', 142 141 'clean-draft' => 'draft' , 'clean-trash' => 'trash' , 'clean-pending' => 'pending', … … 157 156 } 158 157 } 159 158 if (!empty($ktterms)){ 159 $ktsize['originalsize'] = (int) $wpdb->get_var("SELECT SUM(DATA_LENGTH) + SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . constant("DB_NAME") . "' GROUP BY TABLE_SCHEMA;"); 160 160 $ktqueryarr = kt_crquery_arr($ktterms); 161 161 foreach ($ktqueryarr as $key => $value) { 162 162 switch ($key){ 163 case 'pages_options': 164 $wpdb->query("DELETE t1 FROM $wpdb->posts AS t1, $wpdb->posts AS t2 WHERE t1.post_parent = t2.id AND t2.post_type = 'page' AND t2.post_status IN $value ) AND t1.post_type='revision';"); 165 $wpdb->query("UPDATE $wpdb->posts As t1, $wpdb->posts AS t2 set t1.post_parent = 0 WHERE t1.post_parent = t2.id AND t2.post_type = 'page' AND t2.post_status IN $value );"); 166 $wpdb->query("DELETE t1 FROM $wpdb->commentmeta AS t1 , $wpdb->comments AS t2 WHERE t1.comment_id = t2.comment_id AND t2.comment_post_id IN (SELECT id FROM $wpdb->posts where post_status IN $value ) AND post_type = 'page');"); 167 $wpdb->query("DELETE FROM t1 USING $wpdb->comments AS t1 , $wpdb->posts AS t2 WHERE t1.comment_post_id = t2.id AND t2.post_type = 'page' AND t2.post_status IN $value );"); 168 $wpdb->query("DELETE FROM t1 USING $wpdb->postmeta AS t1 , $wpdb->posts AS t2 WHERE t1.post_id = t2.id AND t2.post_type = 'page' AND t2.post_status IN $value );"); 169 $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'page' AND post_status IN $value ) ;"); 170 break; 171 172 case 'post_options': 173 $wpdb->query("DELETE t1 FROM $wpdb->posts AS t1, $wpdb->posts AS t2 WHERE t1.post_parent = t2.id AND t2.post_type = 'post' AND t2.post_status IN $value ) AND t1.post_type='revision';"); 174 $wpdb->query("UPDATE $wpdb->posts As t1, $wpdb->posts AS t2 set t1.post_parent = 0 WHERE t1.post_parent = t2.id AND t2.post_type = 'post' AND t2.post_status IN $value );"); 175 $wpdb->query("DELETE FROM t1 USING $wpdb->postmeta AS t1 , $wpdb->posts AS t2 WHERE t1.post_id = t2.id AND t2.post_type = 'post' AND t2.post_status IN $value );"); 176 $wpdb->query("DELETE t1 FROM $wpdb->commentmeta AS t1 , $wpdb->comments AS t2 WHERE t1.comment_id = t2.comment_id AND t2.comment_post_id IN (SELECT id FROM $wpdb->posts where post_status IN $value ) AND post_type = 'post');"); 177 $wpdb->query("DELETE FROM t1 USING $wpdb->comments AS t1 , $wpdb->posts AS t2 WHERE t1.comment_post_id = t2.id AND t2.post_type = 'post' AND t2.post_status IN $value );"); 178 $wpdb->query("DELETE t1 FROM $wpdb->term_relationships AS t1 , $wpdb->term_taxonomy AS t2 WHERE t1.term_taxonomy_id = t2.term_taxonomy_id AND t2.taxonomy IN ('category','post_tag') AND t1.object_id IN (SELECT id FROM $wpdb->posts where post_status IN $value ) AND post_type = 'post');"); 179 $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = 'post' AND post_status IN $value ) ;"); 180 break; 163 case 'page': 164 case 'post': 165 $wpdb->query("DELETE t1 FROM $wpdb->posts AS t1, $wpdb->posts AS t2 WHERE t1.post_parent = t2.id AND t2.post_type = '$key' AND t2.post_status IN $value ) AND t1.post_type='revision';"); 166 $wpdb->query("UPDATE $wpdb->posts As t1, $wpdb->posts AS t2 set t1.post_parent = 0 WHERE t1.post_parent = t2.id AND t2.post_type = '$key' AND t2.post_status IN $value );"); 167 $wpdb->query("DELETE t1 FROM $wpdb->commentmeta AS t1 , $wpdb->comments AS t2 WHERE t1.comment_id = t2.comment_id AND t2.comment_post_id IN (SELECT id FROM $wpdb->posts where post_status IN $value ) AND post_type = '$key');"); 168 $wpdb->query("DELETE FROM t1 USING $wpdb->comments AS t1 , $wpdb->posts AS t2 WHERE t1.comment_post_id = t2.id AND t2.post_type = '$key' AND t2.post_status IN $value );"); 169 $wpdb->query("DELETE FROM t1 USING $wpdb->postmeta AS t1 , $wpdb->posts AS t2 WHERE t1.post_id = t2.id AND t2.post_type = '$key' AND t2.post_status IN $value );"); 170 if($key == 'post') 171 $wpdb->query("DELETE t1 FROM $wpdb->term_relationships AS t1 , $wpdb->term_taxonomy AS t2 WHERE t1.term_taxonomy_id = t2.term_taxonomy_id AND t2.taxonomy IN ('category','post_tag') AND t1.object_id IN (SELECT id FROM $wpdb->posts where post_status IN $value ) AND post_type = '$key');"); 172 $wpdb->query("DELETE FROM $wpdb->posts WHERE post_type = '$key' AND post_status IN $value ) ;"); 173 break; 174 181 175 182 176 case 'comment_options': … … 214 208 } 215 209 } 210 if (isset($ktterms['clean-optimize'])) 211 kt_optimize($kttables); 212 else 213 kt_optimize(kt_croptdb_arr($ktterms)); 214 $ktsize['finalsize'] = (int) $wpdb->get_var("SELECT SUM(DATA_LENGTH) + SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . constant("DB_NAME") . "' GROUP BY TABLE_SCHEMA;"); 215 $ktsize['difference'] = $ktsize['originalsize'] - $ktsize['finalsize']; 216 foreach ($ktsize as $key => $value) 217 $ktsize[$key] = kt_format_bytes($value); 218 } 216 219 217 218 if (empty($ktterms)) { 220 else 219 221 $ktsize['empty']='empty'; 220 }221 else{222 if (isset($ktterms['clean-optimize']))223 kt_optimize($kttables);224 else225 kt_optimize(kt_croptdb_arr($ktterms));226 }227 228 $ktsize['finalsize'] = (int) $wpdb->get_var("SELECT SUM(DATA_LENGTH) + SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . constant("DB_NAME") . "' GROUP BY TABLE_SCHEMA;");229 $ktsize['difference'] = $ktsize['originalsize'] - $ktsize['finalsize'];230 231 foreach ($ktsize as $key => $value) {232 if($key != 'empty')233 $ktsize[$key] = kt_format_bytes($value);234 }235 222 236 223 $ktextime -= microtime(true); -
kt-cleanpress/trunk/includes/kt-left-display-options.php
r572415 r579704 5 5 <script type="text/javascript"> 6 6 function ktselectall(formid) { 7 for (i=0;i<formid.elements.length;i++) 8 if (formid.elements[i].className == 'ktcheckbox') { 7 var i = 0; 8 for (i;i<formid.elements.length;i++) 9 if (formid.elements[i].type == 'checkbox') { 9 10 formid.elements[i].checked = 'checked'; 10 11 } … … 34 35 <legend><?php _e( 'Posts Cleaning options' , 'kt-cleanpress' )?></legend> 35 36 <label for="clean-draft"><?php _e('Clean Draft Posts' , 'kt-cleanpress')?></label> 36 <input type="checkbox" id="clean-draft" name="clean-draft" class="ktcheckbox">37 <input type="checkbox" id="clean-draft" name="clean-draft" > 37 38 <label for="clean-pending"><?php _e('Clean Pending Posts' , 'kt-cleanpress')?></label> 38 <input type="checkbox" id="clean-pending" name="clean-pending" class="ktcheckbox">39 <input type="checkbox" id="clean-pending" name="clean-pending" > 39 40 <label for="clean-trash"><?php _e('Clean Trash Posts' , 'kt-cleanpress')?></label> 40 <input type="checkbox" id="clean-trash" name="clean-trash" class="ktcheckbox">41 <input type="checkbox" id="clean-trash" name="clean-trash" > 41 42 </fieldset> 42 43 <fieldset> 43 44 <legend><?php _e( 'Pages Cleaning options' , 'kt-cleanpress' )?></legend> 44 45 <label for="cleanp-draft"><?php _e('Clean Draft Pages' , 'kt-cleanpress')?></label> 45 <input type="checkbox" id="cleanp-draft" name="cleanp-draft" class="ktcheckbox">46 <input type="checkbox" id="cleanp-draft" name="cleanp-draft" > 46 47 <label for="cleanp-pending"><?php _e('Clean Pending Pages' , 'kt-cleanpress')?></label> 47 <input type="checkbox" id="cleanp-pending" name="cleanp-pending" class="ktcheckbox">48 <input type="checkbox" id="cleanp-pending" name="cleanp-pending" > 48 49 <label for="cleanp-trash"><?php _e('Clean Trash Pages' , 'kt-cleanpress')?></label> 49 <input type="checkbox" id="cleanp-trash" name="cleanp-trash" class="ktcheckbox">50 <input type="checkbox" id="cleanp-trash" name="cleanp-trash" > 50 51 </fieldset> 51 52 <fieldset> 52 53 <legend><?php _e( 'Comments Cleaning options' , 'kt-cleanpress' )?></legend> 53 54 <label for="clean-spam"><?php _e('Clean Spam Comments' , 'kt-cleanpress')?></label> 54 <input type="checkbox" id="clean-spam" name="clean-spam" class="ktcheckbox">55 <input type="checkbox" id="clean-spam" name="clean-spam" > 55 56 <label for="clean-unaproved"><?php _e('Clean Unapproved Comments' , 'kt-cleanpress')?></label> 56 <input type="checkbox" id="clean-unaproved" name="clean-unaproved" class="ktcheckbox">57 <input type="checkbox" id="clean-unaproved" name="clean-unaproved" > 57 58 <label for="clean-trashcomment"><?php _e('Clean Trash Comments' , 'kt-cleanpress')?></label> 58 <input type="checkbox" id="clean-trashcomment" name="clean-trashcomment" class="ktcheckbox">59 <input type="checkbox" id="clean-trashcomment" name="clean-trashcomment" > 59 60 </fieldset> 60 61 <fieldset> 61 62 <legend><?php _e( 'Other Cleaning options' , 'kt-cleanpress' )?></legend> 62 63 <label for="clean-revision"><?php _e('Clean Post Revisions' , 'kt-cleanpress')?></label> 63 <input type="checkbox" id="clean-revision" name="clean-revision" class="ktcheckbox">64 <input type="checkbox" id="clean-revision" name="clean-revision" > 64 65 <label for="clean-autodraft"><?php _e('Clean Auto Draft' , 'kt-cleanpress')?></label> 65 <input type="checkbox" id="clean-autodraft" name="clean-autodraft" class="ktcheckbox">66 <input type="checkbox" id="clean-autodraft" name="clean-autodraft" > 66 67 <label for="clean-navmenulock"><?php _e('Clean Other Left Overs' , 'kt-cleanpress')?></label> 67 <input type="checkbox" id="clean-navmenulock" name="clean-navmenulock" class="ktcheckbox">68 <input type="checkbox" id="clean-navmenulock" name="clean-navmenulock" > 68 69 <label for="clean-emptyc"><?php _e('Clean Empty Categories' , 'kt-cleanpress')?></label> 69 <input type="checkbox" id="clean-emptyc" name="clean-emptyc" class="ktcheckbox">70 <input type="checkbox" id="clean-emptyc" name="clean-emptyc" > 70 71 <label for="clean-emptyt"><?php _e('Clean Empty Tags' , 'kt-cleanpress')?></label> 71 <input type="checkbox" id="clean-emptyt" name="clean-emptyt" class="ktcheckbox">72 <input type="checkbox" id="clean-emptyt" name="clean-emptyt" > 72 73 <label for="clean-optimize"><?php _e('Optimize Tables' , 'kt-cleanpress')?></label> 73 <input type="checkbox" id="clean-optimize" name="clean-optimize" class="ktcheckbox">74 <input type="checkbox" id="clean-optimize" name="clean-optimize" > 74 75 </fieldset> 75 76 <input type="button" class="button-primary" onclick="ktselectall(document.getElementById('ktcleanpost'));" value="<?php _e('Select All','kt-cleanpress')?>"> -
kt-cleanpress/trunk/includes/kt-right-display-options.php
r572415 r579704 10 10 <span class = "kttitle"><?php _e("Clean Draft Posts:" , 'kt-cleanpress')?></span> 11 11 <span class = "kttext"><?php _e("Will remove all posts marked as Draft including any related database data." , 'kt-cleanpress')?></span><br> 12 <span class = "kttitle"><?php _e("Clean Pending Posts:" )?></span>12 <span class = "kttitle"><?php _e("Clean Pending Posts:" , 'kt-cleanpress')?></span> 13 13 <span class = "kttext"><?php _e("Will remove all posts marked as pending including any related database data." , 'kt-cleanpress')?></span><br> 14 <span class = "kttitle"><?php _e("Clean trash Posts:" )?></span>14 <span class = "kttitle"><?php _e("Clean trash Posts:" , 'kt-cleanpress')?></span> 15 15 <span class = "kttext"><?php _e("Will remove all posts marked as trash including any related database data." , 'kt-cleanpress')?></span><br> 16 16 </fieldset> 17 17 <fieldset> 18 18 <legend><?php _e("Pages Cleaning Options" , 'kt-cleanpress')?></legend> 19 <span class = "kttitle"><?php _e("Clean Draft Pages:" )?></span>19 <span class = "kttitle"><?php _e("Clean Draft Pages:" , 'kt-cleanpress')?></span> 20 20 <span class = "kttext"><?php _e("Will remove all pages marked as Draft including any related database data." , 'kt-cleanpress')?></span><br> 21 <span class = "kttitle"><?php _e("Clean Pending Pages:" )?></span>21 <span class = "kttitle"><?php _e("Clean Pending Pages:" , 'kt-cleanpress')?></span> 22 22 <span class = "kttext"><?php _e("Will remove all pages marked as Pending any related database data." , 'kt-cleanpress')?></span><br> 23 <span class = "kttitle"><?php _e("Clean Trash Pages:" )?></span>23 <span class = "kttitle"><?php _e("Clean Trash Pages:" , 'kt-cleanpress')?></span> 24 24 <span class = "kttext"><?php _e("Will remove all pages marked as Trash any related database data." , 'kt-cleanpress')?></span><br> 25 25 </fieldset> 26 26 <fieldset> 27 27 <legend><?php _e("Comments Cleaning Options" , 'kt-cleanpress')?></legend> 28 <span class = "kttitle"><?php _e("Clean Spam Comments:" )?></span>28 <span class = "kttitle"><?php _e("Clean Spam Comments:" , 'kt-cleanpress')?></span> 29 29 <span class = "kttext"><?php _e("Will remove all comments marked as spam including any related database data." , 'kt-cleanpress')?></span><br> 30 <span class = "kttitle"><?php _e("Clean Unapproved Comments:" )?></span>30 <span class = "kttitle"><?php _e("Clean Unapproved Comments:" , 'kt-cleanpress')?></span> 31 31 <span class = "kttext"><?php _e("Will remove all comments marked as unapproved including any related database data." , 'kt-cleanpress')?></span><br> 32 <span class = "kttitle"><?php _e("Clean Trash Comments:" )?></span>32 <span class = "kttitle"><?php _e("Clean Trash Comments:" , 'kt-cleanpress')?></span> 33 33 <span class = "kttext"><?php _e("Will remove all comments marked as trash including any related database data." , 'kt-cleanpress')?></span><br> 34 34 </fieldset> 35 35 <fieldset> 36 36 <legend><?php _e("Other Cleaning Options" , 'kt-cleanpress')?></legend> 37 <span class = "kttitle"><?php _e("Clean Post Revisions:" )?></span>37 <span class = "kttitle"><?php _e("Clean Post Revisions:" , 'kt-cleanpress')?></span> 38 38 <span class = "kttext"><?php _e("Whenever a post is edited and saved WordPress automatically creates a backup to which one can revert. This option will remove all posts backups." , 'kt-cleanpress')?></span><br> 39 <span class = "kttitle"><?php _e("Clean Auto Draft :" )?></span>39 <span class = "kttitle"><?php _e("Clean Auto Draft :" , 'kt-cleanpress')?></span> 40 40 <span class = "kttext"><?php _e("This is a left over from the process of creating a new WordPress page or post and not saving it as a draft of publishing it." , 'kt-cleanpress')?></span><br> 41 <span class = "kttitle"><?php _e("Clean Other Left Overs:" )?></span>41 <span class = "kttitle"><?php _e("Clean Other Left Overs:" , 'kt-cleanpress')?></span> 42 42 <span class = "kttext"><?php _e("Will remove navigation menus that are created but not saved , and all their related data , and will also remove unneeded lock and last entries in the database." , 'kt-cleanpress')?></span><br> 43 <span class = "kttitle"><?php _e("Clean Empty Categories:" )?></span>43 <span class = "kttitle"><?php _e("Clean Empty Categories:" , 'kt-cleanpress')?></span> 44 44 <span class = "kttext"><?php _e("Will delete all categories that don’t have any post or link associated with them but will not remove the default WordPress categories." , 'kt-cleanpress')?></span><br> 45 <span class = "kttitle"><?php _e("Clean Empty Tags:" )?></span>45 <span class = "kttitle"><?php _e("Clean Empty Tags:" , 'kt-cleanpress')?></span> 46 46 <span class = "kttext"><?php _e("Will delete all tags that don’t have any post associated with them." , 'kt-cleanpress')?></span><br> 47 <span class = "kttitle"><?php _e("Optimize Tables:" )?></span>47 <span class = "kttitle"><?php _e("Optimize Tables:" , 'kt-cleanpress')?></span> 48 48 <span class = "kttext"><?php _e("Reclaim unused space and defragment the data file." , 'kt-cleanpress')?></span><br> 49 49 </fieldset> -
kt-cleanpress/trunk/kt-cleanpress.php
r572415 r579704 3 3 /* 4 4 Plugin Name: kt-cleanpress 5 Plugin URI: http ://keefthis.info5 Plugin URI: https://wordpress.org/extend/plugins/kt-cleanpress/ 6 6 Description: Clean and Optimize wordpress 7 Version: 1. 07 Version: 1.1 8 8 Author: MWK 9 9 Author URI: http://keefthis.info -
kt-cleanpress/trunk/readme.txt
r572415 r579704 2 2 Contributors: mwaelk 3 3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=GZ2SG97EGBFH4 4 Tags: clean, optimize, database, remove, trash 4 Tags: clean, optimize, database, remove, trash, revision, autodraft 5 5 Requires at least: 3.1 6 Tested up to: 3.4 7 Stable tag: 1. 06 Tested up to: 3.4.1 7 Stable tag: 1.1 8 8 License: GPLv2 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 27 27 6. Clean Other Left Overs: Will remove navigation menus that are created but not saved, and all their related data, and will also remove unneeded lock and last entries in the database. 28 28 29 7. Clean Empty Categories / Tags: Will delete all categories/Tags that do nt have any post or link associated with them but will not remove the default WordPress categories.29 7. Clean Empty Categories / Tags: Will delete all categories/Tags that do not have any post or link associated with them but will not remove the default WordPress categories. 30 30 31 31 8. Optimize The Tables: Reclaim unused space and defragment the data file. 32 33 32 34 33 … … 48 47 == Changelog == 49 48 50 49 1. Some code cleaning , and added French translation. 51 50 52 51
Note: See TracChangeset
for help on using the changeset viewer.