WordPress.org

Plugin Directory

Changeset 482312


Ignore:
Timestamp:
12/30/11 13:41:48 (2 years ago)
Author:
ruhanirabin
Message:
 
Location:
wp-optimize/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-optimize/trunk/readme.txt

    r354755 r482312  
    11=== WP-Optimize === 
     2 
    23Contributors: ruhanirabin 
     4 
    35Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2732133 
    4 Tags: comments, spam, optimize, database, revisions, users, security, posts 
     6 
     7Tags: comments, spam, optimize, database, revisions, users, posts 
     8 
    59Requires at least: 2.9 
    6 Tested up to: 3.1 
    7 Stable tag: 0.9.2 
    8  
    9 This simple but effective plugin allows you to clean up your WordPress database and optimize it without phpMyAdmin. Also renames any username.  
     10 
     11Tested up to: 3.5 
     12 
     13Stable tag: 0.9.3 
     14 
     15 
     16 
     17This simple but effective plugin allows you to clean up your WordPress database and optimize it without phpMyAdmin. 
     18 
     19 
    1020 
    1121== Description == 
    1222 
     23 
     24 
    1325WP-Optimize is a WordPress 2.9++ database cleanup and optimization tool. It doesn't require PhpMyAdmin to optimize your database tables.  
     26 
    1427It allows you to remove post revisions, comments in the spam queue, un-approved comments within few clicks.  
    1528 
    16 Additionally you can rename any username to another username too. 
    1729 
    1830For example: If you want to rename default 'admin' username to 'someothername'; just put 'admin' (without quotes) to the Old username field and the new username to the New username field, then click "PROCESS") 
    1931 
     32 
    2033Now Multi-Lingual.  
    2134 
     
    2336**Requirements:** 
    2437 
     38 
     39 
    2540*   WordPress 2.9++ 
     41 
    2642*   PHP 5.1.xx 
     43 
    2744*   MySql 5.1.xx 
     45 
    2846*   PHP 4.xx and MySql 4.xx not supported 
    2947 
     48 
     49 
    3050**Translators are welcome to send their Translated Files to be included.** 
     51 
    3152Contact me at http://wwww.ruhanirabin.com/contact/ 
    3253 
     54 
     55 
    3356**Features:** 
    3457 
     58 
     59 
    3560*   Remove the WordPress post revisions 
     61 
    3662*   Remove the WordPress auto draft posts [NEW] 
     63 
    3764*   Remove all the comments in the spam queue 
     65 
    3866*   Remove all the un-approved comments 
    39 *   Rename one username to another username, it's designed to rename default "Admin" user to something else 
     67 
    4068*   Apply mysql optimize commands on your database tables without phpMyAdmin. 
     69 
    4170*   Display Database table statistics. Shows how much space can be optimzied and how much space has been cleared. 
     71 
    4272*   Visible only to the administrators. 
    4373 
    4474 
     75 
     76 
     77 
    4578**How this could help you?** 
    4679 
     80 
     81 
    4782*   Everytime you save a new post or pages, WordPress creates a revision of that post or page. If you edit a post 6 times you might have 5 copy of that post as revisions. Imagine if your post or pages are long and big. It is a huge number of bytes thats on your MySQL overhead. Now WP-Optimize allows you to optimize and shrink your posts table by removing not necessary post revisions from the database. As example, if you have a post which is approximately 100KB data and you have 5 revisions of that post, the total space wasted is about 500KB. And if you have 100 posts similar to it, you have 50MB database space wasted. 
     83 
    4884*   Similar to the scenario described above, there might be thousands of spams and un-approved comments in your comments table, WP-Optimize can clean and remove those in a single click 
     85 
    4986*   WP-Optimize reports which database tables have overhead and wasted spaces also it allows you to shrink and get rid of those wasted spaces 
    50 *   WordPress doesn't allow you to rename existing username which could be a security issue because your default WordPress admin username is "admin", if you read my [WordPress Security guide article](http://www.ruhanirabin.com/14-tips-prevent-wordpress-get-hacked/), you will know the risks involved. WP-Optimize can rename any existing username to other name 
     87 
     88 
    5189 
    5290 
    5391== Installation == 
    5492 
     93 
     94 
    5595*   Unzip the archive into your hard drive.  
     96 
    5697*   Upload the folder to your wp-content/plugins folder on your web host. 
     98 
    5799*   Login to your dashboard and activate the plugin via activate option. 
     100 
    58101*   The main level menu item is WP-Optimize. Scroll down to see it. 
    59102 
     103 
     104 
    60105== Frequently Asked Questions == 
    61106 
     107 
     108 
    62109= I am having error - Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource ...  = 
    63110 
    64 *   Upgrade/Update your WordPress to at least 2.9 
     111 
     112 
     113*   Upgrade/Update your WordPress to at least 3 
     114 
    65115*   Upgrade/Update your WP-Optimize plugin 
     116 
    66117*   Upgrade your PHP to at least 5.1.xx 
     118 
    67119*   Upgrade your MySql to at least MySql 5.1.xx 
     120 
    68121*   Remember: PHP 4.xx and MySql 4.xx not supported 
    69122 
     123 
     124 
    70125= Is there any bug in this plugin = 
    71126 
     127 
     128 
    72129This is a very primary version of the plugin. So I would recommend you to test it out on your local system. 
    73130 
    74 = WordPress logged me out when I rename my username = 
    75  
    76 Because you've changed your username, WordPress can't get authentication data from the database. Use your new username and the password you've used before 
     131 
     132 
    77133 
    78134== Screenshots == 
    79135 
     136 
     137 
    801381. Main screen 
     139 
    811402. Database tables report 
     141 
    821423. Menu Item 
    83143 
     144 
     145 
    84146== Changelog == 
    85147 
     148 
     149= 0.9.3 = 
     150 
     151* Removed security tools. 
     152* Full database size displayed 
     153 
     154 
    86155= 0.9.2 = 
     156 
    87157* Now the plugin is visible to site administrators only. Authors, Contributors, Editors won't be able to see it. 
    88158 
     159 
     160 
    89161= 0.9.1 = 
     162 
    90163* Fixed problem with database names containing "-" . 
     164 
    91165* NEW Main Level Menu Item added for WP-Optimize, You might need to scroll down to see it 
     166 
    92167* Compatibilty with WordPress 3.1 
     168 
    93169* Added few translations 
     170 
    94171* Added auto draft post removal feature 
    95172 
     173 
     174 
    96175= 0.8.0 = 
     176 
    97177* Added Multilanguage capability 
     178 
    98179* Added translation WP-OPTIMIZE.POT file  
     180 
    99181* Farsi Translation included now (Thanks to Ali irani) 
    100182 
     183 
     184 
    101185= 0.7.1 = 
     186 
    102187* POST META Table cleanup code removed cause it is making problems with many hosts 
    103188 
     189 
     190 
    104191= 0.7 = 
     192 
    105193* Added cleanup of POST META Table along with the revisions 
     194 
    106195* Fixed some minor PHP tags which causes the total numbers to disappear 
     196 
    107197* Now requires MySQL 5.1.x and PHP 5.1.x 
    108198 
     199 
     200 
    109201= 0.6.5.1 = 
     202 
    110203* Fix Interface 
     204 
  • wp-optimize/trunk/wp-optimize-admin.php

    r352005 r482312  
    33# ---------------------------------- # 
    44# prevent file from being accessed directly 
     5# ---------------------------------- # 
     6# Removed Security tools             # 
     7# Added total db size                # 
     8# ---------------------------------- # 
    59# ---------------------------------- # 
    610if ('wp-optimize-admin.php' == basename($_SERVER['SCRIPT_FILENAME'])) 
     
    6670            $clean = "DELETE FROM $wpdb->posts WHERE post_type = 'revision'"; 
    6771            $revisions = $wpdb->query( $clean ); 
    68              
    69 /*          $allposts = get_posts('numberposts=-1&orderby=ID&order=ASC&post_type=any&post_status='); 
    70             $allpost_ids = array(); 
    71             foreach ($allposts as $onepost) 
    72                 $allpost_ids[$onepost->ID] = true; 
    73                 $cleaned_ids = array(); 
    74                 $total_cleaned_metas = 0; 
    75                 $postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta", OBJECT); 
    76                     foreach ($postmeta as $meta) 
    77                         if (!isset($allpost_ids[$meta->post_id]) && !isset($cleaned_ids[$meta->post_id])) { 
    78                             $cleaned_metas = $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = '".$meta->post_id."'"); 
    79                             $total_cleaned_metas += $cleaned_metas; 
    80                             $cleaned_ids[$meta->post_id] = true; 
    81                         } */ 
    82                          
    8372            $message .= $revisions.__(' post revisions deleted<br>', 'wp-optimize'); 
    8473            break; 
     
    9079            break; 
    9180 
    92              
    93         //case "postmeta": 
    94  
    95         //  $message .= $total_cleaned_metas.__(' postmeta items from revisions and nonexistant posts deleted', $textdomain); 
    96         //    break; 
    97  
    9881        case "spam": 
    9982            $clean = "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam';"; 
     
    10891            break; 
    10992 
    110  
    111 //        case "optimize-db": 
    112 //            optimizeTables(true); 
    113 //            $message .= "Database ".DB_NAME." Optimized!<br>"; 
    114 //            break; 
     93        //case "optimize-db": 
     94           //optimizeTables(true); 
     95           //$message .= "Database ".DB_NAME." Optimized!<br>"; 
     96           //break; 
    11597 
    11698        case "changeadmin": 
     
    118100                $oldAdmin = $_POST["old_admin"]; 
    119101                $newAdmin = $_POST["new_admin"]; 
    120                 $clean = "UPDATE $wpdb->users SET user_login = '$newAdmin' WHERE user_login ='$oldAdmin'"; 
    121                 $setlogin = $wpdb->query( $clean ); 
    122                     if ($setlogin !== 0){ 
    123                         $message .= __('Admin username updated<br>', 'wp-optimize'); 
    124                     } 
    125                     else{ 
    126                         $message .= ""; 
    127                     } 
     102                //$clean = "UPDATE $wpdb->users SET user_login = '$newAdmin' WHERE user_login ='$oldAdmin'"; 
     103                //$setlogin = $wpdb->query( $clean ); 
     104                //    if ($setlogin !== 0){ 
     105                //        $message .= __('Admin username updated<br>', 'wp-optimize'); 
     106                //    } 
     107                //    else{ 
     108                //        $message .= ""; 
     109                //    } 
    128110            } 
    129111            else{ 
    130                 $message .= __('ADMIN USERNAME NOT UPDATED<br>', 'wp-optimize'); 
     112                //$message .= __('ADMIN USERNAME NOT UPDATED<br>', 'wp-optimize'); 
    131113            } 
    132114            break; 
     
    220202  </tr> 
    221203  <tr> 
    222     <td><a href="#report"><?php _e('Tables Report', 'wp-optimize'); ?></a></td> 
     204    <td><a href="#report"><?php _e('Tables Report > ', 'wp-optimize'); ?></a></td> 
     205    <td>&nbsp;</td> 
     206  </tr> 
     207 
     208  <tr> 
     209    <td><a href="#total"><?php _e('Database Size > ', 'wp-optimize'); ?></a></td> 
    223210    <td>&nbsp;</td> 
    224211  </tr> 
     
    279266     <?php _e('Optimize database tables', 'wp-optimize'); ?></td> 
    280267  </tr> 
    281   <tr> 
     268  <!-- <tr> 
    282269    <td>&nbsp;</td> 
    283270    <td>&nbsp;</td> 
     
    299286    <td><p align="right"><?php _e('New username:', 'wp-optimize'); ?>&nbsp;</p></td> 
    300287    <td><input type="text" name="new_admin" id="new_admin" class="new_admin" size="40" value=""></td> 
    301   </tr> 
     288  </tr> --> 
    302289  <tr> 
    303290    <td>&nbsp;</td> 
     
    341328Function optimizeTables($Optimize=false){ 
    342329?> 
    343  
     330<a name="report">&nbsp;</a> 
    344331<h3><?php _e('Database Tables Report', 'wp-optimize'); ?></h3> 
    345332<h3><?php _e('Database Name:', 'wp-optimize'); ?> '<?php _e(DB_NAME, 'wp-optimize');?>'</h3> 
     
    350337<?php } ?> 
    351338 
    352 <a name="report">&nbsp;</a> 
    353339 
    354340<table class="widefat fixed" cellspacing="0"> 
     
    387373            $total = $total / 1024 ; 
    388374            $total = round ($total,3); 
     375 
     376            $total_db_space = $tot_data + $tot_idx; 
     377            $total_db_space = $total_db_space / 1024 ; 
     378            $total_db_space_a += $total_db_space; 
     379            $total_db_space = round ($total_db_space,3); 
     380 
     381             
    389382            $gain= $row['Data_free']; 
    390383            $gain = $gain / 1024 ; 
     
    429422</tbody> 
    430423</table> 
     424<a name="total">&nbsp;</a> 
     425<h3><?php _e('Total Size of Database:', 'wp-optimize'); ?></h3> 
     426<h2><?php _e('', 'wp-optimize'); ?> <?php echo round ($total_db_space_a,3);?> Kb</h2> 
    431427 
    432428<?php if (isset($_POST["optimize-db"])) { 
  • wp-optimize/trunk/wp-optimize.php

    r354755 r482312  
    44Plugin URI: http://www.ruhanirabin.com/wp-optimize/ 
    55Description: This plugin helps you to keep your database clean by removing post revisions and spams in a blaze. allows you to rename your admin name also. Additionally it allows you to run optimize command on your wordpress core tables (use with caution). 
    6 Version: 0.9.2 
     6Version: 0.9.3 
    77Author: Ruhani Rabin 
    88Author URI: http://www.ruhanirabin.com 
    99 
    10     Copyright 2011  Ruhani Rabin  (email : get@ruhanirabin.com) 
     10    Copyright 2012  Ruhani Rabin  (email : get@ruhanirabin.com) 
    1111 
    1212    This program is free software; you can redistribute it and/or modify 
Note: See TracChangeset for help on using the changeset viewer.