Changeset 2020051
- Timestamp:
- 01/27/2019 09:56:28 PM (7 years ago)
- Location:
- dboptimizer/trunk
- Files:
-
- 3 edited
-
WP_DB-admin.php (modified) (1 diff)
-
db_optimizer.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
dboptimizer/trunk/WP_DB-admin.php
r302344 r2020051 1 1 <?php 2 global $wpdb; 2 3 if (isset($_POST['button4'])) { 3 echo "<br /> 4 <strong>Optimizing :</strong><br />"; 5 $alltables = mysql_query("SHOW TABLES"); 4 echo "<br /><strong>Optimizing tables:</strong><br /><hr>"; 5 $alltables = $wpdb->get_results("SHOW TABLE STATUS"); 6 6 ob_start(); 7 while ($table = mysql_fetch_assoc($alltables))7 foreach ($alltables as $id=>$table) 8 8 { 9 foreach ($table as $db => $tablename) 10 { 11 ob_flush(); 12 echo "Optimizing table : ".$tablename; 13 $qry = ("OPTIMIZE TABLE $tablename"); 14 $rez = mysql_query($qry); 15 if ($rez) { echo " - OK <br />"; } else { echo " - Error in optimizing this table !<br />";} 16 ob_flush(); 17 flush(); 18 usleep(500000); 19 } 9 ob_flush(); 10 echo "Optimizing table : ".$table->Name; 11 $qry = ("OPTIMIZE TABLE ".$table->Name); 12 $rez = $wpdb->query($qry); 13 if ($rez==1) { echo " - OK <br />"; } else { echo " - Error in optimizing this table !<br />";} 14 ob_flush(); 15 flush(); 16 usleep(1000); 20 17 } 21 echo "<br /> 22 <br /> 23 Optimization process finished. <a href=\"?page=DBOptimizer\"> Return </a> to Database optimizer.<br /> 24 "; 25 26 18 echo "<br /><br /> 19 Table optimization process finished. <a href=\"?page=DBOptimizer\"> Return </a> to Database optimizer.<br />"; 20 } else { 21 if (isset($_POST['button5'])) { 22 echo "<br /><br /> 23 <strong>Reparing tables:</strong><br /><hr>"; 24 $alltables = $wpdb->get_results("SHOW TABLE STATUS"); 25 ob_start(); 26 foreach ($alltables as $id=>$table) 27 { 28 ob_flush(); 29 echo "Reparing table : ".$table->Name; 30 $qry = ("REPAIR TABLE ".$table->Name); 31 $rez = $wpdb->query($qry); 32 print_r($rez); 33 if ($rez==1) { echo " - OK <br />"; } else { echo " - Error encountered while repairing this table !<br />";} 34 ob_flush(); 35 flush(); 36 usleep(1000); 37 } 38 echo "<br /> 39 <br /> 40 Table reparing process finished. <a href=\"?page=DBOptimizer\"> Return </a> to Database optimizer.<br /> 41 "; 27 42 } else { 28 43 ?> 29 44 <form id="form3" name="form3" method="post" action=""> 30 <br /> 31 Database name : <?=DB_NAME?>32 <input type="submit" name="button4" id="button4" value="Optimize Now !" />45 <br />Database name : <?=DB_NAME?><hr> 46 <input type="submit" class="button" name="button4" id="button4" value="Optimize Now !" /> 47 <input type="submit" class="button" name="button5" id="button5" value="Repair Tables" /> 33 48 </form> 34 49 <br /> 35 <table width="100%" class="widefat fixed"> 36 50 <table width="100%" class="wp-list-table widefat fixed striped posts"> 37 51 <thead> 38 39 52 <tr> 40 41 53 <th width="15%" scope="col">Table Name</th> 42 43 54 <th width="16%" scope="col">Table Size</th> 44 45 46 55 <th width="16%" scope="col">Table Rows</th> 47 56 </tr> 48 57 </thead> 49 50 58 <tbody> 51 59 <?php 52 60 $tables = array(); 53 54 $result = mysql_query("SHOW TABLE STATUS"); 55 $tot=0; 56 $rs =0; 57 $nrs=0; 58 while($row = mysql_fetch_array($result)) { 59 /* We return the size in Kilobytes */ 60 $total_size = ($row[ "Data_length" ] + $row[ "Index_length" ]) / 1024; 61 //$tables[$row['Name']] = sprintf("%.2f", $total_size); 62 $rs++; 63 $tbl = $row['Name']; 64 $tot = $tot + $total_size; 65 ?> 66 <tr> 67 68 <td> <?=$tbl?></td> 69 70 <td> <?=$total_size?> Kb. (<?php echo number_format($total_size/1024,'2','.','');?>) Mb.</td> 71 72 <td><?php 73 $q=("select * from $tbl");$rez=mysql_query($q);echo $rowss=mysql_num_rows($rez);$nrs=$nrs+$rowss; 74 ?> Rows</td> 61 $result = $wpdb->get_results("SHOW TABLE STATUS"); 62 $tot=0; 63 $rs =0; 64 $nrs=0; 65 foreach($result as $id=>$row) { 66 $total_size = ($row->Data_length + $row->Index_length) / 1024; 67 $rs++; 68 $tbl = $row->Name; 69 $tot = $tot + $total_size; 70 ?> 71 <tr> 72 <td><?=$tbl?></td> 73 <td><?=$total_size?> Kb. (<?php echo number_format($total_size/1024,'2','.','');?>) Mb.</td> 74 <td> 75 <?php 76 $rowss = $wpdb->get_var( "SELECT COUNT(*) FROM $tbl" ); 77 echo $rowss; 78 $nrs=$nrs+$rowss; 79 ?> Rows 80 </td> 75 81 </tr> 76 <?php }?> 77 <tr> 78 <td>Total : <?=$rs?> Tables</td> 79 <td>Total : <?=$tot?> Kb (<?php echo number_format($tot/1024,'2','.','');?>) Mb.</td> 80 <td>Total : <?=$nrs?> Rows</td> 81 </tr> 82 82 <?php }?> 83 <tr> 84 <td>Total : <?=$rs?> Tables</td> 85 <td>Total : <?=$tot?> Kb (<?php echo number_format($tot/1024,'2','.','');?>) Mb.</td> 86 <td>Total : <?=$nrs?> Rows</td> 87 </tr> 83 88 </tbody> 84 89 </table> 85 <?php }?> 90 <?php } 91 }?> -
dboptimizer/trunk/db_optimizer.php
r302344 r2020051 2 2 /** 3 3 * @package Database Optimizer 4 * @version 1.0.04 * @version 2.0.0 5 5 */ 6 6 /* 7 7 Plugin Name: Database Optimizer 8 8 Plugin URI: http://wordpress.org/# 9 Description: Database optimization for Wordpress9 Description: Database optimization and repairing for Wordpress 10 10 Author: Bledar Leka 11 Version: 1.0.012 Author URI: http:// www.pikaweb.com/11 Version: 2.0.0 12 Author URI: http://bweb.solution/ 13 13 */ 14 14 15 15 function DTB_menu() 16 16 { 17 echo "<br /> 18 < br />19 Database optimization Tool for Wordpress";17 echo "<br /><h1 class=\"wp-heading-inline\">DBOptimizer</h1> 18 <hr> 19 Database optimization and repairing Tool for WordPress"; 20 20 include('WP_DB-admin.php'); 21 21 } -
dboptimizer/trunk/readme.txt
r302344 r2020051 1 1 === DBOptimizer === 2 2 Contributors: bledileka 3 Donate link: http:// www.pikaweb.com/4 Tags: database, optimize 5 Requires at least: 2.0.26 Tested up to: 3.0.17 Stable tag: 1.03 Donate link: http://bweb.solutions/ 4 Tags: database, optimize, repair 5 Requires at least: 5.0.0 6 Tested up to: 5.0.3 7 Stable tag: 2.0 8 8 9 This plugin is just a simple tool that may be useful to keep your wordpress databases optimized. 9 This plugin is just a simple tool that may be useful to keep your wordpress databases optimized. You can also try to repair tables. 10 10 11 11 == Description == … … 17 17 1. Upload `db-optimizer` to the `/wp-content/plugins/` directory 18 18 2. Activate the plugin through the 'Plugins' menu in WordPress 19 3. Just open the DBOptimizer page from your left side menu and optimize your db :)19 3. Just open the DBOptimizer page from your left side menu and optimize your db. 20 20 21 21 == Frequently Asked Questions ==
Note: See TracChangeset
for help on using the changeset viewer.