WP Clean Up
[resolved] Optimize not working in WP 3.9.x (6 posts)

  1. Adam Ainsworth
    Posted 10 months ago #

    No option to optimize DB and getting the error below

    Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in wp_clean_up_admin.php on line 368

    See screenshot for more detail https://www.dropbox.com/s/wn9q2ygcdr5mz2e/wp-cleanup-bug.jpg


  2. dawiyo
    Posted 9 months ago #

    I'm seeing the same error.

  3. khanman225
    Posted 8 months ago #

    The way WordPress runs some mysql queries has changed in 3.9 and mysql_query is deprecated in favor of mysqli.

    Replace these two spots in wp_clean_up_admin.php:

    line 108

    function wp_clean_up_optimize(){
        global $wpdb;
    	$wcu_sql = 'SHOW TABLE STATUS FROM '.DB_NAME;
    	$result = $wpdb->get_results($wcu_sql);
    	foreach($result as $row) {
    		$wcu_sql = 'OPTIMIZE TABLE '.$row->Name;

    line 363

    global $wpdb;
    		$total_size = 0;
    		$alternate = " class='alternate'";
    		$wcu_sql = 'SHOW TABLE STATUS FROM <code>'.DB_NAME.'</code>';
    		$result = $wpdb->get_results($wcu_sql);
            foreach($result as $row) {
                $table_size = $row->Data_length + $row->Index_length;
                $table_size = $table_size / 1024;
                $table_size = sprintf("%0.3f",$table_size);
                $every_size = $row->Data_length + $row->Index_length;
                $every_size = $every_size / 1024;
                $total_size += $every_size;
                echo "<tr". $alternate .">
                        <td class='column-name'>". $row->Name ."</td>
                        <td class='column-name'>". $table_size ." KB"."</td>
                $alternate = (empty($alternate)) ? " class='alternate'" : "";
  4. dawiyo
    Posted 8 months ago #

    I appreciate the reply but that didn't work for me. I wonder if it being Network Activated has anything to do with it.

  5. Adam Ainsworth
    Posted 8 months ago #

    Hasn't worked for me either, I'm just running a standard install of WP 3.9.1

  6. acalbert
    Plugin Author

    Posted 8 months ago #

    It has been fixed in the new version 1.2.2.Thanks to khanman225.


You must log in to post.

About this Plugin

About this Topic