Support » Plugin: Media Library Categories » [Plugin: Media Library Categories] 40% performance hit

Viewing 5 replies - 1 through 5 (of 5 total)
  • Ok, I found another thread addressing this issue – Sitewide slowdown.

    The mc() mod did not help but the other SHOW COLUMNS and if empty() did reduce the plugin load time from 1.3sec to 0.04sec

    Is there any risk of these mods breaking desired functionality – possibly page level scripts that display media by category?

    Site operation appears stable and snappier with the above mods.

    Hi Awoz,
    Can you please explain what you mean in the second post:
    “…the other SHOW COLUMNS and if empty() did reduce the plugin load time…”
    I’m was forced to turn off this plug-in due to load times, but if there’s a way to resolve this, it would be very helpful!
    Thanks!
    Jason

    Hello Jason,

    From the “Sitewide slowdown” post, I came up with this solution. Edit the “media-categories.php” file and make these changes.

    at line 153, replace:

    $query = "
    SELECT COUNT(*) FROM information_schema.COLUMNS
    WHERE
    TABLE_NAME = '$wpdb->terms'
    AND COLUMN_NAME = 'term_order';
    ";

    with:

    $query = "
    SHOW COLUMNS FROM $wpdb->terms LIKE 'term_order';
    ";

    at line 167, replace:

    if($row_count==0)

    with:

    if(empty($row_count))

    Hope it works for you as well as it does for me.

    Works very well for me. I was wondering why my site suddenly crawled.

    Also, the sort page is still not working, so the “Sort Media Items” links are essentially useless. In order to make these nice listing pages at least a bit useful (even without the sorting capability) I hacked sort.php to allow linking to view and edit the images:

    (Starting on line 147 replace whole if statement with)

    if ($results){
    		$num_rows = count($results);
    		if($num_rows>0)
    		{
    			$i=1;
    			$bgcol="";
    			foreach ( $results as $row )
     { 
    
    				$label = $row->post_title;
    				$id = $row->ID;
    				$fileUrl = $row->guid;
    				$mime = $row->post_mime_type;
    
    				$thumbnailSize = 'thumbnail';
    				$thumb = wp_get_attachment_image_src( $id, 'thumbnail' );
    				$full = wp_get_attachment_image_src( $id, 'full' ); //--- fix to view full images RHD
    				$editlink = "media.php?attachment_id=".$id."&action=edit";  //--- fix to link to image edit RHD
    
    				$currentOrderBy = $row->term_order;
    
    				if($mime=='image/jpeg')
    				{
    					print "
    					<tr id='$id' style='background-color:$bgcol'>
    						<td>$id</td>
    						<td><a href='".$editlink."' title='Edit Image'>$label</a></td>
    						<td><a href='".$full[0]."' title='View Full-Sized Image'><img src='".$thumb[0]."' /></a></td>
    					</tr>";
    				}
    				else
    				{
    					print "
    					<tr id='$id' style='background-color:$bgcol'>
    						<td>$id</td>
    						<td>".$fileUrl."</td>
    					</tr>";
    				}
    
    				$i+=1;
    
    			}
    		}
    		}

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: Media Library Categories] 40% performance hit’ is closed to new replies.