GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Webmaster Q & Fuckin' A (https://gfy.com/forumdisplay.php?f=27)
-   -   wordpress nextgen gallery - php question (https://gfy.com/showthread.php?t=1100164)

LucyVanAngel 02-17-2013 10:01 AM

wordpress nextgen gallery - php question
 
Hi,

i got a big problem,
i use the nextgen gallery plugin on one of my blogs, the blog has already 12k posts and aprox 300k images in the nextgen database. although the blog it self loads perfect (also due to a very fast server) the wp admin became incredibly slow. my host said its the nextgen gallery plugin which makes it load so slow. each time i am uploading a picture zip file to the database the plugin is running "SELECT meta_data FROM wp_ngg_pictures" which returns over 332000 rows.
Is there a way to stop this ? Or a way to reduce the requests ?

here is the php code:


// Query database for existing values
// Use cache object
$old_values = $wpdb->get_var( $wpdb->prepare( "SELECT meta_data FROM $wpdb->nggpictures WHERE pid = %d ", $id ) );
$old_values = unserialize( $old_values );

P. Enrique 02-17-2013 07:01 PM

Hi, from quickly searching the source code of NextGen gallery it seems that the php code you posted is from the function that updates meta data for one image (the one whose pid matches $id). So this database query should only return one row. I browsed through the calls to this function and it doesn't look like anyone's looping through a huge amount of images, at a maximum only the number of images that you're uploading. What makes you so sure this query is returning such a huge amount of rows? Please note that I'm no expert in NextGen Gallery, I just happen to have a copy of the sources. :)

BigChad 02-17-2013 08:04 PM

I'm not an expert in anything, but I know my word press site has been running extremely slow on video uploads, and I don't use the nextgen gallery. My video uploads are so slow that it times out at times. Maybe it's in the WordPress update itself?

Jinn 02-20-2013 05:23 AM

Why not just add a line to check the length of the query result? Or do a var_dump on the query result. It's inside the admin area so it won't affect your visitor view (not tested). Turn on WP_DEBUG for more info. But don't do it on your production site, it may produce all sorts of warning messages, depending how well your plugins were tested.

Kostly 02-20-2013 08:57 AM

print_f($old_values); should do a good job.

LucyVanAngel 02-21-2013 02:42 AM

Thanks guys, Problem solved !! :)


All times are GMT -7. The time now is 01:33 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc